| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/sync/test/integration/sync_test.h" | 5 #include "chrome/browser/sync/test/integration/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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 base::CloseProcessHandle(test_server_handle_); | 531 base::CloseProcessHandle(test_server_handle_); |
| 532 test_server_handle_ = base::kNullProcessHandle; | 532 test_server_handle_ = base::kNullProcessHandle; |
| 533 } | 533 } |
| 534 return true; | 534 return true; |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool SyncTest::WaitForTestServerToStart(int time_ms, int intervals) { | 537 bool SyncTest::WaitForTestServerToStart(int time_ms, int intervals) { |
| 538 for (int i = 0; i < intervals; ++i) { | 538 for (int i = 0; i < intervals; ++i) { |
| 539 if (IsTestServerRunning()) | 539 if (IsTestServerRunning()) |
| 540 return true; | 540 return true; |
| 541 base::PlatformThread::Sleep(time_ms / intervals); | 541 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( |
| 542 time_ms / intervals)); |
| 542 } | 543 } |
| 543 return false; | 544 return false; |
| 544 } | 545 } |
| 545 | 546 |
| 546 bool SyncTest::IsTestServerRunning() { | 547 bool SyncTest::IsTestServerRunning() { |
| 547 CommandLine* cl = CommandLine::ForCurrentProcess(); | 548 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 548 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); | 549 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); |
| 549 GURL sync_url_status(sync_url.append("/healthz")); | 550 GURL sync_url_status(sync_url.append("/healthz")); |
| 550 SyncServerStatusChecker delegate; | 551 SyncServerStatusChecker delegate; |
| 551 scoped_ptr<content::URLFetcher> fetcher(content::URLFetcher::Create( | 552 scoped_ptr<content::URLFetcher> fetcher(content::URLFetcher::Create( |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 759 |
| 759 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 760 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
| 760 const net::ProxyConfig& proxy_config) { | 761 const net::ProxyConfig& proxy_config) { |
| 761 base::WaitableEvent done(false, false); | 762 base::WaitableEvent done(false, false); |
| 762 BrowserThread::PostTask( | 763 BrowserThread::PostTask( |
| 763 BrowserThread::IO, FROM_HERE, | 764 BrowserThread::IO, FROM_HERE, |
| 764 base::Bind(&SetProxyConfigCallback, &done, | 765 base::Bind(&SetProxyConfigCallback, &done, |
| 765 make_scoped_refptr(context_getter), proxy_config)); | 766 make_scoped_refptr(context_getter), proxy_config)); |
| 766 done.Wait(); | 767 done.Wait(); |
| 767 } | 768 } |
| OLD | NEW |