~vanvugt/ubuntu/xenial/bluez/trunk

« back to all changes in this revision

Viewing changes to unit/util.h

  • Committer: Daniel van Vugt
  • Date: 2017-05-24 07:16:52 UTC
  • Revision ID: daniel.van.vugt@canonical.com-20170524071652-8fnev589l3n104m1
Initial import from xenial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 *  OBEX library with GLib integration
 
4
 *
 
5
 *  Copyright (C) 2011  Intel Corporation. All rights reserved.
 
6
 *
 
7
 *  This program is free software; you can redistribute it and/or modify
 
8
 *  it under the terms of the GNU General Public License version 2 as
 
9
 *  published by the Free Software Foundation.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 *
 
20
 */
 
21
 
 
22
enum {
 
23
        TEST_ERROR_TIMEOUT,
 
24
        TEST_ERROR_UNEXPECTED,
 
25
};
 
26
 
 
27
struct test_buf {
 
28
        const void *data;
 
29
        gssize len;
 
30
};
 
31
 
 
32
struct test_data {
 
33
        guint count;
 
34
        GError *err;
 
35
        struct test_buf recv[4];
 
36
        struct test_buf send[4];
 
37
        guint provide_delay;
 
38
        GObex *obex;
 
39
        guint id;
 
40
        gsize total;
 
41
        GMainLoop *mainloop;
 
42
        gboolean io_completed;
 
43
};
 
44
 
 
45
#define TEST_ERROR test_error_quark()
 
46
GQuark test_error_quark(void);
 
47
 
 
48
void dump_bufs(const void *mem1, size_t len1, const void *mem2, size_t len2);
 
49
void assert_memequal(const void *mem1, size_t len1,
 
50
                                                const void *mem2, size_t len2);
 
51
 
 
52
GObex *create_gobex(int fd, GObexTransportType transport_type,
 
53
                                                gboolean close_on_unref);
 
54
void create_endpoints(GObex **obex, GIOChannel **io, int sock_type);
 
55
 
 
56
gboolean test_io_cb(GIOChannel *io, GIOCondition cond, gpointer user_data);
 
57
gboolean test_timeout(gpointer user_data);