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..02a39df9168ef556632c009eea1a236eaec6a83b 100644 |
--- a/chrome/browser/extensions/extension_devtools_browsertests.cc |
+++ b/chrome/browser/extensions/extension_devtools_browsertests.cc |
@@ -27,20 +27,23 @@ using content::DevToolsAgentHost; |
using content::DevToolsAgentHostRegistry; |
using content::DevToolsClientHost; |
using content::DevToolsManager; |
+using content::RenderViewHost; |
using content::WebContents; |
-// Looks for an ExtensionHost whose URL has the given path component (including |
+// Looks for a RenderViewHost 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) { |
- ExtensionHost* host = NULL; |
+static RenderViewHost* FindHostWithPath(ExtensionProcessManager* manager, |
+ const std::string& path, |
+ int expected_hosts) { |
+ RenderViewHost* host = NULL; |
int num_hosts = 0; |
- for (ExtensionProcessManager::const_iterator iter = manager->begin(); |
- iter != manager->end(); ++iter) { |
+ ExtensionProcessManager::ContentsSet all_contents = manager->GetAllContents(); |
+ for (ExtensionProcessManager::ContentsSet::const_iterator iter = |
+ all_contents.begin(); |
+ iter != all_contents.end(); ++iter) { |
if ((*iter)->GetURL().path() == path) { |
EXPECT_FALSE(host); |
- host = *iter; |
+ host = (*iter)->GetRenderViewHost(); |
} |
num_hosts++; |
} |
@@ -57,7 +60,7 @@ 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); |
+ RenderViewHost* host = FindHostWithPath(manager, "/background.html", 1); |
// Grab a handle to the DevToolsManager so we can forward messages to it. |
DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
@@ -72,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) { |
std::wstring register_listeners_js = base::StringPrintf( |
L"setListenersOnTab(%d)", tab_id); |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host->render_view_host(), L"", register_listeners_js, &result)); |
+ host, L"", register_listeners_js, &result)); |
EXPECT_TRUE(result); |
// Setting the events should have caused an ExtensionDevToolsBridge to be |
@@ -88,7 +91,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) { |
devtools_client_host->DispatchOnInspectorFrontend(""); |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host->render_view_host(), L"", L"testReceivePageEvent()", &result)); |
+ host, L"", L"testReceivePageEvent()", &result)); |
EXPECT_TRUE(result); |
// Test onTabClose event. |
@@ -97,7 +100,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) { |
DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
web_contents->GetRenderViewHost())); |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host->render_view_host(), L"", L"testReceiveTabCloseEvent()", &result)); |
+ host, L"", L"testReceiveTabCloseEvent()", &result)); |
EXPECT_TRUE(result); |
} |
@@ -110,12 +113,12 @@ 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); |
+ RenderViewHost* host_one = FindHostWithPath(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); |
+ RenderViewHost* host_two = FindHostWithPath(manager, |
+ "/background_two.html", 2); |
DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
@@ -129,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { |
std::wstring register_listeners_js = base::StringPrintf( |
L"setListenersOnTab(%d)", tab_id); |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host_one->render_view_host(), L"", register_listeners_js, &result)); |
+ host_one, L"", register_listeners_js, &result)); |
EXPECT_TRUE(result); |
// Setting the event listeners should have caused an ExtensionDevToolsBridge |
@@ -142,14 +145,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { |
std::wstring script = base::StringPrintf(L"registerListenersForTab(%d)", |
tab_id); |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host_two->render_view_host(), L"", script, &result)); |
+ host_two, L"", script, &result)); |
EXPECT_TRUE(result); |
// Removing the listeners from the first extension should leave the bridge |
// alive. |
result = false; |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host_one->render_view_host(), L"", L"unregisterListeners()", &result)); |
+ host_one, L"", L"unregisterListeners()", &result)); |
EXPECT_TRUE(result); |
ASSERT_TRUE(devtools_manager->GetDevToolsClientHostFor( |
DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
@@ -159,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { |
// down. |
result = false; |
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- host_two->render_view_host(), L"", L"unregisterListeners()", &result)); |
+ host_two, L"", L"unregisterListeners()", &result)); |
EXPECT_TRUE(result); |
ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( |
DevToolsAgentHostRegistry::GetDevToolsAgentHost( |