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 "chrome/browser/debugger/devtools_manager.h" | 6 #include "chrome/browser/debugger/devtools_manager.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { | 63 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { |
64 // Set max renderers to 1 to force running out of processes. | 64 // Set max renderers to 1 to force running out of processes. |
65 RenderProcessHost::SetMaxRendererProcessCount(1); | 65 RenderProcessHost::SetMaxRendererProcessCount(1); |
66 | 66 |
67 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 67 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
68 parsed_command_line.AppendSwitch(switches::kProcessPerTab); | 68 parsed_command_line.AppendSwitch(switches::kProcessPerTab); |
69 | 69 |
70 int tab_count = 1; | 70 int tab_count = 1; |
71 int host_count = 1; | 71 int host_count = 1; |
72 | 72 |
| 73 #if defined(TOUCH_UI) |
| 74 ++host_count; // For the touch keyboard. |
| 75 #endif |
| 76 |
73 // Change the first tab to be the new tab page (TYPE_WEBUI). | 77 // Change the first tab to be the new tab page (TYPE_WEBUI). |
74 GURL newtab(chrome::kChromeUINewTabURL); | 78 GURL newtab(chrome::kChromeUINewTabURL); |
75 ui_test_utils::NavigateToURL(browser(), newtab); | 79 ui_test_utils::NavigateToURL(browser(), newtab); |
76 EXPECT_EQ(tab_count, browser()->tab_count()); | 80 EXPECT_EQ(tab_count, browser()->tab_count()); |
77 EXPECT_EQ(host_count, RenderProcessHostCount()); | 81 EXPECT_EQ(host_count, RenderProcessHostCount()); |
78 | 82 |
79 // Create a new TYPE_TABBED tab. It should be in its own process. | 83 // Create a new TYPE_TABBED tab. It should be in its own process. |
80 GURL page1("data:text/html,hello world1"); | 84 GURL page1("data:text/html,hello world1"); |
81 browser()->ShowSingletonTab(page1); | 85 browser()->ShowSingletonTab(page1); |
82 if (browser()->tab_count() == tab_count) | 86 if (browser()->tab_count() == tab_count) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 118 |
115 // Ensure that DevTools opened to debug DevTools is launched in a separate | 119 // Ensure that DevTools opened to debug DevTools is launched in a separate |
116 // process when --process-per-tab is set. See crbug.com/69873. | 120 // process when --process-per-tab is set. See crbug.com/69873. |
117 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcessPPT) { | 121 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcessPPT) { |
118 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 122 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
119 parsed_command_line.AppendSwitch(switches::kProcessPerTab); | 123 parsed_command_line.AppendSwitch(switches::kProcessPerTab); |
120 | 124 |
121 int tab_count = 1; | 125 int tab_count = 1; |
122 int host_count = 1; | 126 int host_count = 1; |
123 | 127 |
| 128 #if defined(TOUCH_UI) |
| 129 ++host_count; // For the touch keyboard. |
| 130 #endif |
| 131 |
124 GURL page1("data:text/html,hello world1"); | 132 GURL page1("data:text/html,hello world1"); |
125 browser()->ShowSingletonTab(page1); | 133 browser()->ShowSingletonTab(page1); |
126 if (browser()->tab_count() == tab_count) | 134 if (browser()->tab_count() == tab_count) |
127 ui_test_utils::WaitForNewTab(browser()); | 135 ui_test_utils::WaitForNewTab(browser()); |
128 tab_count++; | 136 tab_count++; |
129 host_count++; | 137 host_count++; |
130 EXPECT_EQ(tab_count, browser()->tab_count()); | 138 EXPECT_EQ(tab_count, browser()->tab_count()); |
131 EXPECT_EQ(host_count, RenderProcessHostCount()); | 139 EXPECT_EQ(host_count, RenderProcessHostCount()); |
132 | 140 |
133 // DevTools start in docked mode (no new tab), in a separate process. | 141 // DevTools start in docked mode (no new tab), in a separate process. |
(...skipping 12 matching lines...) Expand all Loading... |
146 EXPECT_EQ(tab_count, browser()->tab_count()); | 154 EXPECT_EQ(tab_count, browser()->tab_count()); |
147 EXPECT_EQ(host_count, RenderProcessHostCount()); | 155 EXPECT_EQ(host_count, RenderProcessHostCount()); |
148 } | 156 } |
149 | 157 |
150 // Ensure that DevTools opened to debug DevTools is launched in a separate | 158 // Ensure that DevTools opened to debug DevTools is launched in a separate |
151 // process. See crbug.com/69873. | 159 // process. See crbug.com/69873. |
152 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcess) { | 160 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, DevToolsOnSelfInOwnProcess) { |
153 int tab_count = 1; | 161 int tab_count = 1; |
154 int host_count = 1; | 162 int host_count = 1; |
155 | 163 |
| 164 #if defined(TOUCH_UI) |
| 165 ++host_count; // For the touch keyboard. |
| 166 #endif |
| 167 |
156 GURL page1("data:text/html,hello world1"); | 168 GURL page1("data:text/html,hello world1"); |
157 browser()->ShowSingletonTab(page1); | 169 browser()->ShowSingletonTab(page1); |
158 if (browser()->tab_count() == tab_count) | 170 if (browser()->tab_count() == tab_count) |
159 ui_test_utils::WaitForNewTab(browser()); | 171 ui_test_utils::WaitForNewTab(browser()); |
160 tab_count++; | 172 tab_count++; |
161 host_count++; | 173 host_count++; |
162 EXPECT_EQ(tab_count, browser()->tab_count()); | 174 EXPECT_EQ(tab_count, browser()->tab_count()); |
163 EXPECT_EQ(host_count, RenderProcessHostCount()); | 175 EXPECT_EQ(host_count, RenderProcessHostCount()); |
164 | 176 |
165 // DevTools start in docked mode (no new tab), in a separate process. | 177 // DevTools start in docked mode (no new tab), in a separate process. |
(...skipping 22 matching lines...) Expand all Loading... |
188 RenderProcessHost::SetMaxRendererProcessCount(1); | 200 RenderProcessHost::SetMaxRendererProcessCount(1); |
189 | 201 |
190 int tab_count = 1; | 202 int tab_count = 1; |
191 int host_count = 1; | 203 int host_count = 1; |
192 TabContents* tab1 = NULL; | 204 TabContents* tab1 = NULL; |
193 TabContents* tab2 = NULL; | 205 TabContents* tab2 = NULL; |
194 RenderProcessHost* rph1 = NULL; | 206 RenderProcessHost* rph1 = NULL; |
195 RenderProcessHost* rph2 = NULL; | 207 RenderProcessHost* rph2 = NULL; |
196 RenderProcessHost* rph3 = NULL; | 208 RenderProcessHost* rph3 = NULL; |
197 | 209 |
| 210 #if defined(TOUCH_UI) |
| 211 ++host_count; // For the touch keyboard. |
| 212 #endif |
| 213 |
198 // Change the first tab to be the new tab page (TYPE_WEBUI). | 214 // Change the first tab to be the new tab page (TYPE_WEBUI). |
199 GURL newtab(chrome::kChromeUINewTabURL); | 215 GURL newtab(chrome::kChromeUINewTabURL); |
200 ui_test_utils::NavigateToURL(browser(), newtab); | 216 ui_test_utils::NavigateToURL(browser(), newtab); |
201 EXPECT_EQ(tab_count, browser()->tab_count()); | 217 EXPECT_EQ(tab_count, browser()->tab_count()); |
202 tab1 = browser()->GetTabContentsAt(tab_count - 1); | 218 tab1 = browser()->GetTabContentsAt(tab_count - 1); |
203 rph1 = tab1->GetRenderProcessHost(); | 219 rph1 = tab1->GetRenderProcessHost(); |
204 EXPECT_EQ(tab1->GetURL(), newtab); | 220 EXPECT_EQ(tab1->GetURL(), newtab); |
205 EXPECT_EQ(host_count, RenderProcessHostCount()); | 221 EXPECT_EQ(host_count, RenderProcessHostCount()); |
206 | 222 |
207 // Create a new TYPE_TABBED tab. It should be in its own process. | 223 // Create a new TYPE_TABBED tab. It should be in its own process. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 EXPECT_EQ(host_count, RenderProcessHostCount()); | 261 EXPECT_EQ(host_count, RenderProcessHostCount()); |
246 EXPECT_EQ(tab2->GetRenderProcessHost(), rph1); | 262 EXPECT_EQ(tab2->GetRenderProcessHost(), rph1); |
247 | 263 |
248 // Create a TYPE_EXTENSION tab. It should be in its own process. | 264 // Create a TYPE_EXTENSION tab. It should be in its own process. |
249 // (the bookmark manager is implemented as an extension) | 265 // (the bookmark manager is implemented as an extension) |
250 GURL bookmarks(chrome::kChromeUIBookmarksURL); | 266 GURL bookmarks(chrome::kChromeUIBookmarksURL); |
251 browser()->ShowSingletonTab(bookmarks); | 267 browser()->ShowSingletonTab(bookmarks); |
252 if (browser()->tab_count() == tab_count) | 268 if (browser()->tab_count() == tab_count) |
253 ui_test_utils::WaitForNewTab(browser()); | 269 ui_test_utils::WaitForNewTab(browser()); |
254 tab_count++; | 270 tab_count++; |
| 271 #if !defined(TOUCH_UI) |
| 272 // The keyboard in touchui already creates an extension process. So this |
| 273 // should not increase the process count. |
255 host_count++; | 274 host_count++; |
| 275 #endif |
256 EXPECT_EQ(tab_count, browser()->tab_count()); | 276 EXPECT_EQ(tab_count, browser()->tab_count()); |
257 tab1 = browser()->GetTabContentsAt(tab_count - 1); | 277 tab1 = browser()->GetTabContentsAt(tab_count - 1); |
258 rph3 = tab1->GetRenderProcessHost(); | 278 rph3 = tab1->GetRenderProcessHost(); |
259 EXPECT_EQ(tab1->GetURL(), bookmarks); | 279 EXPECT_EQ(tab1->GetURL(), bookmarks); |
260 EXPECT_EQ(host_count, RenderProcessHostCount()); | 280 EXPECT_EQ(host_count, RenderProcessHostCount()); |
261 EXPECT_NE(rph1, rph3); | 281 EXPECT_NE(rph1, rph3); |
262 EXPECT_NE(rph2, rph3); | 282 EXPECT_NE(rph2, rph3); |
263 } | 283 } |
OLD | NEW |