summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 19:08:02 +0000
committerrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 19:08:02 +0000
commitd0047b2f0a52db034b161132b6b300919f65b056 (patch)
treefab0965b0fca85484f47bac0ea413435099eaa2e /jingle
parentc86257b1177c95fa7b7cf543f991094d32d61022 (diff)
downloadchromium_src-d0047b2f0a52db034b161132b6b300919f65b056.zip
chromium_src-d0047b2f0a52db034b161132b6b300919f65b056.tar.gz
chromium_src-d0047b2f0a52db034b161132b6b300919f65b056.tar.bz2
Use SSL/TCP port for notifications in sync tests.
The sync integration tests start off by using the XMPP port (5222) to connect to the sync notification server. Since this port is blocked on the chromium builders, the tests wait for upto a minute before they failover to the SSL/TCP port (443), by which time the tests time out and fail. This checkin adds a switch that, when enabled, causes the tests to try the SSL/TCP port before the XMPP port. BUG=50595 TEST=sync_integration_tests Review URL: http://codereview.chromium.org/3050036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/notifier/communicator/connection_settings.cc22
-rw-r--r--jingle/notifier/communicator/connection_settings.h2
-rw-r--r--jingle/notifier/communicator/login.cc2
-rw-r--r--jingle/notifier/communicator/login.h1
-rw-r--r--jingle/notifier/communicator/login_settings.cc4
-rw-r--r--jingle/notifier/communicator/login_settings.h6
-rw-r--r--jingle/notifier/communicator/single_login_attempt.cc1
-rw-r--r--jingle/notifier/communicator/xmpp_connection_generator.cc3
-rw-r--r--jingle/notifier/communicator/xmpp_connection_generator.h3
-rw-r--r--jingle/notifier/listener/mediator_thread_impl.cc5
-rw-r--r--jingle/notifier/listener/mediator_thread_impl.h4
-rw-r--r--jingle/notifier/listener/talk_mediator_unittest.cc3
12 files changed, 47 insertions, 9 deletions
diff --git a/jingle/notifier/communicator/connection_settings.cc b/jingle/notifier/communicator/connection_settings.cc
index 1347e46..7215417 100644
--- a/jingle/notifier/communicator/connection_settings.cc
+++ b/jingle/notifier/communicator/connection_settings.cc
@@ -44,6 +44,7 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname,
const std::vector<uint32>& iplist,
int16 port,
bool special_port_magic,
+ bool try_ssltcp_first,
bool proxy_only) {
// randomize the list. This ensures the iplist isn't always
// evaluated in the order returned by DNS
@@ -62,7 +63,8 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname,
if (iplist_random.empty()) {
// We couldn't pre-resolve the hostname, so let's hope it will resolve
// further down the pipeline (by a proxy, for example).
- PermuteForAddress(server, special_port_magic, proxy_only, &list_temp);
+ PermuteForAddress(server, special_port_magic, try_ssltcp_first, proxy_only,
+ &list_temp);
} else {
// Generate a set of possibilities for each server address.
// Don't do permute duplicates.
@@ -73,7 +75,8 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname,
}
iplist_seen_.push_back(iplist_random[index]);
server.SetResolvedIP(iplist_random[index]);
- PermuteForAddress(server, special_port_magic, proxy_only, &list_temp);
+ PermuteForAddress(server, special_port_magic, try_ssltcp_first,
+ proxy_only, &list_temp);
}
}
@@ -88,6 +91,7 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname,
void ConnectionSettingsList::PermuteForAddress(
const talk_base::SocketAddress& server,
bool special_port_magic,
+ bool try_ssltcp_first,
bool proxy_only,
std::deque<ConnectionSettings>* list_temp) {
DCHECK(list_temp);
@@ -101,9 +105,13 @@ void ConnectionSettingsList::PermuteForAddress(
ConnectionSettings settings(template_);
settings.set_protocol(cricket::PROTO_SSLTCP);
settings.mutable_server()->SetPort(443);
- // HTTPS proxies usually require port 443, so try it first
+ // HTTPS proxies usually require port 443, so try it first. In addition,
+ // when certain tests like the sync integration tests are run on the
+ // chromium builders, we try the SSLTCP port (443) first because the XMPP
+ // port (5222) is blocked.
if ((template_.proxy().type == talk_base::PROXY_HTTPS) ||
- (template_.proxy().type == talk_base::PROXY_UNKNOWN)) {
+ (template_.proxy().type == talk_base::PROXY_UNKNOWN) ||
+ try_ssltcp_first) {
list_temp->push_front(settings);
} else {
list_temp->push_back(settings);
@@ -120,7 +128,11 @@ void ConnectionSettingsList::PermuteForAddress(
if (special_port_magic) {
settings.set_protocol(cricket::PROTO_SSLTCP);
settings.mutable_server()->SetPort(443);
- list_temp->push_back(settings);
+ if (try_ssltcp_first) {
+ list_temp->push_front(settings);
+ } else {
+ list_temp->push_back(settings);
+ }
}
}
}
diff --git a/jingle/notifier/communicator/connection_settings.h b/jingle/notifier/communicator/connection_settings.h
index 54051a6..c01d8cf 100644
--- a/jingle/notifier/communicator/connection_settings.h
+++ b/jingle/notifier/communicator/connection_settings.h
@@ -58,10 +58,12 @@ class ConnectionSettingsList {
const std::vector<uint32>& iplist,
int16 port,
bool special_port_magic,
+ bool try_ssltcp_first,
bool proxy_only);
private:
void PermuteForAddress(const talk_base::SocketAddress& server,
bool special_port_magic,
+ bool try_ssltcp_first,
bool proxy_only,
std::deque<ConnectionSettings>* list_temp);
diff --git a/jingle/notifier/communicator/login.cc b/jingle/notifier/communicator/login.cc
index 7d3c4c8..041bc67 100644
--- a/jingle/notifier/communicator/login.cc
+++ b/jingle/notifier/communicator/login.cc
@@ -40,6 +40,7 @@ Login::Login(talk_base::TaskParent* parent,
ServerInformation* server_list,
int server_count,
talk_base::FirewallManager* firewall,
+ bool try_ssltcp_first,
bool proxy_only)
: parent_(parent),
use_chrome_async_socket_(use_chrome_async_socket),
@@ -50,6 +51,7 @@ Login::Login(talk_base::TaskParent* parent,
server_list,
server_count,
firewall,
+ try_ssltcp_first,
proxy_only)),
state_(STATE_DISCONNECTED),
single_attempt_(NULL),
diff --git a/jingle/notifier/communicator/login.h b/jingle/notifier/communicator/login.h
index d555a8a..84e89a8 100644
--- a/jingle/notifier/communicator/login.h
+++ b/jingle/notifier/communicator/login.h
@@ -57,6 +57,7 @@ class Login : public net::NetworkChangeNotifier::Observer,
ServerInformation* server_list,
int server_count,
talk_base::FirewallManager* firewall,
+ bool try_ssltcp_first,
bool proxy_only);
virtual ~Login();
diff --git a/jingle/notifier/communicator/login_settings.cc b/jingle/notifier/communicator/login_settings.cc
index 43298eb..0eefa42 100644
--- a/jingle/notifier/communicator/login_settings.cc
+++ b/jingle/notifier/communicator/login_settings.cc
@@ -22,8 +22,10 @@ LoginSettings::LoginSettings(const buzz::XmppClientSettings& user_settings,
ServerInformation* server_list,
int server_count,
talk_base::FirewallManager* firewall,
+ bool try_ssltcp_first,
bool proxy_only)
- : proxy_only_(proxy_only),
+ : try_ssltcp_first_(try_ssltcp_first),
+ proxy_only_(proxy_only),
firewall_(firewall),
lang_(lang),
host_resolver_(host_resolver),
diff --git a/jingle/notifier/communicator/login_settings.h b/jingle/notifier/communicator/login_settings.h
index e2200e9..babfa2e 100644
--- a/jingle/notifier/communicator/login_settings.h
+++ b/jingle/notifier/communicator/login_settings.h
@@ -36,6 +36,7 @@ class LoginSettings {
ServerInformation* server_list,
int server_count,
talk_base::FirewallManager* firewall,
+ bool try_ssltcp_first,
bool proxy_only);
~LoginSettings();
@@ -48,6 +49,10 @@ class LoginSettings {
return firewall_;
}
+ bool try_ssltcp_first() const {
+ return try_ssltcp_first_;
+ }
+
bool proxy_only() const {
return proxy_only_;
}
@@ -84,6 +89,7 @@ class LoginSettings {
void clear_server_override();
private:
+ bool try_ssltcp_first_;
bool proxy_only_;
talk_base::FirewallManager* firewall_;
std::string lang_;
diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc
index bf29d40..810b814 100644
--- a/jingle/notifier/communicator/single_login_attempt.cc
+++ b/jingle/notifier/communicator/single_login_attempt.cc
@@ -81,6 +81,7 @@ SingleLoginAttempt::SingleLoginAttempt(talk_base::TaskParent* parent,
this,
login_settings_->host_resolver(),
&login_settings_->connection_options(),
+ login_settings_->try_ssltcp_first(),
login_settings_->proxy_only(),
login_settings_->server_list(),
login_settings_->server_count()));
diff --git a/jingle/notifier/communicator/xmpp_connection_generator.cc b/jingle/notifier/communicator/xmpp_connection_generator.cc
index 5838840..ad551d2 100644
--- a/jingle/notifier/communicator/xmpp_connection_generator.cc
+++ b/jingle/notifier/communicator/xmpp_connection_generator.cc
@@ -42,6 +42,7 @@ XmppConnectionGenerator::XmppConnectionGenerator(
talk_base::Task* parent,
const scoped_refptr<net::HostResolver>& host_resolver,
const ConnectionOptions* options,
+ bool try_ssltcp_first,
bool proxy_only,
const ServerInformation* server_list,
int server_count)
@@ -55,6 +56,7 @@ XmppConnectionGenerator::XmppConnectionGenerator(
server_list_(new ServerInformation[server_count]),
server_count_(server_count),
server_index_(-1),
+ try_ssltcp_first_(try_ssltcp_first),
proxy_only_(proxy_only),
successfully_resolved_dns_(false),
first_dns_error_(0),
@@ -179,6 +181,7 @@ void XmppConnectionGenerator::HandleServerDNSResolved(int status) {
ip_list,
server_list_[server_index_].server.port(),
server_list_[server_index_].special_port_magic,
+ try_ssltcp_first_,
proxy_only_);
}
diff --git a/jingle/notifier/communicator/xmpp_connection_generator.h b/jingle/notifier/communicator/xmpp_connection_generator.h
index 43b5329..8a31bb6 100644
--- a/jingle/notifier/communicator/xmpp_connection_generator.h
+++ b/jingle/notifier/communicator/xmpp_connection_generator.h
@@ -38,6 +38,7 @@ struct ServerInformation {
class XmppConnectionGenerator : public sigslot::has_slots<> {
public:
// parent is the parent for any tasks needed during this operation.
+ // try_ssltcp_first indicates that SSLTCP is tried before XMPP. Used by tests.
// proxy_only indicates if true connections are only attempted using the
// proxy.
// server_list is the list of connections to attempt in priority order.
@@ -46,6 +47,7 @@ class XmppConnectionGenerator : public sigslot::has_slots<> {
talk_base::Task* parent,
const scoped_refptr<net::HostResolver>& host_resolver,
const ConnectionOptions* options,
+ bool try_ssltcp_first,
bool proxy_only,
const ServerInformation* server_list,
int server_count);
@@ -80,6 +82,7 @@ class XmppConnectionGenerator : public sigslot::has_slots<> {
talk_base::scoped_array<ServerInformation> server_list_;
int server_count_;
int server_index_; // The server that is current being used.
+ bool try_ssltcp_first_; // Used when sync tests are run on chromium builders.
bool proxy_only_;
bool successfully_resolved_dns_;
int first_dns_error_;
diff --git a/jingle/notifier/listener/mediator_thread_impl.cc b/jingle/notifier/listener/mediator_thread_impl.cc
index bdbbf5b..c013aa6 100644
--- a/jingle/notifier/listener/mediator_thread_impl.cc
+++ b/jingle/notifier/listener/mediator_thread_impl.cc
@@ -26,10 +26,12 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(notifier::MediatorThreadImpl);
namespace notifier {
-MediatorThreadImpl::MediatorThreadImpl(bool use_chrome_async_socket)
+MediatorThreadImpl::MediatorThreadImpl(bool use_chrome_async_socket,
+ bool try_ssltcp_first)
: delegate_(NULL),
parent_message_loop_(MessageLoop::current()),
use_chrome_async_socket_(use_chrome_async_socket),
+ try_ssltcp_first_(try_ssltcp_first),
worker_thread_("MediatorThread worker thread") {
DCHECK(parent_message_loop_);
}
@@ -204,6 +206,7 @@ void MediatorThreadImpl::DoLogin(
server_list_count,
// talk_base::FirewallManager* is NULL.
NULL,
+ try_ssltcp_first_,
// Both the proxy and a non-proxy route
// will be attempted.
false));
diff --git a/jingle/notifier/listener/mediator_thread_impl.h b/jingle/notifier/listener/mediator_thread_impl.h
index 519b2e8..9654d52 100644
--- a/jingle/notifier/listener/mediator_thread_impl.h
+++ b/jingle/notifier/listener/mediator_thread_impl.h
@@ -59,7 +59,7 @@ class MediatorThreadImpl
: public MediatorThread,
public sigslot::has_slots<> {
public:
- explicit MediatorThreadImpl(bool use_chrome_async_socket);
+ MediatorThreadImpl(bool use_chrome_async_socket, bool try_ssltcp_first);
virtual ~MediatorThreadImpl();
virtual void SetDelegate(Delegate* delegate);
@@ -125,6 +125,8 @@ class MediatorThreadImpl
bool success);
const bool use_chrome_async_socket_;
+ const bool try_ssltcp_first_;
+
base::Thread worker_thread_;
scoped_refptr<net::HostResolver> host_resolver_;
diff --git a/jingle/notifier/listener/talk_mediator_unittest.cc b/jingle/notifier/listener/talk_mediator_unittest.cc
index fc08a63..bd4dbdf 100644
--- a/jingle/notifier/listener/talk_mediator_unittest.cc
+++ b/jingle/notifier/listener/talk_mediator_unittest.cc
@@ -40,11 +40,12 @@ class TalkMediatorImplTest : public testing::Test {
TalkMediatorImpl* NewTalkMediator() {
const bool kUseChromeAsyncSocket = false;
+ const bool kTrySslTcpFirst = false;
const bool kInitializeSsl = true;
const bool kConnectImmediately = false;
const bool kInvalidateXmppAuthToken = false;
return new TalkMediatorImpl(
- new MediatorThreadImpl(kUseChromeAsyncSocket),
+ new MediatorThreadImpl(kUseChromeAsyncSocket, kTrySslTcpFirst),
kInitializeSsl, kConnectImmediately, kInvalidateXmppAuthToken);
}