summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_browsertest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/extension_browsertest.cc')
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index 252e2e6..4e25a8a 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -246,6 +246,29 @@ bool ExtensionBrowserTest::WaitForExtensionInstallError() {
return extension_installs_observed_ == before;
}
+void ExtensionBrowserTest::WaitForExtensionLoad() {
+ NotificationRegistrar registrar;
+ registrar.Add(this, NotificationType::EXTENSION_LOADED,
+ NotificationService::AllSources());
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, new MessageLoop::QuitTask, kTimeoutMs);
+ ui_test_utils::RunMessageLoop();
+ WaitForExtensionHostsToLoad();
+}
+
+bool ExtensionBrowserTest::WaitForExtensionCrash(
+ const std::string& extension_id) {
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+
+ if (!service->GetExtensionById(extension_id, true)) {
+ // The extension is already unloaded, presumably due to a crash.
+ return true;
+ }
+ ui_test_utils::RegisterAndWait(NotificationType::EXTENSION_PROCESS_TERMINATED,
+ this, kTimeoutMs);
+ return (service->GetExtensionById(extension_id, true) == NULL);
+}
+
void ExtensionBrowserTest::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -287,6 +310,11 @@ void ExtensionBrowserTest::Observe(NotificationType type,
MessageLoopForUI::current()->Quit();
break;
+ case NotificationType::EXTENSION_PROCESS_TERMINATED:
+ std::cout << "Got EXTENSION_PROCESS_TERMINATED notification.\n";
+ MessageLoopForUI::current()->Quit();
+ break;
+
default:
NOTREACHED();
break;