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

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

Issue 1850253002: Revert of [Sync] Eliminate verifier profile from sync_integration_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 487209ec48652321f3795e764d0121c37410e004..72c984b8809d5b44545bee8d1f37300909dbbe36 100644
--- a/chrome/browser/sync/test/integration/sync_app_list_helper.cc
+++ b/chrome/browser/sync/test/integration/sync_app_list_helper.cc
@@ -39,50 +39,53 @@
return;
}
test_ = test;
- for (auto* profile : test_->GetAllProfiles()) {
- extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(true);
+
+ for (int i = 0; i < test->num_clients(); ++i) {
+ extensions::ExtensionSystem::Get(test_->GetProfile(i))
+ ->InitForRegularProfile(true);
}
+ extensions::ExtensionSystem::Get(test_->verifier())
+ ->InitForRegularProfile(true);
setup_completed_ = true;
}
-bool SyncAppListHelper::AppListMatch(Profile* profile1, Profile* profile2) {
- AppListSyncableService* service1 =
- AppListSyncableServiceFactory::GetForProfile(profile1);
- AppListSyncableService* service2 =
- AppListSyncableServiceFactory::GetForProfile(profile2);
+bool SyncAppListHelper::AppListMatchesVerifier(Profile* profile) {
+ AppListSyncableService* service =
+ AppListSyncableServiceFactory::GetForProfile(profile);
+ AppListSyncableService* verifier =
+ AppListSyncableServiceFactory::GetForProfile(test_->verifier());
// Note: sync item entries may not exist in verifier, but item lists should
// match.
- if (service1->GetModel()->top_level_item_list()->item_count() !=
- service2->GetModel()->top_level_item_list()->item_count()) {
+ if (service->GetModel()->top_level_item_list()->item_count() !=
+ verifier->GetModel()->top_level_item_list()->item_count()) {
LOG(ERROR) << "Model item count: "
- << service1->GetModel()->top_level_item_list()->item_count()
+ << service->GetModel()->top_level_item_list()->item_count()
<< " != "
- << service2->GetModel()->top_level_item_list()->item_count();
+ << verifier->GetModel()->top_level_item_list()->item_count();
return false;
}
bool res = true;
for (size_t i = 0;
- i < service1->GetModel()->top_level_item_list()->item_count(); ++i) {
- AppListItem* item1 =
- service1->GetModel()->top_level_item_list()->item_at(i);
+ i < service->GetModel()->top_level_item_list()->item_count(); ++i) {
+ AppListItem* item1 = service->GetModel()->top_level_item_list()->item_at(i);
AppListItem* item2 =
- service2->GetModel()->top_level_item_list()->item_at(i);
+ verifier->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 (!service2->GetModel()->top_level_item_list()->FindItemIndex(item1->id(),
+ if (!verifier->GetModel()->top_level_item_list()->FindItemIndex(item1->id(),
&index2)) {
LOG(ERROR) << " Item(" << i << "): " << item1->ToDebugString()
- << " Not in profile2.";
+ << " Not in verifier.";
} else {
LOG(ERROR) << " Item(" << i << "): " << item1->ToDebugString()
- << " Has different profile2 index: " << index2;
- item2 = service2->GetModel()->top_level_item_list()->item_at(index2);
- LOG(ERROR) << " profile2 Item(" << index2
+ << " Has different verifier index: " << index2;
+ item2 = verifier->GetModel()->top_level_item_list()->item_at(index2);
+ LOG(ERROR) << " Verifier Item(" << index2
<< "): " << item2->ToDebugString();
}
res = false;
@@ -90,21 +93,28 @@
return res;
}
-bool SyncAppListHelper::AllProfilesHaveSameAppList() {
- const auto& profiles = test_->GetAllProfiles();
- for (auto* profile : profiles) {
- if (profile != profiles.front() &&
- !AppListMatch(profiles.front(), profile)) {
- DVLOG(1) << "Profile1: "
+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;
+ }
+ }
+ 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);
- DVLOG(1) << "Profile2: " <<
- AppListSyncableServiceFactory::GetForProfile(profiles.front());
- PrintAppList(profiles.front());
- return false;
}
}
- return true;
+ return res;
}
void SyncAppListHelper::MoveApp(Profile* profile, size_t from, size_t to) {
@@ -134,6 +144,17 @@
}
service->GetModel()->MoveItemToFolder(
folder->item_list()->item_at(index_in_folder), "");
+}
+
+void SyncAppListHelper::CopyOrdinalsToVerifier(Profile* profile,
+ const std::string& id) {
+ AppListSyncableService* service =
+ AppListSyncableServiceFactory::GetForProfile(profile);
+ AppListSyncableService* verifier =
+ AppListSyncableServiceFactory::GetForProfile(test_->verifier());
+ verifier->GetModel()->top_level_item_list()->SetItemPosition(
+ verifier->GetModel()->FindItem(id),
+ service->GetModel()->FindItem(id)->position());
}
void SyncAppListHelper::PrintAppList(Profile* profile) {
« no previous file with comments | « chrome/browser/sync/test/integration/sync_app_list_helper.h ('k') | chrome/browser/sync/test/integration/sync_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698