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