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

Side by Side Diff: chrome/test/in_process_browser_test.cc

Issue 3834002: Make all browser code use browser::Navigate to open tabs.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/in_process_browser_test.h" 5 #include "chrome/test/in_process_browser_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/mac/scoped_nsautorelease_pool.h" 10 #include "base/mac/scoped_nsautorelease_pool.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/test/test_file_util.h" 13 #include "base/test/test_file_util.h"
14 #include "chrome/browser/browser.h" 14 #include "chrome/browser/browser.h"
15 #include "chrome/browser/browser_list.h" 15 #include "chrome/browser/browser_list.h"
16 #include "chrome/browser/browser_navigator.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/browser_shutdown.h" 18 #include "chrome/browser/browser_shutdown.h"
18 #include "chrome/browser/browser_thread.h" 19 #include "chrome/browser/browser_thread.h"
19 #include "chrome/browser/browser_window.h" 20 #include "chrome/browser/browser_window.h"
20 #include "chrome/browser/intranet_redirect_detector.h" 21 #include "chrome/browser/intranet_redirect_detector.h"
21 #include "chrome/browser/io_thread.h" 22 #include "chrome/browser/io_thread.h"
22 #include "chrome/browser/net/url_request_mock_util.h" 23 #include "chrome/browser/net/url_request_mock_util.h"
23 #include "chrome/browser/profile.h" 24 #include "chrome/browser/profile.h"
24 #include "chrome/browser/profile_manager.h" 25 #include "chrome/browser/profile_manager.h"
25 #include "chrome/browser/renderer_host/render_process_host.h" 26 #include "chrome/browser/renderer_host/render_process_host.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 browser_shutdown::delete_resources_on_shutdown = true; 263 browser_shutdown::delete_resources_on_shutdown = true;
263 264
264 #if defined(OS_WIN) 265 #if defined(OS_WIN)
265 BrowserView::SetShowState(-1); 266 BrowserView::SetShowState(-1);
266 #endif 267 #endif
267 268
268 *CommandLine::ForCurrentProcessMutable() = *original_command_line_; 269 *CommandLine::ForCurrentProcessMutable() = *original_command_line_;
269 RenderProcessHost::set_run_renderer_in_process(original_single_process_); 270 RenderProcessHost::set_run_renderer_in_process(original_single_process_);
270 } 271 }
271 272
273 void InProcessBrowserTest::AddTabAtIndexToBrowser(
274 Browser* browser,
275 int index,
276 const GURL& url,
277 PageTransition::Type transition) {
278 browser::NavigateParams params(browser, url, transition);
279 params.tabstrip_index = index;
280 params.disposition = NEW_FOREGROUND_TAB;
281 browser::Navigate(&params);
282 }
283
284 void InProcessBrowserTest::AddTabAtIndex(
285 int index,
286 const GURL& url,
287 PageTransition::Type transition) {
288 AddTabAtIndexToBrowser(browser(), index, url, transition);
289 }
290
272 // Creates a browser with a single tab (about:blank), waits for the tab to 291 // Creates a browser with a single tab (about:blank), waits for the tab to
273 // finish loading and shows the browser. 292 // finish loading and shows the browser.
274 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { 293 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
275 Browser* browser = Browser::Create(profile); 294 Browser* browser = Browser::Create(profile);
276 InitializeBrowser(browser); 295 InitializeBrowser(browser);
277 return browser; 296 return browser;
278 } 297 }
279 298
280 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { 299 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) {
281 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); 300 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 return; 360 return;
342 361
343 // Invoke CloseAllBrowsersAndExit on a running message loop. 362 // Invoke CloseAllBrowsersAndExit on a running message loop.
344 // CloseAllBrowsersAndExit exits the message loop after everything has been 363 // CloseAllBrowsersAndExit exits the message loop after everything has been
345 // shut down properly. 364 // shut down properly.
346 MessageLoopForUI::current()->PostTask( 365 MessageLoopForUI::current()->PostTask(
347 FROM_HERE, 366 FROM_HERE,
348 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); 367 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit));
349 ui_test_utils::RunMessageLoop(); 368 ui_test_utils::RunMessageLoop();
350 } 369 }
OLDNEW
« no previous file with comments | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698