| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/sync/protocol/sync.pb.h" | 28 #include "chrome/browser/sync/protocol/sync.pb.h" |
| 29 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 29 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/test/base/testing_browser_process.h" | 34 #include "chrome/test/base/testing_browser_process.h" |
| 35 #include "chrome/test/base/ui_test_utils.h" | 35 #include "chrome/test/base/ui_test_utils.h" |
| 36 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
| 37 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
| 38 #include "content/common/net/url_fetcher.h" | 38 #include "content/public/common/url_fetcher.h" |
| 39 #include "content/public/common/url_fetcher_delegate.h" | 39 #include "content/public/common/url_fetcher_delegate.h" |
| 40 #include "content/test/test_url_fetcher_factory.h" | 40 #include "content/test/test_url_fetcher_factory.h" |
| 41 #include "googleurl/src/gurl.h" | 41 #include "googleurl/src/gurl.h" |
| 42 #include "net/base/escape.h" | 42 #include "net/base/escape.h" |
| 43 #include "net/base/network_change_notifier.h" | 43 #include "net/base/network_change_notifier.h" |
| 44 #include "net/proxy/proxy_config.h" | 44 #include "net/proxy/proxy_config.h" |
| 45 #include "net/proxy/proxy_config_service_fixed.h" | 45 #include "net/proxy/proxy_config_service_fixed.h" |
| 46 #include "net/proxy/proxy_service.h" | 46 #include "net/proxy/proxy_service.h" |
| 47 #include "net/test/test_server.h" | 47 #include "net/test/test_server.h" |
| 48 #include "net/url_request/url_request_context.h" | 48 #include "net/url_request/url_request_context.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 base::PlatformThread::Sleep(time_ms / intervals); | 501 base::PlatformThread::Sleep(time_ms / intervals); |
| 502 } | 502 } |
| 503 return false; | 503 return false; |
| 504 } | 504 } |
| 505 | 505 |
| 506 bool SyncTest::IsTestServerRunning() { | 506 bool SyncTest::IsTestServerRunning() { |
| 507 CommandLine* cl = CommandLine::ForCurrentProcess(); | 507 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 508 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); | 508 std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); |
| 509 GURL sync_url_status(sync_url.append("/healthz")); | 509 GURL sync_url_status(sync_url.append("/healthz")); |
| 510 SyncServerStatusChecker delegate; | 510 SyncServerStatusChecker delegate; |
| 511 URLFetcher fetcher(sync_url_status, URLFetcher::GET, &delegate); | 511 scoped_ptr<content::URLFetcher> fetcher(content::URLFetcher::Create( |
| 512 fetcher.SetRequestContext(Profile::Deprecated::GetDefaultRequestContext()); | 512 sync_url_status, content::URLFetcher::GET, &delegate)); |
| 513 fetcher.Start(); | 513 fetcher->SetRequestContext(Profile::Deprecated::GetDefaultRequestContext()); |
| 514 fetcher->Start(); |
| 514 ui_test_utils::RunMessageLoop(); | 515 ui_test_utils::RunMessageLoop(); |
| 515 return delegate.running(); | 516 return delegate.running(); |
| 516 } | 517 } |
| 517 | 518 |
| 518 void SyncTest::EnableNetwork(Profile* profile) { | 519 void SyncTest::EnableNetwork(Profile* profile) { |
| 519 SetProxyConfig(profile->GetRequestContext(), | 520 SetProxyConfig(profile->GetRequestContext(), |
| 520 net::ProxyConfig::CreateDirect()); | 521 net::ProxyConfig::CreateDirect()); |
| 521 // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. | 522 // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. |
| 522 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 523 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
| 523 } | 524 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 const net::ProxyConfig& proxy_config) { | 705 const net::ProxyConfig& proxy_config) { |
| 705 base::WaitableEvent done(false, false); | 706 base::WaitableEvent done(false, false); |
| 706 BrowserThread::PostTask( | 707 BrowserThread::PostTask( |
| 707 BrowserThread::IO, | 708 BrowserThread::IO, |
| 708 FROM_HERE, | 709 FROM_HERE, |
| 709 new SetProxyConfigTask(&done, | 710 new SetProxyConfigTask(&done, |
| 710 context_getter, | 711 context_getter, |
| 711 proxy_config)); | 712 proxy_config)); |
| 712 done.Wait(); | 713 done.Wait(); |
| 713 } | 714 } |
| OLD | NEW |