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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/sync/protocol/sync.pb.h" | 29 #include "chrome/browser/sync/protocol/sync.pb.h" |
30 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 30 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/browser_list.h" | 32 #include "chrome/browser/ui/browser_list.h" |
33 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/net/gaia/gaia_urls.h" | 35 #include "chrome/common/net/gaia/gaia_urls.h" |
36 #include "chrome/test/base/testing_browser_process.h" | 36 #include "chrome/test/base/testing_browser_process.h" |
37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/common/content_url_request_user_data.h" |
39 #include "content/public/common/url_fetcher.h" | 40 #include "content/public/common/url_fetcher.h" |
40 #include "content/public/common/url_fetcher_delegate.h" | 41 #include "content/public/common/url_fetcher_delegate.h" |
41 #include "content/test/test_browser_thread.h" | 42 #include "content/test/test_browser_thread.h" |
42 #include "content/test/test_url_fetcher_factory.h" | 43 #include "content/test/test_url_fetcher_factory.h" |
43 #include "googleurl/src/gurl.h" | 44 #include "googleurl/src/gurl.h" |
44 #include "net/base/escape.h" | 45 #include "net/base/escape.h" |
45 #include "net/base/network_change_notifier.h" | 46 #include "net/base/network_change_notifier.h" |
46 #include "net/proxy/proxy_config.h" | 47 #include "net/proxy/proxy_config.h" |
47 #include "net/proxy/proxy_config_service_fixed.h" | 48 #include "net/proxy/proxy_config_service_fixed.h" |
48 #include "net/proxy/proxy_service.h" | 49 #include "net/proxy/proxy_service.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
552 sync_url_status, content::URLFetcher::GET, &delegate)); | 553 sync_url_status, content::URLFetcher::GET, &delegate)); |
553 fetcher->SetRequestContext(g_browser_process->system_request_context()); | 554 fetcher->SetRequestContext(g_browser_process->system_request_context()); |
| 555 fetcher->SetContentURLRequestUserData( |
| 556 new content::ContentURLRequestUserData()); |
554 fetcher->Start(); | 557 fetcher->Start(); |
555 ui_test_utils::RunMessageLoop(); | 558 ui_test_utils::RunMessageLoop(); |
556 return delegate.running(); | 559 return delegate.running(); |
557 } | 560 } |
558 | 561 |
559 void SyncTest::EnableNetwork(Profile* profile) { | 562 void SyncTest::EnableNetwork(Profile* profile) { |
560 SetProxyConfig(profile->GetRequestContext(), | 563 SetProxyConfig(profile->GetRequestContext(), |
561 net::ProxyConfig::CreateDirect()); | 564 net::ProxyConfig::CreateDirect()); |
562 // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. | 565 // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. |
563 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 566 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 761 |
759 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 762 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
760 const net::ProxyConfig& proxy_config) { | 763 const net::ProxyConfig& proxy_config) { |
761 base::WaitableEvent done(false, false); | 764 base::WaitableEvent done(false, false); |
762 BrowserThread::PostTask( | 765 BrowserThread::PostTask( |
763 BrowserThread::IO, FROM_HERE, | 766 BrowserThread::IO, FROM_HERE, |
764 base::Bind(&SetProxyConfigCallback, &done, | 767 base::Bind(&SetProxyConfigCallback, &done, |
765 make_scoped_refptr(context_getter), proxy_config)); | 768 make_scoped_refptr(context_getter), proxy_config)); |
766 done.Wait(); | 769 done.Wait(); |
767 } | 770 } |
OLD | NEW |