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

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

Issue 10113005: Remove EPM:all_hosts_ and use all_extension_views_ instead. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments addressed Created 8 years, 8 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
Index: chrome/browser/extensions/extension_devtools_browsertests.cc
diff --git a/chrome/browser/extensions/extension_devtools_browsertests.cc b/chrome/browser/extensions/extension_devtools_browsertests.cc
index a8759f7c57d62cce7b5611d8fd5a59ed3fe47fd8..e31ae8e16095019d690a8b960fc2b54672456cb0 100644
--- a/chrome/browser/extensions/extension_devtools_browsertests.cc
+++ b/chrome/browser/extensions/extension_devtools_browsertests.cc
@@ -29,15 +29,19 @@ using content::DevToolsClientHost;
using content::DevToolsManager;
using content::WebContents;
-// Looks for an ExtensionHost whose URL has the given path component (including
-// leading slash). Also verifies that the expected number of hosts are loaded.
-static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager,
- const std::string& path,
- int expected_hosts) {
+// Looks for an background ExtensionHost whose URL has the given path component
Charlie Reis 2012/04/25 00:04:13 nit: a background
+// (including leading slash). Also verifies that the expected number of hosts
+// are loaded.
+static ExtensionHost* FindBackgroundHostWithPath(
+ ExtensionProcessManager* manager,
+ const std::string& path,
+ int expected_hosts) {
ExtensionHost* host = NULL;
int num_hosts = 0;
- for (ExtensionProcessManager::const_iterator iter = manager->begin();
- iter != manager->end(); ++iter) {
+ ExtensionProcessManager::ExtensionHostSet background_hosts =
+ manager->background_hosts();
+ for (ExtensionProcessManager::const_iterator iter = background_hosts.begin();
+ iter != background_hosts.end(); ++iter) {
if ((*iter)->GetURL().path() == path) {
EXPECT_FALSE(host);
host = *iter;
@@ -57,7 +61,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) {
// Get the ExtensionHost that is hosting our background page.
ExtensionProcessManager* manager =
browser()->profile()->GetExtensionProcessManager();
- ExtensionHost* host = FindHostWithPath(manager, "/background.html", 1);
+ ExtensionHost* host = FindBackgroundHostWithPath(manager,
+ "/background.html", 1);
// Grab a handle to the DevToolsManager so we can forward messages to it.
DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
@@ -110,12 +115,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) {
// Get the ExtensionHost that is hosting our background page.
ExtensionProcessManager* manager =
browser()->profile()->GetExtensionProcessManager();
- ExtensionHost* host_one = FindHostWithPath(manager, "/background.html", 1);
+ ExtensionHost* host_one = FindBackgroundHostWithPath(manager,
+ "/background.html", 1);
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api_two")));
- ExtensionHost* host_two = FindHostWithPath(manager,
- "/background_two.html", 2);
+ ExtensionHost* host_two = FindBackgroundHostWithPath(manager,
+ "/background_two.html",
+ 2);
DevToolsManager* devtools_manager = DevToolsManager::GetInstance();

Powered by Google App Engine
This is Rietveld 408576698