| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool SyncTest::SetupClients() { | 463 bool SyncTest::SetupClients() { |
| 464 if (num_clients_ <= 0) | 464 if (num_clients_ <= 0) |
| 465 LOG(FATAL) << "num_clients_ incorrectly initialized."; | 465 LOG(FATAL) << "num_clients_ incorrectly initialized."; |
| 466 if (!profiles_.empty() || !browsers_.empty() || !clients_.empty()) | 466 if (!profiles_.empty() || !browsers_.empty() || !clients_.empty()) |
| 467 LOG(FATAL) << "SetupClients() has already been called."; | 467 LOG(FATAL) << "SetupClients() has already been called."; |
| 468 | 468 |
| 469 // Create the required number of sync profiles, browsers and clients. | 469 // Create the required number of sync profiles, browsers and clients. |
| 470 profiles_.resize(num_clients_); | 470 profiles_.resize(num_clients_); |
| 471 profile_delegates_.resize(num_clients_ + 1); // + 1 for the verifier. | 471 profile_delegates_.resize(num_clients_ + 1); // + 1 for the verifier. |
| 472 tmp_profile_paths_.resize(num_clients_); | 472 tmp_profile_paths_.resize(num_clients_); |
| 473 browsers_.resize(num_clients_); | 473 browsers_.resize(num_clients_); |
| 474 clients_.resize(num_clients_); | 474 clients_.resize(num_clients_); |
| 475 invalidation_forwarders_.resize(num_clients_); | 475 invalidation_forwarders_.resize(num_clients_); |
| 476 sync_refreshers_.resize(num_clients_); | 476 sync_refreshers_.resize(num_clients_); |
| 477 fake_server_invalidation_services_.resize(num_clients_); | 477 fake_server_invalidation_services_.resize(num_clients_); |
| 478 | 478 |
| 479 if (create_gaia_account_at_runtime_) { | 479 if (create_gaia_account_at_runtime_) { |
| 480 CHECK(UsingExternalServers()) << | 480 CHECK(UsingExternalServers()) << |
| 481 "Cannot create Gaia accounts without external authentication servers"; | 481 "Cannot create Gaia accounts without external authentication servers"; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 new P2PSyncRefresher(GetProfile(i), clients_[i]->service()); | 630 new P2PSyncRefresher(GetProfile(i), clients_[i]->service()); |
| 631 } | 631 } |
| 632 | 632 |
| 633 // OneClickSigninSyncStarter observer is created with a real user sign in. | 633 // OneClickSigninSyncStarter observer is created with a real user sign in. |
| 634 // It is deleted on certain conditions which are not satisfied by our tests, | 634 // It is deleted on certain conditions which are not satisfied by our tests, |
| 635 // and this causes the SigninTracker observer to stay hanging at shutdown. | 635 // and this causes the SigninTracker observer to stay hanging at shutdown. |
| 636 // Calling LoginUIService::SyncConfirmationUIClosed forces the observer to | 636 // Calling LoginUIService::SyncConfirmationUIClosed forces the observer to |
| 637 // be removed. http://crbug.com/484388 | 637 // be removed. http://crbug.com/484388 |
| 638 for (int i = 0; i < num_clients_; ++i) { | 638 for (int i = 0; i < num_clients_; ++i) { |
| 639 LoginUIServiceFactory::GetForProfile(GetProfile(i))-> | 639 LoginUIServiceFactory::GetForProfile(GetProfile(i))-> |
| 640 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); | 640 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS, |
| 641 false); |
| 641 } | 642 } |
| 642 } | 643 } |
| 643 | 644 |
| 644 return true; | 645 return true; |
| 645 } | 646 } |
| 646 | 647 |
| 647 void SyncTest::TearDownOnMainThread() { | 648 void SyncTest::TearDownOnMainThread() { |
| 648 for (size_t i = 0; i < clients_.size(); ++i) { | 649 for (size_t i = 0; i < clients_.size(); ++i) { |
| 649 clients_[i]->service()->RequestStop(ProfileSyncService::CLEAR_DATA); | 650 clients_[i]->service()->RequestStop(ProfileSyncService::CLEAR_DATA); |
| 650 } | 651 } |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 | 1118 |
| 1118 void SyncTest::TriggerSyncForModelTypes(int index, | 1119 void SyncTest::TriggerSyncForModelTypes(int index, |
| 1119 syncer::ModelTypeSet model_types) { | 1120 syncer::ModelTypeSet model_types) { |
| 1120 GetSyncService(index)->TriggerRefresh(model_types); | 1121 GetSyncService(index)->TriggerRefresh(model_types); |
| 1121 } | 1122 } |
| 1122 | 1123 |
| 1123 void SyncTest::SetPreexistingPreferencesFileContents( | 1124 void SyncTest::SetPreexistingPreferencesFileContents( |
| 1124 const std::string& contents) { | 1125 const std::string& contents) { |
| 1125 preexisting_preferences_file_contents_ = contents; | 1126 preexisting_preferences_file_contents_ = contents; |
| 1126 } | 1127 } |
| OLD | NEW |