diff options
author | Andrea Shepard <andrea@torproject.org> | 2014-07-25 21:41:03 -0700 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2014-07-25 21:41:03 -0700 |
commit | b8b46e8ef847c0683fab00783fb64bef0c6f83c6 (patch) | |
tree | ac6685e52c73e51acbe05eb14dece77583d9ebc9 /src/or | |
parent | 18c97ad8bc85b9c0a0b3cac088f719f7e261c60b (diff) | |
download | tor-b8b46e8ef847c0683fab00783fb64bef0c6f83c6.tar.gz tor-b8b46e8ef847c0683fab00783fb64bef0c6f83c6.zip |
Add some mocks needed to unit test ClientTransportPlugin/ServerTransportPlugin config line parsing
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/entrynodes.c | 4 | ||||
-rw-r--r-- | src/or/entrynodes.h | 2 | ||||
-rw-r--r-- | src/or/transports.c | 12 | ||||
-rw-r--r-- | src/or/transports.h | 10 |
4 files changed, 15 insertions, 13 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 4d09195796..8f105c7844 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1884,8 +1884,8 @@ bridge_resolve_conflicts(const tor_addr_t *addr, uint16_t port, /** Return True if we have a bridge that uses a transport with name * <b>transport_name</b>. */ -int -transport_is_needed(const char *transport_name) +MOCK_IMPL(int, +transport_is_needed, (const char *transport_name)) { if (!bridge_list) return 0; diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 5d91756aa4..8b5ffba7b1 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -151,7 +151,7 @@ struct transport_t; int get_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, const struct transport_t **transport); -int transport_is_needed(const char *transport_name); +MOCK_DECL(int, transport_is_needed, (const char *transport_name)); int validate_pluggable_transports_config(void); double pathbias_get_close_success_count(entry_guard_t *guard); diff --git a/src/or/transports.c b/src/or/transports.c index dc30754162..0fb5926681 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -324,9 +324,9 @@ transport_add(transport_t *t) /** Remember a new pluggable transport proxy at <b>addr</b>:<b>port</b>. * <b>name</b> is set to the name of the protocol this proxy uses. * <b>socks_ver</b> is set to the SOCKS version of the proxy. */ -int -transport_add_from_config(const tor_addr_t *addr, uint16_t port, - const char *name, int socks_ver) +MOCK_IMPL(int, +transport_add_from_config, (const tor_addr_t *addr, uint16_t port, + const char *name, int socks_ver)) { transport_t *t = transport_new(addr, port, name, socks_ver, NULL); @@ -1349,9 +1349,9 @@ managed_proxy_create(const smartlist_t *transport_list, * Requires that proxy_argv be a NULL-terminated array of command-line * elements, containing at least one element. **/ -void -pt_kickstart_proxy(const smartlist_t *transport_list, - char **proxy_argv, int is_server) +MOCK_IMPL(void, +pt_kickstart_proxy, (const smartlist_t *transport_list, + char **proxy_argv, int is_server)) { managed_proxy_t *mp=NULL; transport_t *old_transport = NULL; diff --git a/src/or/transports.h b/src/or/transports.h index 1365ead006..deacdcdd68 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -32,14 +32,16 @@ typedef struct transport_t { void mark_transport_list(void); void sweep_transport_list(void); -int transport_add_from_config(const tor_addr_t *addr, uint16_t port, - const char *name, int socks_ver); +MOCK_DECL(int, transport_add_from_config, + (const tor_addr_t *addr, uint16_t port, + const char *name, int socks_ver)); void transport_free(transport_t *transport); transport_t *transport_get_by_name(const char *name); -void pt_kickstart_proxy(const smartlist_t *transport_list, char **proxy_argv, - int is_server); +MOCK_DECL(void, pt_kickstart_proxy, + (const smartlist_t *transport_list, char **proxy_argv, + int is_server)); #define pt_kickstart_client_proxy(tl, pa) \ pt_kickstart_proxy(tl, pa, 0) |