Index: chrome/browser/sync/test/integration/sync_test.cc |
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc |
index 5008beec098bdf7d9f9693c7c3d7ed0ec2a9e1f2..f40d1f98fd44fbfb4f595c9aa98392743c0720e2 100644 |
--- a/chrome/browser/sync/test/integration/sync_test.cc |
+++ b/chrome/browser/sync/test/integration/sync_test.cc |
@@ -419,14 +419,11 @@ |
} |
Profile* SyncTest::GetProfile(int index) { |
- EXPECT_FALSE(profiles_.empty()) << "SetupClients() has not yet been called."; |
- EXPECT_FALSE(index < 0 || index >= static_cast<int>(profiles_.size())) |
- << "GetProfile(): Index is out of bounds."; |
- |
- Profile* profile = profiles_[index]; |
- EXPECT_NE(nullptr, profile) << "No profile found at index: " << index; |
- |
- return profile; |
+ if (profiles_.empty()) |
+ LOG(FATAL) << "SetupClients() has not yet been called."; |
+ if (index < 0 || index >= static_cast<int>(profiles_.size())) |
+ LOG(FATAL) << "GetProfile(): Index is out of bounds."; |
+ return profiles_[index]; |
} |
std::vector<Profile*> SyncTest::GetAllProfiles() { |
@@ -441,22 +438,11 @@ |
} |
Browser* SyncTest::GetBrowser(int index) { |
- EXPECT_FALSE(browsers_.empty()) << "SetupClients() has not yet been called."; |
- EXPECT_FALSE(index < 0 || index >= static_cast<int>(browsers_.size())) |
- << "GetBrowser(): Index is out of bounds."; |
- |
- Browser* browser = browsers_[index]; |
- EXPECT_NE(browser, nullptr); |
- |
+ if (browsers_.empty()) |
+ LOG(FATAL) << "SetupClients() has not yet been called."; |
+ if (index < 0 || index >= static_cast<int>(browsers_.size())) |
+ LOG(FATAL) << "GetBrowser(): Index is out of bounds."; |
return browsers_[index]; |
-} |
- |
-Browser* SyncTest::AddBrowser(int profile_index) { |
- Profile* profile = GetProfile(profile_index); |
- browsers_.push_back(new Browser(Browser::CreateParams(profile, true))); |
- profiles_.push_back(profile); |
- |
- return browsers_[browsers_.size() - 1]; |
} |
ProfileSyncServiceHarness* SyncTest::GetClient(int index) { |
@@ -501,6 +487,7 @@ |
profiles_.resize(num_clients_); |
profile_delegates_.resize(num_clients_ + 1); // + 1 for the verifier. |
tmp_profile_paths_.resize(num_clients_); |
+ browsers_.resize(num_clients_); |
clients_.resize(num_clients_); |
invalidation_forwarders_.resize(num_clients_); |
sync_refreshers_.resize(num_clients_); |
@@ -541,7 +528,11 @@ |
DCHECK(profile); |
profiles_[index] = profile; |
- AddBrowser(index); |
+ // CheckInitialState() assumes that no windows are open at startup. |
+ browsers_[index] = |
+ new Browser(Browser::CreateParams(GetProfile(index), true)); |
+ |
+ EXPECT_NE(nullptr, GetBrowser(index)) << "Could not create Browser " << index; |
// Make sure the ProfileSyncService has been created before creating the |
// ProfileSyncServiceHarness - some tests expect the ProfileSyncService to |