Index: chrome/browser/extensions/extension_apitest.cc |
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc |
index 90be1ca7bda537c1c9690989def9cda2a94e8dee..ecf88fd1fdbf207d5c1deee8b83caa1c64eaae4b 100644 |
--- a/chrome/browser/extensions/extension_apitest.cc |
+++ b/chrome/browser/extensions/extension_apitest.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/browser/ui/extensions/application_launch.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "extensions/browser/api/test/test_api.h" |
+#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extension_system.h" |
#include "extensions/common/extension.h" |
#include "extensions/common/extension_set.h" |
@@ -325,34 +326,33 @@ bool ExtensionApiTest::RunExtensionTestImpl(const std::string& extension_name, |
// Test that exactly one extension is loaded, and return it. |
const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { |
- ExtensionService* service = extensions::ExtensionSystem::Get( |
- browser()->profile())->extension_service(); |
+ extensions::ExtensionRegistry* registry = |
+ extensions::ExtensionRegistry::Get(browser()->profile()); |
- const extensions::Extension* extension = NULL; |
- for (extensions::ExtensionSet::const_iterator it = |
- service->extensions()->begin(); |
- it != service->extensions()->end(); ++it) { |
+ const extensions::Extension* result = NULL; |
+ for (const scoped_refptr<const extensions::Extension>& extension : |
+ registry->enabled_extensions()) { |
// Ignore any component extensions. They are automatically loaded into all |
// profiles and aren't the extension we're looking for here. |
- if ((*it)->location() == extensions::Manifest::COMPONENT) |
+ if (extension->location() == extensions::Manifest::COMPONENT) |
continue; |
- if (extension != NULL) { |
+ if (result != 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())); |
+ static_cast<unsigned>(registry->enabled_extensions().size())); |
return NULL; |
} |
- extension = it->get(); |
+ result = extension.get(); |
} |
- if (!extension) { |
+ if (!result) { |
message_ = "extension pointer is NULL."; |
return NULL; |
} |
- return extension; |
+ return result; |
} |
bool ExtensionApiTest::StartEmbeddedTestServer() { |