| 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 "content/browser/renderer_host/render_process_host_browsertest.h" | 5 #include "content/browser/renderer_host/render_process_host_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/test/ui_test_utils.h" | 11 #include "chrome/test/ui_test_utils.h" |
| 12 #include "content/browser/debugger/devtools_manager.h" | 12 #include "content/browser/debugger/devtools_window.h" |
| 13 #include "content/browser/renderer_host/render_process_host.h" | 13 #include "content/browser/renderer_host/render_process_host.h" |
| 14 #include "content/browser/renderer_host/render_view_host.h" | 14 #include "content/browser/renderer_host/render_view_host.h" |
| 15 #include "content/browser/renderer_host/render_view_host_delegate.h" | 15 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 RenderViewHost* FindFirstDevToolsHost() { | 19 RenderViewHost* FindFirstDevToolsHost() { |
| 20 RenderProcessHost::iterator hosts = RenderProcessHost::AllHostsIterator(); | 20 RenderProcessHost::iterator hosts = RenderProcessHost::AllHostsIterator(); |
| 21 for (; !hosts.IsAtEnd(); hosts.Advance()) { | 21 for (; !hosts.IsAtEnd(); hosts.Advance()) { |
| 22 RenderProcessHost* render_process_host = hosts.GetCurrentValue(); | 22 RenderProcessHost* render_process_host = hosts.GetCurrentValue(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // DevTools start in docked mode (no new tab), in a separate process. | 69 // DevTools start in docked mode (no new tab), in a separate process. |
| 70 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); | 70 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); |
| 71 host_count++; | 71 host_count++; |
| 72 EXPECT_EQ(tab_count, browser()->tab_count()); | 72 EXPECT_EQ(tab_count, browser()->tab_count()); |
| 73 EXPECT_EQ(host_count, RenderProcessHostCount()); | 73 EXPECT_EQ(host_count, RenderProcessHostCount()); |
| 74 | 74 |
| 75 RenderViewHost* devtools = FindFirstDevToolsHost(); | 75 RenderViewHost* devtools = FindFirstDevToolsHost(); |
| 76 DCHECK(devtools); | 76 DCHECK(devtools); |
| 77 | 77 |
| 78 // DevTools start in a separate process. | 78 // DevTools start in a separate process. |
| 79 DevToolsManager::GetInstance()->ToggleDevToolsWindow( | 79 DevToolsWindow::ToggleDevToolsWindow( |
| 80 devtools, DEVTOOLS_TOGGLE_ACTION_INSPECT); | 80 devtools, DEVTOOLS_TOGGLE_ACTION_INSPECT); |
| 81 host_count++; | 81 host_count++; |
| 82 EXPECT_EQ(tab_count, browser()->tab_count()); | 82 EXPECT_EQ(tab_count, browser()->tab_count()); |
| 83 EXPECT_EQ(host_count, RenderProcessHostCount()); | 83 EXPECT_EQ(host_count, RenderProcessHostCount()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Ensure that DevTools opened to debug DevTools is launched in a separate | 86 // Ensure that DevTools opened to debug DevTools is launched in a separate |
| 87 // process. See crbug.com/69873. | 87 // process. See crbug.com/69873. |
| 88 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcess) { | 88 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcess) { |
| 89 int tab_count = 1; | 89 int tab_count = 1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 105 // DevTools start in docked mode (no new tab), in a separate process. | 105 // DevTools start in docked mode (no new tab), in a separate process. |
| 106 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); | 106 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); |
| 107 host_count++; | 107 host_count++; |
| 108 EXPECT_EQ(tab_count, browser()->tab_count()); | 108 EXPECT_EQ(tab_count, browser()->tab_count()); |
| 109 EXPECT_EQ(host_count, RenderProcessHostCount()); | 109 EXPECT_EQ(host_count, RenderProcessHostCount()); |
| 110 | 110 |
| 111 RenderViewHost* devtools = FindFirstDevToolsHost(); | 111 RenderViewHost* devtools = FindFirstDevToolsHost(); |
| 112 DCHECK(devtools); | 112 DCHECK(devtools); |
| 113 | 113 |
| 114 // DevTools start in a separate process. | 114 // DevTools start in a separate process. |
| 115 DevToolsManager::GetInstance()->ToggleDevToolsWindow( | 115 DevToolsWindow::ToggleDevToolsWindow( |
| 116 devtools, DEVTOOLS_TOGGLE_ACTION_INSPECT); | 116 devtools, DEVTOOLS_TOGGLE_ACTION_INSPECT); |
| 117 host_count++; | 117 host_count++; |
| 118 EXPECT_EQ(tab_count, browser()->tab_count()); | 118 EXPECT_EQ(tab_count, browser()->tab_count()); |
| 119 EXPECT_EQ(host_count, RenderProcessHostCount()); | 119 EXPECT_EQ(host_count, RenderProcessHostCount()); |
| 120 } | 120 } |
| OLD | NEW |