| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  128     "    error = axs.Audit.createReport(result);" |  128     "    error = axs.Audit.createReport(result);" | 
|  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), |  | 
|  139       run_accessibility_checks_for_test_case_(false) |  138       run_accessibility_checks_for_test_case_(false) | 
|  140 #if defined(OS_MACOSX) |  139 #if defined(OS_MACOSX) | 
|  141       , autorelease_pool_(NULL) |  140       , autorelease_pool_(NULL) | 
|  142 #endif  // OS_MACOSX |  141 #endif  // OS_MACOSX | 
|  143     { |  142     { | 
|  144 #if defined(OS_MACOSX) |  143 #if defined(OS_MACOSX) | 
|  145   // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. |  144   // 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 |  145   // 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 |  146   // 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 |  147   // processes, on Linux at least (failure to do so will cause a browser_test to | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  189  |  188  | 
|  190   // Auto-reload breaks many browser tests, which assume error pages won't be |  189   // Auto-reload breaks many browser tests, which assume error pages won't be | 
|  191   // reloaded out from under them. Tests that expect or desire this behavior can |  190   // reloaded out from under them. Tests that expect or desire this behavior can | 
|  192   // append switches::kEnableOfflineAutoReload, which will override the disable |  191   // append switches::kEnableOfflineAutoReload, which will override the disable | 
|  193   // here. |  192   // here. | 
|  194   command_line->AppendSwitch(switches::kDisableOfflineAutoReload); |  193   command_line->AppendSwitch(switches::kDisableOfflineAutoReload); | 
|  195  |  194  | 
|  196   // Allow subclasses to change the command line before running any tests. |  195   // Allow subclasses to change the command line before running any tests. | 
|  197   SetUpCommandLine(command_line); |  196   SetUpCommandLine(command_line); | 
|  198   // Add command line arguments that are used by all InProcessBrowserTests. |  197   // Add command line arguments that are used by all InProcessBrowserTests. | 
|  199   PrepareTestCommandLine(command_line); |  198   SetUpDefaultCommandLine(command_line); | 
|  200  |  199  | 
|  201   // Create a temporary user data directory if required. |  200   // Create a temporary user data directory if required. | 
|  202   ASSERT_TRUE(CreateUserDataDirectory()) |  201   ASSERT_TRUE(CreateUserDataDirectory()) | 
|  203       << "Could not create user data directory."; |  202       << "Could not create user data directory."; | 
|  204  |  203  | 
|  205   // Allow subclasses the opportunity to make changes to the default user data |  204   // Allow subclasses the opportunity to make changes to the default user data | 
|  206   // dir before running any tests. |  205   // dir before running any tests. | 
|  207   ASSERT_TRUE(SetUpUserDataDirectory()) |  206   ASSERT_TRUE(SetUpUserDataDirectory()) | 
|  208       << "Could not set up user data directory."; |  207       << "Could not set up user data directory."; | 
|  209  |  208  | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|  234 #endif |  233 #endif | 
|  235  |  234  | 
|  236   chrome_browser_net::NetErrorTabHelper::set_state_for_testing( |  235   chrome_browser_net::NetErrorTabHelper::set_state_for_testing( | 
|  237       chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); |  236       chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); | 
|  238  |  237  | 
|  239   google_util::SetMockLinkDoctorBaseURLForTesting(); |  238   google_util::SetMockLinkDoctorBaseURLForTesting(); | 
|  240  |  239  | 
|  241   BrowserTestBase::SetUp(); |  240   BrowserTestBase::SetUp(); | 
|  242 } |  241 } | 
|  243  |  242  | 
|  244 void InProcessBrowserTest::PrepareTestCommandLine( |  243 void InProcessBrowserTest::SetUpDefaultCommandLine( | 
|  245     base::CommandLine* command_line) { |  244     base::CommandLine* command_line) { | 
|  246   // Propagate commandline settings from test_launcher_utils. |  245   // Propagate commandline settings from test_launcher_utils. | 
|  247   test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); |  246   test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); | 
|  248  |  247  | 
|  249   // This is a Browser test. |  248   // This is a Browser test. | 
|  250   command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); |  249   command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); | 
|  251  |  250  | 
|  252 #if defined(OS_MACOSX) |  251 #if defined(OS_MACOSX) | 
|  253   // Explicitly set the path of the binary used for child processes, otherwise |  252   // 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. |  253   // they'll try to use browser_tests which doesn't contain ChromeMain. | 
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  593   // On the Mac, this eventually reaches |  592   // On the Mac, this eventually reaches | 
|  594   // -[BrowserWindowController windowWillClose:], which will post a deferred |  593   // -[BrowserWindowController windowWillClose:], which will post a deferred | 
|  595   // -autorelease on itself to ultimately destroy the Browser object. The line |  594   // -autorelease on itself to ultimately destroy the Browser object. The line | 
|  596   // below is necessary to pump these pending messages to ensure all Browsers |  595   // below is necessary to pump these pending messages to ensure all Browsers | 
|  597   // get deleted. |  596   // get deleted. | 
|  598   content::RunAllPendingInMessageLoop(); |  597   content::RunAllPendingInMessageLoop(); | 
|  599   delete autorelease_pool_; |  598   delete autorelease_pool_; | 
|  600   autorelease_pool_ = NULL; |  599   autorelease_pool_ = NULL; | 
|  601 #endif |  600 #endif | 
|  602 } |  601 } | 
| OLD | NEW |