Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/browser/renderer_host/render_process_host_browsertest.cc

Issue 9114020: Remove task.h and finish base::Bind() migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/process.h" 10 #include "base/process.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/browser/renderer_host/render_process_host_impl.h" 13 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/tab_contents/tab_contents.h" 14 #include "content/browser/tab_contents/tab_contents.h"
14 #include "content/common/test_url_constants.h" 15 #include "content/common/test_url_constants.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 18
(...skipping 12 matching lines...) Expand all
30 count++; 31 count++;
31 hosts.Advance(); 32 hosts.Advance();
32 } 33 }
33 return count; 34 return count;
34 } 35 }
35 36
36 void PostQuit(MessageLoop* loop) { 37 void PostQuit(MessageLoop* loop) {
37 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 38 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
38 } 39 }
39 40
40 void DoNothing() {}
41
42 // Show a tab, activating the current one if there is one, and wait for 41 // 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 42 // the renderer process to be created or foregrounded, returning the process
44 // handle. 43 // handle.
45 base::ProcessHandle RenderProcessHostTest::ShowSingletonTab(const GURL& page) { 44 base::ProcessHandle RenderProcessHostTest::ShowSingletonTab(const GURL& page) {
46 browser()->ShowSingletonTab(page); 45 browser()->ShowSingletonTab(page);
47 WebContents* wc = browser()->GetSelectedWebContents(); 46 WebContents* wc = browser()->GetSelectedWebContents();
48 CHECK(wc->GetURL() == page); 47 CHECK(wc->GetURL() == page);
49 48
50 // Ensure that the backgrounding / foregrounding gets a chance to run. 49 // Ensure that the backgrounding / foregrounding gets a chance to run.
51 content::BrowserThread::PostTaskAndReply( 50 content::BrowserThread::PostTaskAndReply(
52 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, 51 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
53 base::Bind(DoNothing), MessageLoop::QuitClosure()); 52 base::Bind(&base::DoNothing), MessageLoop::QuitClosure());
54 MessageLoop::current()->Run(); 53 MessageLoop::current()->Run();
55 54
56 return wc->GetRenderProcessHost()->GetHandle(); 55 return wc->GetRenderProcessHost()->GetHandle();
57 } 56 }
58 57
59 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { 58 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) {
60 // Set max renderers to 1 to force running out of processes. 59 // Set max renderers to 1 to force running out of processes.
61 content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); 60 content::RenderProcessHost::SetMaxRendererProcessCountForTest(1);
62 61
63 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 62 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 host_count++; 230 host_count++;
232 #endif 231 #endif
233 EXPECT_EQ(tab_count, browser()->tab_count()); 232 EXPECT_EQ(tab_count, browser()->tab_count());
234 tab1 = browser()->GetWebContentsAt(tab_count - 1); 233 tab1 = browser()->GetWebContentsAt(tab_count - 1);
235 rph3 = tab1->GetRenderProcessHost(); 234 rph3 = tab1->GetRenderProcessHost();
236 EXPECT_EQ(tab1->GetURL(), bookmarks); 235 EXPECT_EQ(tab1->GetURL(), bookmarks);
237 EXPECT_EQ(host_count, RenderProcessHostCount()); 236 EXPECT_EQ(host_count, RenderProcessHostCount());
238 EXPECT_NE(rph1, rph3); 237 EXPECT_NE(rph1, rph3);
239 EXPECT_NE(rph2, rph3); 238 EXPECT_NE(rph2, rph3);
240 } 239 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/browser/speech/endpointer/endpointer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698