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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 clients_.resize(num_clients_); | 278 clients_.resize(num_clients_); |
279 for (int i = 0; i < num_clients_; ++i) { | 279 for (int i = 0; i < num_clients_; ++i) { |
280 InitializeInstance(i); | 280 InitializeInstance(i); |
281 } | 281 } |
282 | 282 |
283 // Create the verifier profile. | 283 // Create the verifier profile. |
284 verifier_ = MakeProfile(FILE_PATH_LITERAL("Verifier")); | 284 verifier_ = MakeProfile(FILE_PATH_LITERAL("Verifier")); |
285 ui_test_utils::WaitForBookmarkModelToLoad( | 285 ui_test_utils::WaitForBookmarkModelToLoad( |
286 BookmarkModelFactory::GetForProfile(verifier())); | 286 BookmarkModelFactory::GetForProfile(verifier())); |
287 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( | 287 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( |
288 verifier(), Profile::EXPLICIT_ACCESS)); | 288 verifier(), Profile::EXPLICIT_ACCESS).get()); |
289 ui_test_utils::WaitForTemplateURLServiceToLoad( | 289 ui_test_utils::WaitForTemplateURLServiceToLoad( |
290 TemplateURLServiceFactory::GetForProfile(verifier())); | 290 TemplateURLServiceFactory::GetForProfile(verifier())); |
291 return (verifier_ != NULL); | 291 return (verifier_ != NULL); |
292 } | 292 } |
293 | 293 |
294 void SyncTest::InitializeInstance(int index) { | 294 void SyncTest::InitializeInstance(int index) { |
295 profiles_[index] = MakeProfile( | 295 profiles_[index] = MakeProfile( |
296 base::StringPrintf(FILE_PATH_LITERAL("Profile%d"), index)); | 296 base::StringPrintf(FILE_PATH_LITERAL("Profile%d"), index)); |
297 EXPECT_FALSE(GetProfile(index) == NULL) << "Could not create Profile " | 297 EXPECT_FALSE(GetProfile(index) == NULL) << "Could not create Profile " |
298 << index << "."; | 298 << index << "."; |
299 | 299 |
300 browsers_[index] = new Browser(Browser::CreateParams(GetProfile(index))); | 300 browsers_[index] = new Browser(Browser::CreateParams(GetProfile(index))); |
301 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser " | 301 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser " |
302 << index << "."; | 302 << index << "."; |
303 | 303 |
304 clients_[index] = new ProfileSyncServiceHarness(GetProfile(index), | 304 clients_[index] = new ProfileSyncServiceHarness(GetProfile(index), |
305 username_, | 305 username_, |
306 password_); | 306 password_); |
307 EXPECT_FALSE(GetClient(index) == NULL) << "Could not create Client " | 307 EXPECT_FALSE(GetClient(index) == NULL) << "Could not create Client " |
308 << index << "."; | 308 << index << "."; |
309 | 309 |
310 ui_test_utils::WaitForBookmarkModelToLoad( | 310 ui_test_utils::WaitForBookmarkModelToLoad( |
311 BookmarkModelFactory::GetForProfile(GetProfile(index))); | 311 BookmarkModelFactory::GetForProfile(GetProfile(index))); |
312 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( | 312 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( |
313 GetProfile(index), Profile::EXPLICIT_ACCESS)); | 313 GetProfile(index), Profile::EXPLICIT_ACCESS).get()); |
314 ui_test_utils::WaitForTemplateURLServiceToLoad( | 314 ui_test_utils::WaitForTemplateURLServiceToLoad( |
315 TemplateURLServiceFactory::GetForProfile(GetProfile(index))); | 315 TemplateURLServiceFactory::GetForProfile(GetProfile(index))); |
316 } | 316 } |
317 | 317 |
318 void SyncTest::RestartSyncService(int index) { | 318 void SyncTest::RestartSyncService(int index) { |
319 DVLOG(1) << "Restarting profile sync service for profile " << index << "."; | 319 DVLOG(1) << "Restarting profile sync service for profile " << index << "."; |
320 delete clients_[index]; | 320 delete clients_[index]; |
321 Profile* profile = GetProfile(index); | 321 Profile* profile = GetProfile(index); |
322 ProfileSyncService* service = | 322 ProfileSyncService* service = |
323 ProfileSyncServiceFactory::GetForProfile(profile); | 323 ProfileSyncServiceFactory::GetForProfile(profile); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 818 |
819 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 819 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
820 const net::ProxyConfig& proxy_config) { | 820 const net::ProxyConfig& proxy_config) { |
821 base::WaitableEvent done(false, false); | 821 base::WaitableEvent done(false, false); |
822 BrowserThread::PostTask( | 822 BrowserThread::PostTask( |
823 BrowserThread::IO, FROM_HERE, | 823 BrowserThread::IO, FROM_HERE, |
824 base::Bind(&SetProxyConfigCallback, &done, | 824 base::Bind(&SetProxyConfigCallback, &done, |
825 make_scoped_refptr(context_getter), proxy_config)); | 825 make_scoped_refptr(context_getter), proxy_config)); |
826 done.Wait(); | 826 done.Wait(); |
827 } | 827 } |
OLD | NEW |