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

Unified Diff: chrome/browser/extensions/extension_apitest.cc

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 years 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/extensions/extension_apitest.cc
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index 893a25d49dff91686b211c8f8e95580fd1385b69..624f036885755a4844e44fb4ab8c51253a9c9ec4 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -202,28 +202,29 @@ bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name,
}
}
-// Test that exactly one extension loaded.
+// Test that exactly one extension is loaded, and return it.
const Extension* ExtensionApiTest::GetSingleLoadedExtension() {
ExtensionService* service = browser()->profile()->GetExtensionService();
- int found_extension_index = -1;
- for (size_t i = 0; i < service->extensions()->size(); ++i) {
+ const Extension* extension = NULL;
+ for (ExtensionSet::const_iterator it = service->extensions()->begin();
+ it != service->extensions()->end(); ++it) {
// Ignore any component extensions. They are automatically loaded into all
// profiles and aren't the extension we're looking for here.
- if (service->extensions()->at(i)->location() == Extension::COMPONENT)
+ if ((*it)->location() == Extension::COMPONENT)
continue;
- if (found_extension_index != -1) {
+ if (extension != NULL) {
+ // TODO(yoz): this is misleading; it counts component extensions.
message_ = base::StringPrintf(
"Expected only one extension to be present. Found %u.",
static_cast<unsigned>(service->extensions()->size()));
return NULL;
}
- found_extension_index = static_cast<int>(i);
+ extension = *it;
}
- const Extension* extension = service->extensions()->at(found_extension_index);
if (!extension) {
message_ = "extension pointer is NULL.";
return NULL;
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698