OLD | NEW |
---|---|
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 | 327 |
326 bool LiveSyncTest::SetUpLocalPythonTestServer() { | 328 bool LiveSyncTest::SetUpLocalPythonTestServer() { |
327 EXPECT_TRUE(sync_server_.Start()) | 329 EXPECT_TRUE(sync_server_.Start()) |
328 << "Could not launch local python test server."; | 330 << "Could not launch local python test server."; |
329 | 331 |
330 CommandLine* cl = CommandLine::ForCurrentProcess(); | 332 CommandLine* cl = CommandLine::ForCurrentProcess(); |
331 std::string sync_service_url = sync_server_.GetURL("chromiumsync").spec(); | 333 std::string sync_service_url = sync_server_.GetURL("chromiumsync").spec(); |
332 cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url); | 334 cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url); |
333 VLOG(1) << "Started local python test server at " << sync_service_url; | 335 VLOG(1) << "Started local python test server at " << sync_service_url; |
334 | 336 |
335 // TODO(akalin): Set the kSyncNotificationHost switch here once a local python | 337 int xmpp_port = 0; |
336 // notification server is implemented. | 338 if (!sync_server_.server_data().GetInteger("xmpp_port", &xmpp_port)) { |
339 LOG(ERROR) << "Could not find valid xmpp_port value"; | |
340 return false; | |
341 } | |
342 if ((xmpp_port <= 0) || (xmpp_port >= kuint16max)) { | |
cbentzel
2010/11/19 15:46:25
This is in two locations now - should you have an
| |
343 LOG(ERROR) << "Invalid xmpp port: " << xmpp_port; | |
344 return false; | |
345 } | |
346 | |
347 net::HostPortPair xmpp_host_port_pair(sync_server_.host_port_pair()); | |
348 xmpp_host_port_pair.set_port(xmpp_port); | |
349 | |
350 if (!cl->HasSwitch(switches::kSyncNotificationHost)) { | |
351 cl->AppendSwitchASCII(switches::kSyncNotificationHost, | |
352 xmpp_host_port_pair.ToString()); | |
353 // The local XMPP server only supports insecure connections. | |
354 cl->AppendSwitch(switches::kSyncAllowInsecureXmppConnection); | |
355 } | |
337 | 356 |
338 return true; | 357 return true; |
339 } | 358 } |
340 | 359 |
341 bool LiveSyncTest::SetUpLocalTestServer() { | 360 bool LiveSyncTest::SetUpLocalTestServer() { |
342 CommandLine* cl = CommandLine::ForCurrentProcess(); | 361 CommandLine* cl = CommandLine::ForCurrentProcess(); |
343 CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative( | 362 CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative( |
344 switches::kSyncServerCommandLine); | 363 switches::kSyncServerCommandLine); |
345 #if defined(OS_WIN) | 364 #if defined(OS_WIN) |
346 CommandLine server_cmdline = CommandLine::FromString(server_cmdline_string); | 365 CommandLine server_cmdline = CommandLine::FromString(server_cmdline_string); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 const net::ProxyConfig& proxy_config) { | 449 const net::ProxyConfig& proxy_config) { |
431 base::WaitableEvent done(false, false); | 450 base::WaitableEvent done(false, false); |
432 BrowserThread::PostTask( | 451 BrowserThread::PostTask( |
433 BrowserThread::IO, | 452 BrowserThread::IO, |
434 FROM_HERE, | 453 FROM_HERE, |
435 new SetProxyConfigTask(&done, | 454 new SetProxyConfigTask(&done, |
436 context_getter, | 455 context_getter, |
437 proxy_config)); | 456 proxy_config)); |
438 done.Wait(); | 457 done.Wait(); |
439 } | 458 } |
OLD | NEW |