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

Side by Side Diff: chrome/browser/sync/test/integration/sync_extension_helper.cc

Issue 9595001: Apps on NTP should be in order of installation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More fixes Created 8 years, 8 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 unified diff | Download patch
OLDNEW
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_extension_helper.h" 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Profile* profile, Extension::Type type) { 141 Profile* profile, Extension::Type type) {
142 // TODO(akalin): Mock out the servers that the extensions auto-update 142 // TODO(akalin): Mock out the servers that the extensions auto-update
143 // mechanism talk to so as to more closely match what actually happens. 143 // mechanism talk to so as to more closely match what actually happens.
144 // Background networking will need to be re-enabled for extensions tests. 144 // Background networking will need to be re-enabled for extensions tests.
145 145
146 // We make a copy here since InstallExtension() removes the 146 // We make a copy here since InstallExtension() removes the
147 // extension from the extensions service's copy. 147 // extension from the extensions service's copy.
148 const PendingExtensionManager* pending_extension_manager = 148 const PendingExtensionManager* pending_extension_manager =
149 profile->GetExtensionService()->pending_extension_manager(); 149 profile->GetExtensionService()->pending_extension_manager();
150 150
151 std::set<std::string> pending_crx_ids; 151 std::list<std::string> pending_crx_ids;
152 pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_crx_ids); 152 pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_crx_ids);
153 153
154 std::set<std::string>::const_iterator id; 154 std::list<std::string>::const_iterator iter;
155 PendingExtensionInfo info; 155 PendingExtensionInfo info;
156 for (id = pending_crx_ids.begin(); id != pending_crx_ids.end(); ++id) { 156 for (iter = pending_crx_ids.begin(); iter != pending_crx_ids.end(); ++iter) {
157 ASSERT_TRUE(pending_extension_manager->GetById(*id, &info)); 157 ASSERT_TRUE(pending_extension_manager->GetById(*iter, &info));
158 if (!info.is_from_sync()) 158 if (!info.is_from_sync())
159 continue; 159 continue;
160 160
161 StringMap::const_iterator it2 = id_to_name_.find(*id); 161 StringMap::const_iterator iter2 = id_to_name_.find(*iter);
162 if (it2 == id_to_name_.end()) { 162 if (iter2 == id_to_name_.end()) {
163 ADD_FAILURE() << "Could not get name for id " << *id 163 ADD_FAILURE() << "Could not get name for id " << *iter
164 << " (profile = " << profile->GetDebugName() << ")"; 164 << " (profile = " << profile->GetDebugName() << ")";
165 continue; 165 continue;
166 } 166 }
167 InstallExtension(profile, it2->second, type); 167 InstallExtension(profile, iter2->second, type);
168 } 168 }
169 } 169 }
170 170
171 SyncExtensionHelper::ExtensionStateMap 171 SyncExtensionHelper::ExtensionStateMap
172 SyncExtensionHelper::GetExtensionStates(Profile* profile) { 172 SyncExtensionHelper::GetExtensionStates(Profile* profile) {
173 const std::string& profile_debug_name = profile->GetDebugName(); 173 const std::string& profile_debug_name = profile->GetDebugName();
174 174
175 ExtensionStateMap extension_state_map; 175 ExtensionStateMap extension_state_map;
176 176
177 ExtensionService* extension_service = profile->GetExtensionService(); 177 ExtensionService* extension_service = profile->GetExtensionService();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (extension->id() != expected_id) { 345 if (extension->id() != expected_id) {
346 EXPECT_EQ(expected_id, extension->id()); 346 EXPECT_EQ(expected_id, extension->id());
347 return NULL; 347 return NULL;
348 } 348 }
349 DVLOG(2) << "created extension with name = " 349 DVLOG(2) << "created extension with name = "
350 << name << ", id = " << expected_id; 350 << name << ", id = " << expected_id;
351 (it->second)[name] = extension; 351 (it->second)[name] = extension;
352 id_to_name_[expected_id] = name; 352 id_to_name_[expected_id] = name;
353 return extension; 353 return extension;
354 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698