| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 CloseDevToolsWindow(); | 98 CloseDevToolsWindow(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void OpenDevToolsWindow(const std::string& test_page) { | 101 void OpenDevToolsWindow(const std::string& test_page) { |
| 102 ASSERT_TRUE(test_server()->Start()); | 102 ASSERT_TRUE(test_server()->Start()); |
| 103 GURL url = test_server()->GetURL(test_page); | 103 GURL url = test_server()->GetURL(test_page); |
| 104 ui_test_utils::NavigateToURL(browser(), url); | 104 ui_test_utils::NavigateToURL(browser(), url); |
| 105 | 105 |
| 106 inspected_rvh_ = GetInspectedTab()->render_view_host(); | 106 inspected_rvh_ = GetInspectedTab()->render_view_host(); |
| 107 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 107 DevToolsWindow::OpenDevToolsWindow(inspected_rvh_); |
| 108 devtools_manager->OpenDevToolsWindow(inspected_rvh_); | |
| 109 | 108 |
| 110 DevToolsClientHost* client_host = | 109 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> |
| 111 devtools_manager->GetDevToolsClientHostFor(inspected_rvh_); | 110 GetDevToolsClientHostFor(inspected_rvh_); |
| 112 window_ = client_host->AsDevToolsWindow(); | 111 window_ = static_cast<DevToolsWindow*>(client_host); |
| 113 RenderViewHost* client_rvh = window_->GetRenderViewHost(); | 112 RenderViewHost* client_rvh = window_->GetRenderViewHost(); |
| 114 client_contents_ = client_rvh->delegate()->GetAsTabContents(); | 113 client_contents_ = client_rvh->delegate()->GetAsTabContents(); |
| 115 ui_test_utils::WaitForNavigation(&client_contents_->controller()); | 114 ui_test_utils::WaitForNavigation(&client_contents_->controller()); |
| 116 } | 115 } |
| 117 | 116 |
| 118 TabContents* GetInspectedTab() { | 117 TabContents* GetInspectedTab() { |
| 119 return browser()->GetTabContentsAt(0); | 118 return browser()->GetTabContentsAt(0); |
| 120 } | 119 } |
| 121 | 120 |
| 122 void CloseDevToolsWindow() { | 121 void CloseDevToolsWindow() { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 client_contents_->render_view_host(), | 319 client_contents_->render_view_host(), |
| 321 L"", | 320 L"", |
| 322 L"window.domAutomationController.send(" | 321 L"window.domAutomationController.send(" |
| 323 L"'' + (window.uiTests && (typeof uiTests.runTest)));", | 322 L"'' + (window.uiTests && (typeof uiTests.runTest)));", |
| 324 &result)); | 323 &result)); |
| 325 ASSERT_EQ("function", result) << "DevTools front-end is broken."; | 324 ASSERT_EQ("function", result) << "DevTools front-end is broken."; |
| 326 CloseDevToolsWindow(); | 325 CloseDevToolsWindow(); |
| 327 } | 326 } |
| 328 | 327 |
| 329 } // namespace | 328 } // namespace |
| OLD | NEW |