| 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/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/platform_thread.h" | |
| 15 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 16 #include "base/task.h" | 15 #include "base/task.h" |
| 17 #include "base/test/test_timeouts.h" | 16 #include "base/test/test_timeouts.h" |
| 17 #include "base/threading/platform_thread.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "base/waitable_event.h" | 19 #include "base/waitable_event.h" |
| 20 #include "chrome/browser/browser_thread.h" | 20 #include "chrome/browser/browser_thread.h" |
| 21 #include "chrome/browser/password_manager/encryptor.h" | 21 #include "chrome/browser/password_manager/encryptor.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/net/url_fetcher.h" | 26 #include "chrome/common/net/url_fetcher.h" |
| 27 #include "chrome/common/net/url_request_context_getter.h" | 27 #include "chrome/common/net/url_request_context_getter.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 base::CloseProcessHandle(test_server_handle_); | 391 base::CloseProcessHandle(test_server_handle_); |
| 392 test_server_handle_ = base::kNullProcessHandle; | 392 test_server_handle_ = base::kNullProcessHandle; |
| 393 } | 393 } |
| 394 return true; | 394 return true; |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool LiveSyncTest::WaitForTestServerToStart(int time_ms, int intervals) { | 397 bool LiveSyncTest::WaitForTestServerToStart(int time_ms, int intervals) { |
| 398 for (int i = 0; i < intervals; ++i) { | 398 for (int i = 0; i < intervals; ++i) { |
| 399 if (IsTestServerRunning()) | 399 if (IsTestServerRunning()) |
| 400 return true; | 400 return true; |
| 401 PlatformThread::Sleep(time_ms / intervals); | 401 base::PlatformThread::Sleep(time_ms / intervals); |
| 402 } | 402 } |
| 403 return false; | 403 return false; |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool LiveSyncTest::IsTestServerRunning() { | 406 bool LiveSyncTest::IsTestServerRunning() { |
| 407 CommandLine* cl = CommandLine::ForCurrentProcess(); | 407 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 408 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); | 408 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); |
| 409 GURL sync_url_status(sync_url.append("/healthz")); | 409 GURL sync_url_status(sync_url.append("/healthz")); |
| 410 SyncServerStatusChecker delegate; | 410 SyncServerStatusChecker delegate; |
| 411 URLFetcher fetcher(sync_url_status, URLFetcher::GET, &delegate); | 411 URLFetcher fetcher(sync_url_status, URLFetcher::GET, &delegate); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 440 const net::ProxyConfig& proxy_config) { | 440 const net::ProxyConfig& proxy_config) { |
| 441 base::WaitableEvent done(false, false); | 441 base::WaitableEvent done(false, false); |
| 442 BrowserThread::PostTask( | 442 BrowserThread::PostTask( |
| 443 BrowserThread::IO, | 443 BrowserThread::IO, |
| 444 FROM_HERE, | 444 FROM_HERE, |
| 445 new SetProxyConfigTask(&done, | 445 new SetProxyConfigTask(&done, |
| 446 context_getter, | 446 context_getter, |
| 447 proxy_config)); | 447 proxy_config)); |
| 448 done.Wait(); | 448 done.Wait(); |
| 449 } | 449 } |
| OLD | NEW |