| 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 window_ = DevToolsWindow::OpenDevToolsWindow(inspected_rvh_); |
| 108 devtools_manager->OpenDevToolsWindow(inspected_rvh_); | |
| 109 | |
| 110 DevToolsClientHost* client_host = | |
| 111 devtools_manager->GetDevToolsClientHostFor(inspected_rvh_); | |
| 112 window_ = client_host->AsDevToolsWindow(); | |
| 113 RenderViewHost* client_rvh = window_->GetRenderViewHost(); | 108 RenderViewHost* client_rvh = window_->GetRenderViewHost(); |
| 114 client_contents_ = client_rvh->delegate()->GetAsTabContents(); | 109 client_contents_ = client_rvh->delegate()->GetAsTabContents(); |
| 115 ui_test_utils::WaitForNavigation(&client_contents_->controller()); | 110 ui_test_utils::WaitForNavigation(&client_contents_->controller()); |
| 116 } | 111 } |
| 117 | 112 |
| 118 TabContents* GetInspectedTab() { | 113 TabContents* GetInspectedTab() { |
| 119 return browser()->GetTabContentsAt(0); | 114 return browser()->GetTabContentsAt(0); |
| 120 } | 115 } |
| 121 | 116 |
| 122 void CloseDevToolsWindow() { | 117 void CloseDevToolsWindow() { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 client_contents_->render_view_host(), | 315 client_contents_->render_view_host(), |
| 321 L"", | 316 L"", |
| 322 L"window.domAutomationController.send(" | 317 L"window.domAutomationController.send(" |
| 323 L"'' + (window.uiTests && (typeof uiTests.runTest)));", | 318 L"'' + (window.uiTests && (typeof uiTests.runTest)));", |
| 324 &result)); | 319 &result)); |
| 325 ASSERT_EQ("function", result) << "DevTools front-end is broken."; | 320 ASSERT_EQ("function", result) << "DevTools front-end is broken."; |
| 326 CloseDevToolsWindow(); | 321 CloseDevToolsWindow(); |
| 327 } | 322 } |
| 328 | 323 |
| 329 } // namespace | 324 } // namespace |
| OLD | NEW |