OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_app_list_helper.h" | 5 #include "chrome/browser/sync/test/integration/sync_app_list_helper.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 9 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool res = true; | 97 bool res = true; |
98 for (int i = 0; i < test_->num_clients(); ++i) { | 98 for (int i = 0; i < test_->num_clients(); ++i) { |
99 if (!AppListMatchesVerifier(test_->GetProfile(i))) { | 99 if (!AppListMatchesVerifier(test_->GetProfile(i))) { |
100 LOG(ERROR) << "Profile " << i | 100 LOG(ERROR) << "Profile " << i |
101 << " doesn't have the same app list as the verifier profile."; | 101 << " doesn't have the same app list as the verifier profile."; |
102 res = false; | 102 res = false; |
103 } | 103 } |
104 } | 104 } |
105 if (!res) { | 105 if (!res) { |
106 Profile* verifier = test_->verifier(); | 106 Profile* verifier = test_->verifier(); |
107 VLOG(1) << "Verifier: " | 107 DVLOG(1) << "Verifier: " |
108 << AppListSyncableServiceFactory::GetForProfile(verifier); | 108 << AppListSyncableServiceFactory::GetForProfile(verifier); |
109 PrintAppList(test_->verifier()); | 109 PrintAppList(test_->verifier()); |
110 for (int i = 0; i < test_->num_clients(); ++i) { | 110 for (int i = 0; i < test_->num_clients(); ++i) { |
111 Profile* profile = test_->GetProfile(i); | 111 Profile* profile = test_->GetProfile(i); |
112 VLOG(1) << "Profile: " << i << ": " | 112 DVLOG(1) << "Profile: " << i << ": " |
113 << AppListSyncableServiceFactory::GetForProfile(profile); | 113 << AppListSyncableServiceFactory::GetForProfile(profile); |
114 PrintAppList(profile); | 114 PrintAppList(profile); |
115 } | 115 } |
116 } | 116 } |
117 return res; | 117 return res; |
118 } | 118 } |
119 | 119 |
120 void SyncAppListHelper::MoveApp(Profile* profile, size_t from, size_t to) { | 120 void SyncAppListHelper::MoveApp(Profile* profile, size_t from, size_t to) { |
121 AppListSyncableService* service = | 121 AppListSyncableService* service = |
122 AppListSyncableServiceFactory::GetForProfile(profile); | 122 AppListSyncableServiceFactory::GetForProfile(profile); |
123 service->model()->top_level_item_list()->MoveItem(from, to); | 123 service->model()->top_level_item_list()->MoveItem(from, to); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 void SyncAppListHelper::PrintItem(Profile* profile, | 171 void SyncAppListHelper::PrintItem(Profile* profile, |
172 AppListItem* item, | 172 AppListItem* item, |
173 const std::string& label) { | 173 const std::string& label) { |
174 extensions::AppSorting* s = | 174 extensions::AppSorting* s = |
175 extensions::ExtensionPrefs::Get(profile)->app_sorting(); | 175 extensions::ExtensionPrefs::Get(profile)->app_sorting(); |
176 std::string id = item->id(); | 176 std::string id = item->id(); |
177 if (item->GetItemType() == AppListFolderItem::kItemType) { | 177 if (item->GetItemType() == AppListFolderItem::kItemType) { |
178 VLOG(1) << label << item->ToDebugString(); | 178 DVLOG(1) << label << item->ToDebugString(); |
179 AppListFolderItem* folder = static_cast<AppListFolderItem*>(item); | 179 AppListFolderItem* folder = static_cast<AppListFolderItem*>(item); |
180 for (size_t i = 0; i < folder->item_list()->item_count(); ++i) { | 180 for (size_t i = 0; i < folder->item_list()->item_count(); ++i) { |
181 AppListItem* child = folder->item_list()->item_at(i); | 181 AppListItem* child = folder->item_list()->item_at(i); |
182 std::string child_label = | 182 std::string child_label = |
183 base::StringPrintf(" Folder Item(%d): ", static_cast<int>(i)); | 183 base::StringPrintf(" Folder Item(%d): ", static_cast<int>(i)); |
184 PrintItem(profile, child, child_label); | 184 PrintItem(profile, child, child_label); |
185 } | 185 } |
186 return; | 186 return; |
187 } | 187 } |
188 VLOG(1) << label << item->ToDebugString() | 188 DVLOG(1) << label << item->ToDebugString() |
189 << " Page: " << s->GetPageOrdinal(id).ToDebugString().substr(0, 8) | 189 << " Page: " << s->GetPageOrdinal(id).ToDebugString().substr(0, 8) |
190 << " Item: " | 190 << " Item: " |
191 << s->GetAppLaunchOrdinal(id).ToDebugString().substr(0, 8); | 191 << s->GetAppLaunchOrdinal(id).ToDebugString().substr(0, 8); |
192 } | 192 } |
OLD | NEW |