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

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: A few fixes per comments made 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 Profile* profile, Extension::Type type) { 140 Profile* profile, Extension::Type type) {
141 // TODO(akalin): Mock out the servers that the extensions auto-update 141 // TODO(akalin): Mock out the servers that the extensions auto-update
142 // mechanism talk to so as to more closely match what actually happens. 142 // mechanism talk to so as to more closely match what actually happens.
143 // Background networking will need to be re-enabled for extensions tests. 143 // Background networking will need to be re-enabled for extensions tests.
144 144
145 // We make a copy here since InstallExtension() removes the 145 // We make a copy here since InstallExtension() removes the
146 // extension from the extensions service's copy. 146 // extension from the extensions service's copy.
147 const PendingExtensionManager* pending_extension_manager = 147 const PendingExtensionManager* pending_extension_manager =
148 profile->GetExtensionService()->pending_extension_manager(); 148 profile->GetExtensionService()->pending_extension_manager();
149 149
150 std::set<std::string> pending_crx_ids; 150 std::list<std::string> pending_crx_ids;
151 pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_crx_ids); 151 pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_crx_ids);
152 152
153 std::set<std::string>::const_iterator id; 153 std::list<std::string>::const_iterator iter;
154 PendingExtensionInfo info; 154 PendingExtensionInfo info;
155 for (id = pending_crx_ids.begin(); id != pending_crx_ids.end(); ++id) { 155 for (iter = pending_crx_ids.begin(); iter != pending_crx_ids.end(); ++iter) {
156 ASSERT_TRUE(pending_extension_manager->GetById(*id, &info)); 156 ASSERT_TRUE(pending_extension_manager->GetById(*iter, &info));
157 if (!info.is_from_sync()) 157 if (!info.is_from_sync())
158 continue; 158 continue;
159 159
160 StringMap::const_iterator it2 = id_to_name_.find(*id); 160 StringMap::const_iterator iter2 = id_to_name_.find(*iter);
161 if (it2 == id_to_name_.end()) { 161 if (iter2 == id_to_name_.end()) {
162 ADD_FAILURE() << "Could not get name for id " << *id 162 ADD_FAILURE() << "Could not get name for id " << *iter
163 << " (profile = " << profile->GetDebugName() << ")"; 163 << " (profile = " << profile->GetDebugName() << ")";
164 continue; 164 continue;
165 } 165 }
166 InstallExtension(profile, it2->second, type); 166 InstallExtension(profile, iter2->second, type);
167 } 167 }
168 } 168 }
169 169
170 SyncExtensionHelper::ExtensionStateMap 170 SyncExtensionHelper::ExtensionStateMap
171 SyncExtensionHelper::GetExtensionStates(Profile* profile) { 171 SyncExtensionHelper::GetExtensionStates(Profile* profile) {
172 const std::string& profile_debug_name = profile->GetDebugName(); 172 const std::string& profile_debug_name = profile->GetDebugName();
173 173
174 ExtensionStateMap extension_state_map; 174 ExtensionStateMap extension_state_map;
175 175
176 ExtensionService* extension_service = profile->GetExtensionService(); 176 ExtensionService* extension_service = profile->GetExtensionService();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (extension->id() != expected_id) { 344 if (extension->id() != expected_id) {
345 EXPECT_EQ(expected_id, extension->id()); 345 EXPECT_EQ(expected_id, extension->id());
346 return NULL; 346 return NULL;
347 } 347 }
348 DVLOG(2) << "created extension with name = " 348 DVLOG(2) << "created extension with name = "
349 << name << ", id = " << expected_id; 349 << name << ", id = " << expected_id;
350 (it->second)[name] = extension; 350 (it->second)[name] = extension;
351 id_to_name_[expected_id] = name; 351 id_to_name_[expected_id] = name;
352 return extension; 352 return extension;
353 } 353 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698