summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortessamac@google.com <tessamac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-28 20:22:50 +0000
committertessamac@google.com <tessamac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-28 20:22:50 +0000
commit19f358e926028112610a67b789c45b627dfe6a2b (patch)
tree9f19f4d4602f408561a9942b0d4bf8e2c7926597 /chrome
parentf25b33a341464659dbb217b0eb57e5f882aa0776 (diff)
downloadchromium_src-19f358e926028112610a67b789c45b627dfe6a2b.zip
chromium_src-19f358e926028112610a67b789c45b627dfe6a2b.tar.gz
chromium_src-19f358e926028112610a67b789c45b627dfe6a2b.tar.bz2
Verify Extension was loaded by checking paths rather than assuming it's last.
BUG=59531 TEST=browser_tests Review URL: http://codereview.chromium.org/4100008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index fb5d57b..7c4cd83 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -58,7 +58,6 @@ void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) {
bool ExtensionBrowserTest::LoadExtensionImpl(const FilePath& path,
bool incognito_enabled) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- size_t num_before = service->extensions()->size();
{
NotificationRegistrar registrar;
registrar.Add(this, NotificationType::EXTENSION_LOADED,
@@ -66,15 +65,26 @@ bool ExtensionBrowserTest::LoadExtensionImpl(const FilePath& path,
service->LoadExtension(path);
ui_test_utils::RunMessageLoop();
}
- size_t num_after = service->extensions()->size();
- if (num_after != (num_before + 1))
+
+ // Find the extension by iterating backwards since it is likely last.
+ FilePath extension_path = path;
+ file_util::AbsolutePath(&extension_path);
+ Extension* extension = NULL;
+ for (ExtensionList::const_reverse_iterator iter =
+ service->extensions()->rbegin();
+ iter != service->extensions()->rend(); ++iter) {
+ if ((*iter)->path() == extension_path) {
+ extension = *iter;
+ break;
+ }
+ }
+ if (!extension)
return false;
if (incognito_enabled) {
// Enable the incognito bit in the extension prefs. The call to
// OnExtensionInstalled ensures the other extension prefs are set up with
// the defaults.
- Extension* extension = service->extensions()->at(num_after - 1);
service->extension_prefs()->OnExtensionInstalled(
extension, Extension::ENABLED, false);
service->SetIsIncognitoEnabled(extension, true);