summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_browsertest.cc
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 15:44:50 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 15:44:50 +0000
commitd10f460846ca852020419683da1a4f6208b50f9f (patch)
tree515dbf4f1824e2a1a5387777a3cf4f072d2df8f1 /chrome/browser/extensions/extension_browsertest.cc
parent9fbf5c225b0606fd74cbf09a48c298ec20ebcde8 (diff)
downloadchromium_src-d10f460846ca852020419683da1a4f6208b50f9f.zip
chromium_src-d10f460846ca852020419683da1a4f6208b50f9f.tar.gz
chromium_src-d10f460846ca852020419683da1a4f6208b50f9f.tar.bz2
Add tests for chrome.tabs.captureVisibleTab working for file:/// URLs.
These tests were originally in http://codereview.chromium.org/6696090 (which never got landed). The actual behavior was fixed with r80213, but we didn't have a test case for bug 76816. Getting the tests to pass involved some ExtensionBrowserTest tweaks, since unpacked extensions default to always allowing file:/// access, but we want to disallow that for some tests. BUG=76816 TEST=no R=mpcomplete@chromium.org Review URL: http://codereview.chromium.org/7155012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_browsertest.cc')
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index 848a863..320f048 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -85,13 +85,28 @@ const Extension* ExtensionBrowserTest::LoadExtensionImpl(
if (!extension)
return NULL;
+ const std::string extension_id = extension->id();
+
// The call to OnExtensionInstalled ensures the other extension prefs
// are set up with the defaults.
service->extension_prefs()->OnExtensionInstalled(
extension, Extension::ENABLED);
- service->SetIsIncognitoEnabled(extension->id(), incognito_enabled);
+ service->SetIsIncognitoEnabled(extension_id, incognito_enabled);
+
+ ui_test_utils::WindowedNotificationObserver extension_loaded_signal(
+ NotificationType::EXTENSION_LOADED,
+ Source<Profile>(browser()->profile()));
service->SetAllowFileAccess(extension, fileaccess_enabled);
+ // Disabling file access (it's enabled by default for unpacked extensions)
+ // ends up reloading the extension, so we need to wait for that and make sure
+ // that we have the most up to date extension instance.
+ if (!fileaccess_enabled) {
+ extension_loaded_signal.Wait();
+ extension = service->GetExtensionById(extension_id, false);
+ CHECK(extension) << extension_id << " not found after reloading.";
+ }
+
if (!WaitForExtensionHostsToLoad())
return NULL;