| 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 18 matching lines...) Expand all Loading... |
| 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/common/net/url_fetcher.h" |
| 39 #include "content/public/common/url_fetcher_delegate.h" |
| 39 #include "content/test/test_url_fetcher_factory.h" | 40 #include "content/test/test_url_fetcher_factory.h" |
| 40 #include "googleurl/src/gurl.h" | 41 #include "googleurl/src/gurl.h" |
| 41 #include "net/base/escape.h" | 42 #include "net/base/escape.h" |
| 42 #include "net/base/network_change_notifier.h" | 43 #include "net/base/network_change_notifier.h" |
| 43 #include "net/proxy/proxy_config.h" | 44 #include "net/proxy/proxy_config.h" |
| 44 #include "net/proxy/proxy_config_service_fixed.h" | 45 #include "net/proxy/proxy_config_service_fixed.h" |
| 45 #include "net/proxy/proxy_service.h" | 46 #include "net/proxy/proxy_service.h" |
| 46 #include "net/test/test_server.h" | 47 #include "net/test/test_server.h" |
| 47 #include "net/url_request/url_request_context.h" | 48 #include "net/url_request/url_request_context.h" |
| 48 #include "net/url_request/url_request_context_getter.h" | 49 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 // The URLs for different calls in the Google Accounts programmatic login API. | 60 // The URLs for different calls in the Google Accounts programmatic login API. |
| 60 const char kClientLoginUrl[] = "https://www.google.com/accounts/ClientLogin"; | 61 const char kClientLoginUrl[] = "https://www.google.com/accounts/ClientLogin"; |
| 61 const char kGetUserInfoUrl[] = "https://www.google.com/accounts/GetUserInfo"; | 62 const char kGetUserInfoUrl[] = "https://www.google.com/accounts/GetUserInfo"; |
| 62 const char kIssueAuthTokenUrl[] = | 63 const char kIssueAuthTokenUrl[] = |
| 63 "https://www.google.com/accounts/IssueAuthToken"; | 64 "https://www.google.com/accounts/IssueAuthToken"; |
| 64 const char kSearchDomainCheckUrl[] = | 65 const char kSearchDomainCheckUrl[] = |
| 65 "https://www.google.com/searchdomaincheck?format=domain&type=chrome"; | 66 "https://www.google.com/searchdomaincheck?format=domain&type=chrome"; |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Helper class that checks whether a sync test server is running or not. | 69 // Helper class that checks whether a sync test server is running or not. |
| 69 class SyncServerStatusChecker : public URLFetcher::Delegate { | 70 class SyncServerStatusChecker : public content::URLFetcherDelegate { |
| 70 public: | 71 public: |
| 71 SyncServerStatusChecker() : running_(false) {} | 72 SyncServerStatusChecker() : running_(false) {} |
| 72 | 73 |
| 73 virtual void OnURLFetchComplete(const URLFetcher* source, | 74 virtual void OnURLFetchComplete(const URLFetcher* source) { |
| 74 const GURL& url, | 75 std::string data; |
| 75 const net::URLRequestStatus& status, | 76 source->GetResponseAsString(&data); |
| 76 int response_code, | 77 running_ = (source->status().status() == net::URLRequestStatus::SUCCESS && |
| 77 const net::ResponseCookies& cookies, | 78 source->response_code() == 200 && data.find("ok") == 0); |
| 78 const std::string& data) { | |
| 79 running_ = (status.status() == net::URLRequestStatus::SUCCESS && | |
| 80 response_code == 200 && data.find("ok") == 0); | |
| 81 MessageLoop::current()->Quit(); | 79 MessageLoop::current()->Quit(); |
| 82 } | 80 } |
| 83 | 81 |
| 84 bool running() const { return running_; } | 82 bool running() const { return running_; } |
| 85 | 83 |
| 86 private: | 84 private: |
| 87 bool running_; | 85 bool running_; |
| 88 }; | 86 }; |
| 89 | 87 |
| 90 class SetProxyConfigTask : public Task { | 88 class SetProxyConfigTask : public Task { |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 const net::ProxyConfig& proxy_config) { | 703 const net::ProxyConfig& proxy_config) { |
| 706 base::WaitableEvent done(false, false); | 704 base::WaitableEvent done(false, false); |
| 707 BrowserThread::PostTask( | 705 BrowserThread::PostTask( |
| 708 BrowserThread::IO, | 706 BrowserThread::IO, |
| 709 FROM_HERE, | 707 FROM_HERE, |
| 710 new SetProxyConfigTask(&done, | 708 new SetProxyConfigTask(&done, |
| 711 context_getter, | 709 context_getter, |
| 712 proxy_config)); | 710 proxy_config)); |
| 713 done.Wait(); | 711 done.Wait(); |
| 714 } | 712 } |
| OLD | NEW |