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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/test/test_file_util.h" | 15 #include "base/test/test_file_util.h" |
| 16 #include "base/test/test_switches.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/io_thread.h" | 18 #include "chrome/browser/io_thread.h" |
18 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
23 #include "chrome/browser/ui/browser_navigator.h" | 24 #include "chrome/browser/ui/browser_navigator.h" |
24 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 291 |
291 browser->window()->Show(); | 292 browser->window()->Show(); |
292 } | 293 } |
293 | 294 |
294 #if !defined(OS_MACOSX) | 295 #if !defined(OS_MACOSX) |
295 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { | 296 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { |
296 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); | 297 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); |
297 CommandLine::SwitchMap switches = | 298 CommandLine::SwitchMap switches = |
298 CommandLine::ForCurrentProcess()->GetSwitches(); | 299 CommandLine::ForCurrentProcess()->GetSwitches(); |
299 switches.erase(switches::kUserDataDir); | 300 switches.erase(switches::kUserDataDir); |
300 switches.erase(test_launcher::kSingleProcessTestsFlag); | 301 switches.erase(switches::kSingleProcessTestsFlag); |
301 switches.erase(test_launcher::kSingleProcessTestsAndChromeFlag); | 302 switches.erase(switches::kSingleProcessChromeFlag); |
302 new_command_line.AppendSwitch(ChromeTestSuite::kLaunchAsBrowser); | 303 new_command_line.AppendSwitch(ChromeTestSuite::kLaunchAsBrowser); |
303 | 304 |
304 #if defined(USE_AURA) | 305 #if defined(USE_AURA) |
305 // Copy what UITestBase::SetLaunchSwitches() does, and also what | 306 // Copy what UITestBase::SetLaunchSwitches() does, and also what |
306 // ChromeTestSuite does if the process had went into the test path. Otherwise | 307 // ChromeTestSuite does if the process had went into the test path. Otherwise |
307 // tests will fail on bots. | 308 // tests will fail on bots. |
308 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 309 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
309 switches::kDisableTestCompositor)) { | 310 switches::kDisableTestCompositor)) { |
310 new_command_line.AppendSwitch(switches::kTestCompositor); | 311 new_command_line.AppendSwitch(switches::kTestCompositor); |
311 } | 312 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // On the Mac, this eventually reaches | 397 // On the Mac, this eventually reaches |
397 // -[BrowserWindowController windowWillClose:], which will post a deferred | 398 // -[BrowserWindowController windowWillClose:], which will post a deferred |
398 // -autorelease on itself to ultimately destroy the Browser object. The line | 399 // -autorelease on itself to ultimately destroy the Browser object. The line |
399 // below is necessary to pump these pending messages to ensure all Browsers | 400 // below is necessary to pump these pending messages to ensure all Browsers |
400 // get deleted. | 401 // get deleted. |
401 ui_test_utils::RunAllPendingInMessageLoop(); | 402 ui_test_utils::RunAllPendingInMessageLoop(); |
402 delete autorelease_pool_; | 403 delete autorelease_pool_; |
403 autorelease_pool_ = NULL; | 404 autorelease_pool_ = NULL; |
404 #endif | 405 #endif |
405 } | 406 } |
OLD | NEW |