Chromium Code Reviews| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" | 
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" | 
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 " break;" | 129 " break;" | 
| 130 " }" | 130 " }" | 
| 131 "}" | 131 "}" | 
| 132 "domAutomationController.send(error);"; | 132 "domAutomationController.send(error);"; | 
| 133 | 133 | 
| 134 InProcessBrowserTest::InProcessBrowserTest() | 134 InProcessBrowserTest::InProcessBrowserTest() | 
| 135 : browser_(NULL), | 135 : browser_(NULL), | 
| 136 exit_when_last_browser_closes_(true), | 136 exit_when_last_browser_closes_(true), | 
| 137 open_about_blank_on_browser_launch_(true), | 137 open_about_blank_on_browser_launch_(true), | 
| 138 multi_desktop_test_(false), | 138 multi_desktop_test_(false), | 
| 139 run_accessibility_checks_for_test_case_(false) | 139 run_accessibility_checks_for_test_case_(false), | 
| 140 enable_component_update_(false) | |
| 140 #if defined(OS_MACOSX) | 141 #if defined(OS_MACOSX) | 
| 141 , autorelease_pool_(NULL) | 142 , | 
| 
 
xhwang
2016/05/20 16:41:22
this is done by git cl format
 
 | |
| 143 autorelease_pool_(NULL) | |
| 142 #endif // OS_MACOSX | 144 #endif // OS_MACOSX | 
| 143 { | 145 { | 
| 144 #if defined(OS_MACOSX) | 146 #if defined(OS_MACOSX) | 
| 145 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. | 147 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. | 
| 146 // Before we run the browser, we have to hack the path to the exe to match | 148 // Before we run the browser, we have to hack the path to the exe to match | 
| 147 // what it would be if Chrome was running, because it is used to fork renderer | 149 // what it would be if Chrome was running, because it is used to fork renderer | 
| 148 // processes, on Linux at least (failure to do so will cause a browser_test to | 150 // processes, on Linux at least (failure to do so will cause a browser_test to | 
| 149 // be run instead of a renderer). | 151 // be run instead of a renderer). | 
| 150 base::FilePath chrome_path; | 152 base::FilePath chrome_path; | 
| 151 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 153 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 
| 152 chrome_path = chrome_path.DirName(); | 154 chrome_path = chrome_path.DirName(); | 
| 153 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 155 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); | 239 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); | 
| 238 | 240 | 
| 239 google_util::SetMockLinkDoctorBaseURLForTesting(); | 241 google_util::SetMockLinkDoctorBaseURLForTesting(); | 
| 240 | 242 | 
| 241 BrowserTestBase::SetUp(); | 243 BrowserTestBase::SetUp(); | 
| 242 } | 244 } | 
| 243 | 245 | 
| 244 void InProcessBrowserTest::PrepareTestCommandLine( | 246 void InProcessBrowserTest::PrepareTestCommandLine( | 
| 245 base::CommandLine* command_line) { | 247 base::CommandLine* command_line) { | 
| 246 // Propagate commandline settings from test_launcher_utils. | 248 // Propagate commandline settings from test_launcher_utils. | 
| 247 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); | 249 test_launcher_utils::PrepareBrowserCommandLineForTests( | 
| 250 command_line, enable_component_update_); | |
| 248 | 251 | 
| 249 // This is a Browser test. | 252 // This is a Browser test. | 
| 250 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); | 253 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); | 
| 251 | 254 | 
| 252 #if defined(OS_MACOSX) | 255 #if defined(OS_MACOSX) | 
| 253 // Explicitly set the path of the binary used for child processes, otherwise | 256 // Explicitly set the path of the binary used for child processes, otherwise | 
| 254 // they'll try to use browser_tests which doesn't contain ChromeMain. | 257 // they'll try to use browser_tests which doesn't contain ChromeMain. | 
| 255 base::FilePath subprocess_path; | 258 base::FilePath subprocess_path; | 
| 256 PathService::Get(base::FILE_EXE, &subprocess_path); | 259 PathService::Get(base::FILE_EXE, &subprocess_path); | 
| 257 // Recreate the real environment, run the helper within the app bundle. | 260 // Recreate the real environment, run the helper within the app bundle. | 
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 // On the Mac, this eventually reaches | 596 // On the Mac, this eventually reaches | 
| 594 // -[BrowserWindowController windowWillClose:], which will post a deferred | 597 // -[BrowserWindowController windowWillClose:], which will post a deferred | 
| 595 // -autorelease on itself to ultimately destroy the Browser object. The line | 598 // -autorelease on itself to ultimately destroy the Browser object. The line | 
| 596 // below is necessary to pump these pending messages to ensure all Browsers | 599 // below is necessary to pump these pending messages to ensure all Browsers | 
| 597 // get deleted. | 600 // get deleted. | 
| 598 content::RunAllPendingInMessageLoop(); | 601 content::RunAllPendingInMessageLoop(); | 
| 599 delete autorelease_pool_; | 602 delete autorelease_pool_; | 
| 600 autorelease_pool_ = NULL; | 603 autorelease_pool_ = NULL; | 
| 601 #endif | 604 #endif | 
| 602 } | 605 } | 
| OLD | NEW |