| 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 19 matching lines...) Expand all Loading... |
| 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/url_fetcher.h" | 39 #include "content/public/common/url_fetcher.h" |
| 40 #include "content/public/common/url_fetcher_delegate.h" | |
| 41 #include "content/test/test_browser_thread.h" | 40 #include "content/test/test_browser_thread.h" |
| 42 #include "content/test/test_url_fetcher_factory.h" | 41 #include "content/test/test_url_fetcher_factory.h" |
| 43 #include "googleurl/src/gurl.h" | 42 #include "googleurl/src/gurl.h" |
| 44 #include "net/base/escape.h" | 43 #include "net/base/escape.h" |
| 45 #include "net/base/load_flags.h" | 44 #include "net/base/load_flags.h" |
| 46 #include "net/base/network_change_notifier.h" | 45 #include "net/base/network_change_notifier.h" |
| 47 #include "net/proxy/proxy_config.h" | 46 #include "net/proxy/proxy_config.h" |
| 48 #include "net/proxy/proxy_config_service_fixed.h" | 47 #include "net/proxy/proxy_config_service_fixed.h" |
| 49 #include "net/proxy/proxy_service.h" | 48 #include "net/proxy/proxy_service.h" |
| 50 #include "net/test/test_server.h" | 49 #include "net/test/test_server.h" |
| 50 #include "net/url_request/url_fetcher_delegate.h" |
| 51 #include "net/url_request/url_request_context.h" | 51 #include "net/url_request/url_request_context.h" |
| 52 #include "net/url_request/url_request_context_getter.h" | 52 #include "net/url_request/url_request_context_getter.h" |
| 53 #include "net/url_request/url_request_status.h" | 53 #include "net/url_request/url_request_status.h" |
| 54 #include "sync/notifier/p2p_notifier.h" | 54 #include "sync/notifier/p2p_notifier.h" |
| 55 #include "sync/protocol/sync.pb.h" | 55 #include "sync/protocol/sync.pb.h" |
| 56 | 56 |
| 57 using content::BrowserThread; | 57 using content::BrowserThread; |
| 58 | 58 |
| 59 namespace switches { | 59 namespace switches { |
| 60 const char kPasswordFileForTest[] = "password-file-for-test"; | 60 const char kPasswordFileForTest[] = "password-file-for-test"; |
| 61 const char kSyncUserForTest[] = "sync-user-for-test"; | 61 const char kSyncUserForTest[] = "sync-user-for-test"; |
| 62 const char kSyncPasswordForTest[] = "sync-password-for-test"; | 62 const char kSyncPasswordForTest[] = "sync-password-for-test"; |
| 63 const char kSyncServerCommandLine[] = "sync-server-command-line"; | 63 const char kSyncServerCommandLine[] = "sync-server-command-line"; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Helper class that checks whether a sync test server is running or not. | 66 // Helper class that checks whether a sync test server is running or not. |
| 67 class SyncServerStatusChecker : public content::URLFetcherDelegate { | 67 class SyncServerStatusChecker : public net::URLFetcherDelegate { |
| 68 public: | 68 public: |
| 69 SyncServerStatusChecker() : running_(false) {} | 69 SyncServerStatusChecker() : running_(false) {} |
| 70 | 70 |
| 71 virtual void OnURLFetchComplete(const net::URLFetcher* source) { | 71 virtual void OnURLFetchComplete(const net::URLFetcher* source) { |
| 72 std::string data; | 72 std::string data; |
| 73 source->GetResponseAsString(&data); | 73 source->GetResponseAsString(&data); |
| 74 running_ = | 74 running_ = |
| 75 (source->GetStatus().status() == net::URLRequestStatus::SUCCESS && | 75 (source->GetStatus().status() == net::URLRequestStatus::SUCCESS && |
| 76 source->GetResponseCode() == 200 && data.find("ok") == 0); | 76 source->GetResponseCode() == 200 && data.find("ok") == 0); |
| 77 MessageLoop::current()->Quit(); | 77 MessageLoop::current()->Quit(); |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 787 |
| 788 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 788 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
| 789 const net::ProxyConfig& proxy_config) { | 789 const net::ProxyConfig& proxy_config) { |
| 790 base::WaitableEvent done(false, false); | 790 base::WaitableEvent done(false, false); |
| 791 BrowserThread::PostTask( | 791 BrowserThread::PostTask( |
| 792 BrowserThread::IO, FROM_HERE, | 792 BrowserThread::IO, FROM_HERE, |
| 793 base::Bind(&SetProxyConfigCallback, &done, | 793 base::Bind(&SetProxyConfigCallback, &done, |
| 794 make_scoped_refptr(context_getter), proxy_config)); | 794 make_scoped_refptr(context_getter), proxy_config)); |
| 795 done.Wait(); | 795 done.Wait(); |
| 796 } | 796 } |
| OLD | NEW |