Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome/test/live_sync/live_sync_test.cc

Issue 5239001: [Sync] Make sync integration tests use local xmpp servers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded switch Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | jingle/notifier/communicator/connection_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/live_sync/live_sync_test.h" 5 #include "chrome/test/live_sync/live_sync_test.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop.h" 12 #include "base/message_loop.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/platform_thread.h" 14 #include "base/platform_thread.h"
14 #include "base/string_util.h" 15 #include "base/string_util.h"
15 #include "base/task.h" 16 #include "base/task.h"
16 #include "base/test/test_timeouts.h" 17 #include "base/test/test_timeouts.h"
18 #include "base/values.h"
17 #include "base/waitable_event.h" 19 #include "base/waitable_event.h"
18 #include "chrome/browser/browser_thread.h" 20 #include "chrome/browser/browser_thread.h"
19 #include "chrome/browser/password_manager/encryptor.h" 21 #include "chrome/browser/password_manager/encryptor.h"
20 #include "chrome/browser/profile.h" 22 #include "chrome/browser/profile.h"
21 #include "chrome/browser/profile_manager.h" 23 #include "chrome/browser/profile_manager.h"
22 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/net/url_fetcher.h" 26 #include "chrome/common/net/url_fetcher.h"
25 #include "chrome/common/net/url_request_context_getter.h" 27 #include "chrome/common/net/url_request_context_getter.h"
26 #include "chrome/test/testing_browser_process.h" 28 #include "chrome/test/testing_browser_process.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest); 134 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest);
133 } 135 }
134 if (username_.empty() || password_.empty()) 136 if (username_.empty() || password_.empty())
135 LOG(FATAL) << "Cannot run sync tests without GAIA credentials."; 137 LOG(FATAL) << "Cannot run sync tests without GAIA credentials.";
136 138
137 // TODO(rsimha): Until we implement a fake Tango server against which tests 139 // TODO(rsimha): Until we implement a fake Tango server against which tests
138 // can run, we need to set the --sync-notification-method to "p2p". 140 // can run, we need to set the --sync-notification-method to "p2p".
139 if (!cl->HasSwitch(switches::kSyncNotificationMethod)) 141 if (!cl->HasSwitch(switches::kSyncNotificationMethod))
140 cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p"); 142 cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p");
141 143
142 // TODO(akalin): Delete this block of code once a local python notification
143 // server is implemented.
144 // The chrome sync builders are behind a firewall that blocks port 5222, the
145 // default port for XMPP notifications. This causes the tests to spend up to a
146 // minute waiting for a connection on port 5222 before they fail over to port
147 // 443, the default SSL/TCP port. This switch causes the tests to use port 443
148 // by default, without having to try port 5222.
149 if (!cl->HasSwitch(switches::kSyncTrySsltcpFirstForXmpp)) {
150 cl->AppendSwitch(switches::kSyncTrySsltcpFirstForXmpp);
151 }
152
153 // TODO(sync): Remove this once sessions sync is enabled by default. 144 // TODO(sync): Remove this once sessions sync is enabled by default.
154 if (!cl->HasSwitch(switches::kEnableSyncSessions)) { 145 if (!cl->HasSwitch(switches::kEnableSyncSessions)) {
155 cl->AppendSwitch(switches::kEnableSyncSessions); 146 cl->AppendSwitch(switches::kEnableSyncSessions);
156 } 147 }
157 148
158 // TODO(sync): Remove this once passwords sync is enabled by default. 149 // TODO(sync): Remove this once passwords sync is enabled by default.
159 if (!cl->HasSwitch(switches::kEnableSyncPasswords)) { 150 if (!cl->HasSwitch(switches::kEnableSyncPasswords)) {
160 cl->AppendSwitch(switches::kEnableSyncPasswords); 151 cl->AppendSwitch(switches::kEnableSyncPasswords);
161 } 152 }
162 153
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 316
326 bool LiveSyncTest::SetUpLocalPythonTestServer() { 317 bool LiveSyncTest::SetUpLocalPythonTestServer() {
327 EXPECT_TRUE(sync_server_.Start()) 318 EXPECT_TRUE(sync_server_.Start())
328 << "Could not launch local python test server."; 319 << "Could not launch local python test server.";
329 320
330 CommandLine* cl = CommandLine::ForCurrentProcess(); 321 CommandLine* cl = CommandLine::ForCurrentProcess();
331 std::string sync_service_url = sync_server_.GetURL("chromiumsync").spec(); 322 std::string sync_service_url = sync_server_.GetURL("chromiumsync").spec();
332 cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url); 323 cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url);
333 VLOG(1) << "Started local python test server at " << sync_service_url; 324 VLOG(1) << "Started local python test server at " << sync_service_url;
334 325
335 // TODO(akalin): Set the kSyncNotificationHost switch here once a local python 326 int xmpp_port = 0;
336 // notification server is implemented. 327 if (!sync_server_.server_data().GetInteger("xmpp_port", &xmpp_port)) {
328 LOG(ERROR) << "Could not find valid xmpp_port value";
329 return false;
330 }
331 if ((xmpp_port <= 0) || (xmpp_port > kuint16max)) {
332 LOG(ERROR) << "Invalid xmpp port: " << xmpp_port;
333 return false;
334 }
335
336 net::HostPortPair xmpp_host_port_pair(sync_server_.host_port_pair());
337 xmpp_host_port_pair.set_port(xmpp_port);
338
339 if (!cl->HasSwitch(switches::kSyncNotificationHost)) {
340 cl->AppendSwitchASCII(switches::kSyncNotificationHost,
341 xmpp_host_port_pair.ToString());
342 // The local XMPP server only supports insecure connections.
343 cl->AppendSwitch(switches::kSyncAllowInsecureXmppConnection);
344 }
337 345
338 return true; 346 return true;
339 } 347 }
340 348
341 bool LiveSyncTest::SetUpLocalTestServer() { 349 bool LiveSyncTest::SetUpLocalTestServer() {
342 CommandLine* cl = CommandLine::ForCurrentProcess(); 350 CommandLine* cl = CommandLine::ForCurrentProcess();
343 CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative( 351 CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative(
344 switches::kSyncServerCommandLine); 352 switches::kSyncServerCommandLine);
345 #if defined(OS_WIN) 353 #if defined(OS_WIN)
346 CommandLine server_cmdline = CommandLine::FromString(server_cmdline_string); 354 CommandLine server_cmdline = CommandLine::FromString(server_cmdline_string);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 const net::ProxyConfig& proxy_config) { 438 const net::ProxyConfig& proxy_config) {
431 base::WaitableEvent done(false, false); 439 base::WaitableEvent done(false, false);
432 BrowserThread::PostTask( 440 BrowserThread::PostTask(
433 BrowserThread::IO, 441 BrowserThread::IO,
434 FROM_HERE, 442 FROM_HERE,
435 new SetProxyConfigTask(&done, 443 new SetProxyConfigTask(&done,
436 context_getter, 444 context_getter,
437 proxy_config)); 445 proxy_config));
438 done.Wait(); 446 done.Wait();
439 } 447 }
OLDNEW
« no previous file with comments | « no previous file | jingle/notifier/communicator/connection_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698