summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/test_extension_loader.cc
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 00:05:34 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 00:05:34 +0000
commit1bd5413c93779467e15c402e5bb1c866792bcac6 (patch)
tree19615d0f974d67abadd8464d188c5a8a02b84fe0 /chrome/browser/extensions/test_extension_loader.cc
parentd9fac60990a817c7ef7f1a7beef90dc319bf299b (diff)
downloadchromium_src-1bd5413c93779467e15c402e5bb1c866792bcac6.zip
chromium_src-1bd5413c93779467e15c402e5bb1c866792bcac6.tar.gz
chromium_src-1bd5413c93779467e15c402e5bb1c866792bcac6.tar.bz2
Disable extensions in incognito mode.
Add a browsertest to make sure we don't crash with an incognito window open. Had to finagle utility_process_host to make it work in a browsertest. BUG=12326 TEST=none Review URL: http://codereview.chromium.org/118476 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/test_extension_loader.cc')
-rw-r--r--chrome/browser/extensions/test_extension_loader.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/extensions/test_extension_loader.cc b/chrome/browser/extensions/test_extension_loader.cc
index d8bacb7..d17f557 100644
--- a/chrome/browser/extensions/test_extension_loader.cc
+++ b/chrome/browser/extensions/test_extension_loader.cc
@@ -15,6 +15,7 @@ namespace {
// How long to wait for the extension to load before giving up.
const int kLoadTimeoutMs = 5000;
+const int kInstallTimeoutMs = 10000;
} // namespace
@@ -25,7 +26,8 @@ TestExtensionLoader::TestExtensionLoader(Profile* profile)
NotificationService::AllSources());
profile_->GetExtensionsService()->Init();
- DCHECK(profile_->GetExtensionsService()->extensions()->empty());
+ profile_->GetExtensionsService()->set_show_extensions_prompts(false);
+ DCHECK(profile_->GetExtensionsService()->extensions()->empty());
}
Extension* TestExtensionLoader::Load(const char* extension_id,
@@ -45,6 +47,23 @@ Extension* TestExtensionLoader::Load(const char* extension_id,
return extension_;
}
+Extension* TestExtensionLoader::Install(const char* extension_id,
+ const FilePath& path) {
+ loading_extension_id_ = extension_id;
+
+ // Install the extension. When installed, the extension will automatically
+ // be loaded.
+ profile_->GetExtensionsService()->InstallExtension(path);
+
+ // Wait for the load to complete.
+ extension_ = NULL;
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new MessageLoop::QuitTask, kInstallTimeoutMs);
+ ui_test_utils::RunMessageLoop();
+
+ return extension_;
+}
+
void TestExtensionLoader::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {