Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Unified Diff: chrome/browser/sync/test/integration/sync_app_list_helper.cc

Issue 1834323004: [Sync] Eliminate verifier profile from sync_integration_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix failing tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/sync_app_list_helper.cc
diff --git a/chrome/browser/sync/test/integration/sync_app_list_helper.cc b/chrome/browser/sync/test/integration/sync_app_list_helper.cc
index 72c984b8809d5b44545bee8d1f37300909dbbe36..28030215321997d83e5de3f133562491f3d31918 100644
--- a/chrome/browser/sync/test/integration/sync_app_list_helper.cc
+++ b/chrome/browser/sync/test/integration/sync_app_list_helper.cc
@@ -39,53 +39,53 @@ void SyncAppListHelper::SetupIfNecessary(SyncTest* test) {
return;
}
test_ = test;
-
- for (int i = 0; i < test->num_clients(); ++i) {
- extensions::ExtensionSystem::Get(test_->GetProfile(i))
- ->InitForRegularProfile(true);
+ std::vector<Profile*> profiles = test_->GetAllProfiles();
+ for (std::vector<Profile*>::iterator it = profiles.begin();
+ it != profiles.end();
+ ++it) {
+ extensions::ExtensionSystem::Get(*it)->InitForRegularProfile(true);
}
- extensions::ExtensionSystem::Get(test_->verifier())
- ->InitForRegularProfile(true);
setup_completed_ = true;
}
-bool SyncAppListHelper::AppListMatchesVerifier(Profile* profile) {
- AppListSyncableService* service =
- AppListSyncableServiceFactory::GetForProfile(profile);
- AppListSyncableService* verifier =
- AppListSyncableServiceFactory::GetForProfile(test_->verifier());
+bool SyncAppListHelper::AppListMatch(Profile* profile1, Profile* profile2) {
+ AppListSyncableService* service1 =
+ AppListSyncableServiceFactory::GetForProfile(profile1);
+ AppListSyncableService* service2 =
+ AppListSyncableServiceFactory::GetForProfile(profile2);
// Note: sync item entries may not exist in verifier, but item lists should
// match.
- if (service->GetModel()->top_level_item_list()->item_count() !=
- verifier->GetModel()->top_level_item_list()->item_count()) {
+ if (service1->GetModel()->top_level_item_list()->item_count() !=
+ service2->GetModel()->top_level_item_list()->item_count()) {
LOG(ERROR) << "Model item count: "
- << service->GetModel()->top_level_item_list()->item_count()
+ << service1->GetModel()->top_level_item_list()->item_count()
<< " != "
- << verifier->GetModel()->top_level_item_list()->item_count();
+ << service2->GetModel()->top_level_item_list()->item_count();
return false;
}
bool res = true;
for (size_t i = 0;
- i < service->GetModel()->top_level_item_list()->item_count(); ++i) {
- AppListItem* item1 = service->GetModel()->top_level_item_list()->item_at(i);
+ i < service1->GetModel()->top_level_item_list()->item_count(); ++i) {
+ AppListItem* item1 =
+ service1->GetModel()->top_level_item_list()->item_at(i);
AppListItem* item2 =
- verifier->GetModel()->top_level_item_list()->item_at(i);
+ service2->GetModel()->top_level_item_list()->item_at(i);
if (item1->CompareForTest(item2))
continue;
LOG(ERROR) << "Item(" << i << "): " << item1->ToDebugString()
<< " != " << item2->ToDebugString();
size_t index2;
- if (!verifier->GetModel()->top_level_item_list()->FindItemIndex(item1->id(),
+ if (!service2->GetModel()->top_level_item_list()->FindItemIndex(item1->id(),
&index2)) {
LOG(ERROR) << " Item(" << i << "): " << item1->ToDebugString()
- << " Not in verifier.";
+ << " Not in profile2.";
} else {
LOG(ERROR) << " Item(" << i << "): " << item1->ToDebugString()
- << " Has different verifier index: " << index2;
- item2 = verifier->GetModel()->top_level_item_list()->item_at(index2);
- LOG(ERROR) << " Verifier Item(" << index2
+ << " Has different profile2 index: " << index2;
+ item2 = service2->GetModel()->top_level_item_list()->item_at(index2);
+ LOG(ERROR) << " profile2 Item(" << index2
<< "): " << item2->ToDebugString();
}
res = false;
@@ -93,28 +93,23 @@ bool SyncAppListHelper::AppListMatchesVerifier(Profile* profile) {
return res;
}
-bool SyncAppListHelper::AllProfilesHaveSameAppListAsVerifier() {
- bool res = true;
- for (int i = 0; i < test_->num_clients(); ++i) {
- if (!AppListMatchesVerifier(test_->GetProfile(i))) {
- LOG(ERROR) << "Profile " << i
- << " doesn't have the same app list as the verifier profile.";
- res = false;
+bool SyncAppListHelper::AllProfilesHaveSameAppList() {
+ std::vector<Profile*> profiles = test_->GetAllProfiles();
+ std::vector<Profile*>::iterator it = profiles.begin();
+ Profile* profile1 = *it;
Nicolas Zea 2016/03/31 19:01:22 same comment about moving into for loop
shadi 2016/03/31 22:46:47 Done.
+ ++it;
+ for (; it != profiles.end(); ++it) {
+ if (!AppListMatch(profile1, *it)) {
+ DVLOG(1) << "Profile1: "
+ << AppListSyncableServiceFactory::GetForProfile(profile1);
+ PrintAppList(profile1);
+ DVLOG(1) << "Profile2: "
+ << AppListSyncableServiceFactory::GetForProfile(*it);
+ PrintAppList(*it);
+ return false;
}
}
- if (!res) {
- Profile* verifier = test_->verifier();
- DVLOG(1) << "Verifier: "
- << AppListSyncableServiceFactory::GetForProfile(verifier);
- PrintAppList(test_->verifier());
- for (int i = 0; i < test_->num_clients(); ++i) {
- Profile* profile = test_->GetProfile(i);
- DVLOG(1) << "Profile: " << i << ": "
- << AppListSyncableServiceFactory::GetForProfile(profile);
- PrintAppList(profile);
- }
- }
- return res;
+ return true;
}
void SyncAppListHelper::MoveApp(Profile* profile, size_t from, size_t to) {

Powered by Google App Engine
This is Rietveld 408576698