Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1177)

Unified Diff: chrome/browser/extensions/extension_browsertest.cc

Issue 174277: override chrome:// URLs via extensions. (Closed)
Patch Set: fix linux errors Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/extensions/extension_dom_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_browsertest.cc
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index 4fead1c74bac3376459e81ff3fc7daf08322a5d5..b51d35f04a632ac15ed7eee864e6996aa6d858cd 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -137,22 +137,20 @@ bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() {
// Wait for all the extension hosts that exist to finish loading.
// NOTE: This assumes that the extension host list is not changing while
// this method is running.
+
+ NotificationRegistrar registrar;
+ registrar.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING,
+ NotificationService::AllSources());
+
ExtensionProcessManager* manager =
browser()->profile()->GetExtensionProcessManager();
base::Time start_time = base::Time::Now();
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new MessageLoop::QuitTask, kTimeoutMs);
for (ExtensionProcessManager::const_iterator iter = manager->begin();
iter != manager->end(); ++iter) {
- while (!(*iter)->did_stop_loading()) {
- if ((base::Time::Now() - start_time).InMilliseconds() > kTimeoutMs) {
- std::cout << "Extension host did not load for URL: "
- << (*iter)->GetURL().spec();
- return false;
- }
-
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- new MessageLoop::QuitTask, 200);
+ if (!(*iter)->did_stop_loading())
ui_test_utils::RunMessageLoop();
- }
}
return true;
@@ -172,6 +170,11 @@ void ExtensionBrowserTest::Observe(NotificationType type,
MessageLoopForUI::current()->Quit();
break;
+ case NotificationType::EXTENSION_HOST_DID_STOP_LOADING:
+ std::cout << "Got EXTENSION_HOST_DID_STOP_LOADING notification.\n";
+ MessageLoopForUI::current()->Quit();
+ break;
+
default:
NOTREACHED();
break;
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/extensions/extension_dom_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698