OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/process.h" | 8 #include "base/process.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 hosts.Advance(); | 37 hosts.Advance(); |
38 } | 38 } |
39 return count; | 39 return count; |
40 } | 40 } |
41 | 41 |
42 // Show a tab, activating the current one if there is one, and wait for | 42 // Show a tab, activating the current one if there is one, and wait for |
43 // the renderer process to be created or foregrounded, returning the process | 43 // the renderer process to be created or foregrounded, returning the process |
44 // handle. | 44 // handle. |
45 base::ProcessHandle ShowSingletonTab(const GURL& page) { | 45 base::ProcessHandle ShowSingletonTab(const GURL& page) { |
46 browser()->ShowSingletonTab(page); | 46 browser()->ShowSingletonTab(page); |
47 WebContents* wc = browser()->GetSelectedWebContents(); | 47 WebContents* wc = browser()->GetActiveWebContents(); |
48 CHECK(wc->GetURL() == page); | 48 CHECK(wc->GetURL() == page); |
49 | 49 |
50 // Ensure that the backgrounding / foregrounding gets a chance to run. | 50 // Ensure that the backgrounding / foregrounding gets a chance to run. |
51 content::BrowserThread::PostTaskAndReply( | 51 content::BrowserThread::PostTaskAndReply( |
52 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 52 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
53 base::Bind(&base::DoNothing), MessageLoop::QuitClosure()); | 53 base::Bind(&base::DoNothing), MessageLoop::QuitClosure()); |
54 MessageLoop::current()->Run(); | 54 MessageLoop::current()->Run(); |
55 | 55 |
56 return wc->GetRenderProcessHost()->GetHandle(); | 56 return wc->GetRenderProcessHost()->GetHandle(); |
57 } | 57 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Set max renderers to 1 to force running out of processes. | 238 // Set max renderers to 1 to force running out of processes. |
239 content::RenderProcessHost::SetMaxRendererProcessCount(1); | 239 content::RenderProcessHost::SetMaxRendererProcessCount(1); |
240 TestProcessOverflow(); | 240 TestProcessOverflow(); |
241 } | 241 } |
242 | 242 |
243 // Variation of the ProcessOverflow test, which is driven through command line | 243 // Variation of the ProcessOverflow test, which is driven through command line |
244 // parameter instead of direct function call into the class. | 244 // parameter instead of direct function call into the class. |
245 IN_PROC_BROWSER_TEST_F(RenderProcessHostTestWithCommandLine, ProcessOverflow) { | 245 IN_PROC_BROWSER_TEST_F(RenderProcessHostTestWithCommandLine, ProcessOverflow) { |
246 TestProcessOverflow(); | 246 TestProcessOverflow(); |
247 } | 247 } |
OLD | NEW |