| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 419       << "\" must contain exactly two lines of text."; | 419       << "\" must contain exactly two lines of text."; | 
| 420   username_ = tokens[0]; | 420   username_ = tokens[0]; | 
| 421   password_ = tokens[1]; | 421   password_ = tokens[1]; | 
| 422 } | 422 } | 
| 423 | 423 | 
| 424 void SyncTest::SetupMockGaiaResponses() { | 424 void SyncTest::SetupMockGaiaResponses() { | 
| 425   username_ = "user@gmail.com"; | 425   username_ = "user@gmail.com"; | 
| 426   password_ = "password"; | 426   password_ = "password"; | 
| 427   factory_.reset(new net::URLFetcherImplFactory()); | 427   factory_.reset(new net::URLFetcherImplFactory()); | 
| 428   fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); | 428   fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); | 
| 429   fake_factory_->SetFakeResponseForURL( | 429   fake_factory_->SetFakeResponse( | 
| 430       GaiaUrls::GetInstance()->client_login_url(), | 430       GaiaUrls::GetInstance()->client_login_url(), | 
| 431       "SID=sid\nLSID=lsid", | 431       "SID=sid\nLSID=lsid", | 
| 432       true); | 432       true); | 
| 433   fake_factory_->SetFakeResponseForURL( | 433   fake_factory_->SetFakeResponse( | 
| 434       GaiaUrls::GetInstance()->get_user_info_url(), | 434       GaiaUrls::GetInstance()->get_user_info_url(), | 
| 435       "email=user@gmail.com\ndisplayEmail=user@gmail.com", | 435       "email=user@gmail.com\ndisplayEmail=user@gmail.com", | 
| 436       true); | 436       true); | 
| 437   fake_factory_->SetFakeResponseForURL( | 437   fake_factory_->SetFakeResponse( | 
| 438       GaiaUrls::GetInstance()->issue_auth_token_url(), | 438       GaiaUrls::GetInstance()->issue_auth_token_url(), | 
| 439       "auth", | 439       "auth", | 
| 440       true); | 440       true); | 
| 441   fake_factory_->SetFakeResponse( | 441   fake_factory_->SetFakeResponse( | 
| 442       GoogleURLTracker::kSearchDomainCheckURL, | 442       GURL(GoogleURLTracker::kSearchDomainCheckURL), | 
| 443       ".google.com", | 443       ".google.com", | 
| 444       true); | 444       true); | 
| 445   fake_factory_->SetFakeResponseForURL( | 445   fake_factory_->SetFakeResponse( | 
| 446       GaiaUrls::GetInstance()->client_login_to_oauth2_url(), | 446       GaiaUrls::GetInstance()->client_login_to_oauth2_url(), | 
| 447       "some_response", | 447       "some_response", | 
| 448       true); | 448       true); | 
| 449   fake_factory_->SetFakeResponseForURL( | 449   fake_factory_->SetFakeResponse( | 
| 450       GaiaUrls::GetInstance()->oauth2_token_url(), | 450       GaiaUrls::GetInstance()->oauth2_token_url(), | 
| 451       "{" | 451       "{" | 
| 452       "  \"refresh_token\": \"rt1\"," | 452       "  \"refresh_token\": \"rt1\"," | 
| 453       "  \"access_token\": \"at1\"," | 453       "  \"access_token\": \"at1\"," | 
| 454       "  \"expires_in\": 3600," | 454       "  \"expires_in\": 3600," | 
| 455       "  \"token_type\": \"Bearer\"" | 455       "  \"token_type\": \"Bearer\"" | 
| 456       "}", | 456       "}", | 
| 457       true); | 457       true); | 
| 458   fake_factory_->SetFakeResponseForURL( | 458   fake_factory_->SetFakeResponse( | 
| 459       GaiaUrls::GetInstance()->oauth1_login_url(), | 459       GaiaUrls::GetInstance()->oauth1_login_url(), | 
| 460       "SID=sid\nLSID=lsid\nAuth=auth_token", | 460       "SID=sid\nLSID=lsid\nAuth=auth_token", | 
| 461       true); | 461       true); | 
| 462 } | 462 } | 
| 463 | 463 | 
| 464 void SyncTest::ClearMockGaiaResponses() { | 464 void SyncTest::ClearMockGaiaResponses() { | 
| 465   // Clear any mock gaia responses that might have been set. | 465   // Clear any mock gaia responses that might have been set. | 
| 466   if (fake_factory_) { | 466   if (fake_factory_) { | 
| 467     fake_factory_->ClearFakeResponses(); | 467     fake_factory_->ClearFakeResponses(); | 
| 468     fake_factory_.reset(); | 468     fake_factory_.reset(); | 
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 833 | 833 | 
| 834 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 834 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 
| 835                               const net::ProxyConfig& proxy_config) { | 835                               const net::ProxyConfig& proxy_config) { | 
| 836   base::WaitableEvent done(false, false); | 836   base::WaitableEvent done(false, false); | 
| 837   BrowserThread::PostTask( | 837   BrowserThread::PostTask( | 
| 838       BrowserThread::IO, FROM_HERE, | 838       BrowserThread::IO, FROM_HERE, | 
| 839       base::Bind(&SetProxyConfigCallback, &done, | 839       base::Bind(&SetProxyConfigCallback, &done, | 
| 840                  make_scoped_refptr(context_getter), proxy_config)); | 840                  make_scoped_refptr(context_getter), proxy_config)); | 
| 841   done.Wait(); | 841   done.Wait(); | 
| 842 } | 842 } | 
| OLD | NEW | 
|---|