| 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/test/live_sync/live_sync_test.h" | 5 #include "chrome/test/live_sync/live_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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 void LiveSyncTest::TearDown() { | 176 void LiveSyncTest::TearDown() { |
| 177 // Allow the InProcessBrowserTest framework to perform its tear down. | 177 // Allow the InProcessBrowserTest framework to perform its tear down. |
| 178 InProcessBrowserTest::TearDown(); | 178 InProcessBrowserTest::TearDown(); |
| 179 | 179 |
| 180 // Stop the local python test server. This is a no-op if one wasn't started. | 180 // Stop the local python test server. This is a no-op if one wasn't started. |
| 181 TearDownLocalPythonTestServer(); | 181 TearDownLocalPythonTestServer(); |
| 182 | 182 |
| 183 // Stop the local sync test server. This is a no-op if one wasn't started. | 183 // Stop the local sync test server. This is a no-op if one wasn't started. |
| 184 TearDownLocalTestServer(); | 184 TearDownLocalTestServer(); |
| 185 | |
| 186 // Switch back to using the default URLFetcher factory. This is a no-op if | |
| 187 // a fake factory wasn't used. | |
| 188 URLFetcher::set_factory(NULL); | |
| 189 } | 185 } |
| 190 | 186 |
| 191 // static | 187 // static |
| 192 Profile* LiveSyncTest::MakeProfile(const FilePath::StringType name) { | 188 Profile* LiveSyncTest::MakeProfile(const FilePath::StringType name) { |
| 193 FilePath path; | 189 FilePath path; |
| 194 PathService::Get(chrome::DIR_USER_DATA, &path); | 190 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 195 return ProfileManager::CreateProfile(path.Append(name)); | 191 return ProfileManager::CreateProfile(path.Append(name)); |
| 196 } | 192 } |
| 197 | 193 |
| 198 Profile* LiveSyncTest::GetProfile(int index) { | 194 Profile* LiveSyncTest::GetProfile(int index) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // integration tests on Linux causes error as we make external DNS lookups. | 270 // integration tests on Linux causes error as we make external DNS lookups. |
| 275 resolver->AllowDirectLookup("*.thawte.com"); | 271 resolver->AllowDirectLookup("*.thawte.com"); |
| 276 resolver->AllowDirectLookup("*.geotrust.com"); | 272 resolver->AllowDirectLookup("*.geotrust.com"); |
| 277 resolver->AllowDirectLookup("*.gstatic.com"); | 273 resolver->AllowDirectLookup("*.gstatic.com"); |
| 278 mock_host_resolver_override_.reset( | 274 mock_host_resolver_override_.reset( |
| 279 new net::ScopedDefaultHostResolverProc(resolver)); | 275 new net::ScopedDefaultHostResolverProc(resolver)); |
| 280 } | 276 } |
| 281 | 277 |
| 282 void LiveSyncTest::TearDownInProcessBrowserTestFixture() { | 278 void LiveSyncTest::TearDownInProcessBrowserTestFixture() { |
| 283 mock_host_resolver_override_.reset(); | 279 mock_host_resolver_override_.reset(); |
| 280 |
| 281 // Switch back to using the default URLFetcher factory. This is a no-op if |
| 282 // a fake factory wasn't used. |
| 283 URLFetcher::set_factory(NULL); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void LiveSyncTest::ReadPasswordFile() { | 286 void LiveSyncTest::ReadPasswordFile() { |
| 287 CommandLine* cl = CommandLine::ForCurrentProcess(); | 287 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 288 password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest); | 288 password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest); |
| 289 if (password_file_.empty()) | 289 if (password_file_.empty()) |
| 290 LOG(FATAL) << "Can't run live server test without specifying --" | 290 LOG(FATAL) << "Can't run live server test without specifying --" |
| 291 << switches::kPasswordFileForTest << "=<filename>"; | 291 << switches::kPasswordFileForTest << "=<filename>"; |
| 292 std::string file_contents; | 292 std::string file_contents; |
| 293 file_util::ReadFileToString(password_file_, &file_contents); | 293 file_util::ReadFileToString(password_file_, &file_contents); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 const net::ProxyConfig& proxy_config) { | 468 const net::ProxyConfig& proxy_config) { |
| 469 base::WaitableEvent done(false, false); | 469 base::WaitableEvent done(false, false); |
| 470 BrowserThread::PostTask( | 470 BrowserThread::PostTask( |
| 471 BrowserThread::IO, | 471 BrowserThread::IO, |
| 472 FROM_HERE, | 472 FROM_HERE, |
| 473 new SetProxyConfigTask(&done, | 473 new SetProxyConfigTask(&done, |
| 474 context_getter, | 474 context_getter, |
| 475 proxy_config)); | 475 proxy_config)); |
| 476 done.Wait(); | 476 done.Wait(); |
| 477 } | 477 } |
| OLD | NEW |