summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_browsertest.cc
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-26 00:47:32 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-26 00:47:32 +0000
commitd1fe13594173c936db2383800499c3efb9ec693a (patch)
treed617e05aa46bb1a00af37cb00c34dec6ade4cad4 /chrome/browser/extensions/extension_browsertest.cc
parentabb842afad202c45897453ccc2370d1211935438 (diff)
downloadchromium_src-d1fe13594173c936db2383800499c3efb9ec693a.zip
chromium_src-d1fe13594173c936db2383800499c3efb9ec693a.tar.gz
chromium_src-d1fe13594173c936db2383800499c3efb9ec693a.tar.bz2
Remove EPM:all_hosts_ and use all_extension_views_ instead.
EPM:all_hosts_ is used to look for extension render view hosts, under the assumption it has all of them. This assumption is wrong, and the name is confusing, so we're removing all_hosts_. A different container can be used: all_extension_views, which contains all the RenderViewHosts for extensions. BUG=102617 TEST=Covered by existing tests Review URL: http://codereview.chromium.org/10113005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_browsertest.cc')
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc35
1 files changed, 19 insertions, 16 deletions
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index f8358fa..a75649e 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_creator.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
-#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
@@ -31,6 +30,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/render_view_host.h"
ExtensionBrowserTest::ExtensionBrowserTest()
: loaded_(false),
@@ -134,7 +134,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithOptions(
}
}
- if (!WaitForExtensionHostsToLoad())
+ if (!WaitForExtensionViewsToLoad())
return NULL;
return extension;
@@ -330,7 +330,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension(
return NULL;
}
- if (!WaitForExtensionHostsToLoad())
+ if (!WaitForExtensionViewsToLoad())
return NULL;
return service->GetExtensionById(last_loaded_extension_id_, false);
}
@@ -387,17 +387,19 @@ bool ExtensionBrowserTest::WaitForPageActionVisibilityChangeTo(int count) {
return location_bar->PageActionVisibleCount() == count;
}
-bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() {
- // Wait for all the extension hosts that exist to finish loading.
+bool ExtensionBrowserTest::WaitForExtensionViewsToLoad() {
+ // Wait for all the extension render view hosts that exist to finish loading.
content::NotificationRegistrar registrar;
- registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
+ registrar.Add(this, content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
ExtensionProcessManager* manager =
browser()->profile()->GetExtensionProcessManager();
- for (ExtensionProcessManager::const_iterator iter = manager->begin();
- iter != manager->end();) {
- if ((*iter)->did_stop_loading()) {
+ ExtensionProcessManager::ViewSet all_views = manager->GetAllViews();
+ for (ExtensionProcessManager::ViewSet::const_iterator iter =
+ all_views.begin();
+ iter != all_views.end();) {
+ if (!(*iter)->IsLoading()) {
++iter;
} else {
ui_test_utils::RunMessageLoop();
@@ -405,7 +407,8 @@ bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() {
// Test activity may have modified the set of extension processes during
// message processing, so re-start the iteration to catch added/removed
// processes.
- iter = manager->begin();
+ all_views = manager->GetAllViews();
+ iter = all_views.begin();
}
}
return true;
@@ -430,7 +433,7 @@ bool ExtensionBrowserTest::WaitForExtensionInstallError() {
void ExtensionBrowserTest::WaitForExtensionLoad() {
ui_test_utils::RegisterAndWait(this, chrome::NOTIFICATION_EXTENSION_LOADED,
content::NotificationService::AllSources());
- WaitForExtensionHostsToLoad();
+ WaitForExtensionViewsToLoad();
}
bool ExtensionBrowserTest::WaitForExtensionLoadError() {
@@ -480,11 +483,6 @@ void ExtensionBrowserTest::Observe(
MessageLoopForUI::current()->Quit();
break;
- case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING:
- VLOG(1) << "Got EXTENSION_HOST_DID_STOP_LOADING notification.";
- MessageLoopForUI::current()->Quit();
- break;
-
case chrome::NOTIFICATION_EXTENSION_INSTALLED:
VLOG(1) << "Got EXTENSION_INSTALLED notification.";
++extension_installs_observed_;
@@ -534,6 +532,11 @@ void ExtensionBrowserTest::Observe(
break;
}
+ case content::NOTIFICATION_LOAD_STOP:
+ VLOG(1) << "Got LOAD_STOP notification.";
+ MessageLoopForUI::current()->Quit();
+ break;
+
default:
NOTREACHED();
break;