| Index: chrome/browser/devtools/devtools_sanity_browsertest.cc
|
| diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
|
| index d75c2da2a40f091835d63f02f4fec521ac1a6101..b31af09f96e04dc7ebf781e3f38da2742e20a345 100644
|
| --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
|
| +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
|
| @@ -89,14 +89,14 @@ void RunTestFunction(DevToolsWindow* window, const char* test_name) {
|
| // files have been loaded) and has runTest method.
|
| ASSERT_TRUE(
|
| content::ExecuteScriptAndExtractString(
|
| - window->web_contents()->GetRenderViewHost(),
|
| + window->web_contents_for_test()->GetRenderViewHost(),
|
| "window.domAutomationController.send("
|
| " '' + (window.uiTests && (typeof uiTests.runTest)));",
|
| &result));
|
|
|
| ASSERT_EQ("function", result) << "DevTools front-end is broken.";
|
| ASSERT_TRUE(content::ExecuteScriptAndExtractString(
|
| - window->web_contents()->GetRenderViewHost(),
|
| + window->web_contents_for_test()->GetRenderViewHost(),
|
| base::StringPrintf("uiTests.runTest('%s')", test_name),
|
| &result));
|
| EXPECT_EQ("[OK]", result);
|
| @@ -139,7 +139,8 @@ class DevToolsSanityTest : public InProcessBrowserTest {
|
| void ToggleDevToolsWindow() {
|
| content::WindowedNotificationObserver close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - content::Source<content::WebContents>(window_->web_contents()));
|
| + content::Source<content::WebContents>(
|
| + window_->web_contents_for_test()));
|
| DevToolsWindow::ToggleDevToolsWindow(inspected_rvh_, false,
|
| DevToolsToggleAction::Toggle());
|
| close_observer.Wait();
|
| @@ -154,7 +155,8 @@ class DevToolsSanityTest : public InProcessBrowserTest {
|
| DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
|
| content::WindowedNotificationObserver close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - content::Source<content::WebContents>(window_->web_contents()));
|
| + content::Source<content::WebContents>(
|
| + window_->web_contents_for_test()));
|
| devtools_manager->CloseAllClientHosts();
|
| close_observer.Wait();
|
| }
|
| @@ -180,7 +182,7 @@ class DevToolsWindowBeforeUnloadObserver
|
|
|
| DevToolsWindowBeforeUnloadObserver::DevToolsWindowBeforeUnloadObserver(
|
| DevToolsWindow* devtools_window)
|
| - : WebContentsObserver(devtools_window->web_contents()),
|
| + : WebContentsObserver(devtools_window->web_contents_for_test()),
|
| m_fired(false) {
|
| }
|
|
|
| @@ -215,7 +217,7 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
|
| }
|
|
|
| void CloseUndockedDevTools() {
|
| - chrome::CloseWindow(window_->browser());
|
| + chrome::CloseWindow(window_->browser_for_test());
|
| }
|
|
|
| void CloseInspectedBrowser() {
|
| @@ -234,8 +236,9 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
|
| OpenDevToolsWindow(kDebuggerTestPage, is_docked);
|
| content::WindowedNotificationObserver devtools_close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - content::Source<content::WebContents>(window_->web_contents()));
|
| - InjectBeforeUnloadListener(window_->web_contents());
|
| + content::Source<content::WebContents>(
|
| + window_->web_contents_for_test()));
|
| + InjectBeforeUnloadListener(window_->web_contents_for_test());
|
| {
|
| DevToolsWindowBeforeUnloadObserver before_unload_observer(window_);
|
| close_method.Run();
|
| @@ -267,7 +270,7 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
|
| content::NOTIFICATION_LOAD_STOP,
|
| content::NotificationService::AllSources());
|
| ASSERT_TRUE(content::ExecuteScript(
|
| - devtools_window->web_contents()->GetRenderViewHost(),
|
| + devtools_window->web_contents_for_test()->GetRenderViewHost(),
|
| "window.open(\"\", \"\", \"location=0\");"));
|
| observer.Wait();
|
| }
|
| @@ -278,7 +281,7 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
|
| if (it->is_devtools()) {
|
| content::WebContents* contents =
|
| it->tab_strip_model()->GetWebContentsAt(0);
|
| - if (devtools_window->web_contents() != contents) {
|
| + if (devtools_window->web_contents_for_test() != contents) {
|
| popup_browser = *it;
|
| break;
|
| }
|
| @@ -539,16 +542,15 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest {
|
| worker_data->worker_process_id,
|
| worker_data->worker_route_id));
|
| window_ = DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host);
|
| - RenderViewHost* client_rvh = window_->web_contents()->GetRenderViewHost();
|
| - WebContents* client_contents = WebContents::FromRenderViewHost(client_rvh);
|
| - content::WaitForLoadStop(client_contents);
|
| + content::WaitForLoadStop(window_->web_contents_for_test());
|
| }
|
|
|
| void CloseDevToolsWindow() {
|
| - Browser* browser = window_->browser();
|
| + Browser* browser = window_->browser_for_test();
|
| content::WindowedNotificationObserver close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - content::Source<content::WebContents>(window_->web_contents()));
|
| + content::Source<content::WebContents>(
|
| + window_->web_contents_for_test()));
|
| browser->tab_strip_model()->CloseAllTabs();
|
| close_observer.Wait();
|
| }
|
| @@ -622,10 +624,10 @@ IN_PROC_BROWSER_TEST_F(DevToolsUnresponsiveBeforeUnloadTest,
|
| content::WindowedNotificationObserver devtools_close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<content::WebContents>(
|
| - devtools_window->web_contents()));
|
| + devtools_window->web_contents_for_test()));
|
|
|
| ASSERT_TRUE(content::ExecuteScript(
|
| - devtools_window->web_contents()->GetRenderViewHost(),
|
| + devtools_window->web_contents_for_test()->GetRenderViewHost(),
|
| "window.addEventListener('beforeunload',"
|
| "function(event) { while (true); });"));
|
| CloseInspectedTab();
|
| @@ -643,7 +645,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
|
| content::WindowedNotificationObserver devtools_close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<content::WebContents>(
|
| - devtools_window->web_contents()));
|
| + devtools_window->web_contents_for_test()));
|
|
|
| OpenDevToolsPopupWindow(devtools_window);
|
| CloseDevToolsPopupWindow(devtools_window);
|
| @@ -667,19 +669,19 @@ IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
|
| new content::WindowedNotificationObserver(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<content::WebContents>(
|
| - devtools_window->web_contents()));
|
| + devtools_window->web_contents_for_test()));
|
| close_observers.push_back(close_observer);
|
| - inspected_web_contents = devtools_window->web_contents();
|
| + inspected_web_contents = devtools_window->web_contents_for_test();
|
| }
|
|
|
| - InjectBeforeUnloadListener(windows[0]->web_contents());
|
| - InjectBeforeUnloadListener(windows[2]->web_contents());
|
| + InjectBeforeUnloadListener(windows[0]->web_contents_for_test());
|
| + InjectBeforeUnloadListener(windows[2]->web_contents_for_test());
|
| // Try to close second devtools.
|
| {
|
| content::WindowedNotificationObserver cancel_browser(
|
| chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
|
| content::NotificationService::AllSources());
|
| - chrome::CloseWindow(windows[1]->browser());
|
| + chrome::CloseWindow(windows[1]->browser_for_test());
|
| CancelModalDialog();
|
| cancel_browser.Wait();
|
| }
|
| @@ -856,16 +858,16 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) {
|
| // Right now notifications happen after observers, so DevTools window is
|
| // already loaded, but we still catch it's notification when looking for
|
| // all sources.
|
| - content::WaitForLoadStop(window_->web_contents());
|
| + content::WaitForLoadStop(window_->web_contents_for_test());
|
| content::WindowedNotificationObserver observer(
|
| content::NOTIFICATION_LOAD_STOP,
|
| content::NotificationService::AllSources());
|
| ASSERT_TRUE(content::ExecuteScript(
|
| - window_->web_contents(),
|
| + window_->web_contents_for_test(),
|
| std::string("window.location = \"") + url.spec() + "\""));
|
| observer.Wait();
|
|
|
| - ASSERT_TRUE(window_->web_contents()->GetURL().
|
| + ASSERT_TRUE(window_->web_contents_for_test()->GetURL().
|
| SchemeIs(content::kChromeDevToolsScheme));
|
| ASSERT_EQ(url, GetInspectedTab()->GetURL());
|
| CloseDevToolsWindow();
|
| @@ -882,7 +884,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPageWithNoJavaScript) {
|
| std::string result;
|
| ASSERT_TRUE(
|
| content::ExecuteScriptAndExtractString(
|
| - window_->web_contents()->GetRenderViewHost(),
|
| + window_->web_contents_for_test()->GetRenderViewHost(),
|
| "window.domAutomationController.send("
|
| " '' + (window.uiTests && (typeof uiTests.runTest)));",
|
| &result));
|
|
|