| 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/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "chrome/browser/after_startup_task_utils.h" | 22 #include "chrome/browser/after_startup_task_utils.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chrome_content_browser_client.h" | 24 #include "chrome/browser/chrome_content_browser_client.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/devtools/devtools_window.h" | 26 #include "chrome/browser/devtools/devtools_window.h" |
| 27 #include "chrome/browser/lifetime/application_lifetime.h" | 27 #include "chrome/browser/lifetime/application_lifetime.h" |
| 28 #include "chrome/browser/lifetime/termination_notification.h" | 28 #include "chrome/browser/lifetime/termination_notification.h" |
| 29 #include "chrome/browser/net/chrome_network_delegate.h" | 29 #include "chrome/browser/net/chrome_network_delegate.h" |
| 30 #include "chrome/browser/net/net_error_tab_helper.h" | 30 #include "chrome/browser/net/net_error_tab_helper.h" |
| 31 #include "chrome/browser/net/predictor.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 33 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_commands.h" | 35 #include "chrome/browser/ui/browser_commands.h" |
| 35 #include "chrome/browser/ui/browser_finder.h" | 36 #include "chrome/browser/ui/browser_finder.h" |
| 36 #include "chrome/browser/ui/browser_list.h" | 37 #include "chrome/browser/ui/browser_list.h" |
| 37 #include "chrome/browser/ui/browser_list_observer.h" | 38 #include "chrome/browser/ui/browser_list_observer.h" |
| 38 #include "chrome/browser/ui/browser_navigator.h" | 39 #include "chrome/browser/ui/browser_navigator.h" |
| 39 #include "chrome/browser/ui/browser_navigator_params.h" | 40 #include "chrome/browser/ui/browser_navigator_params.h" |
| 40 #include "chrome/browser/ui/browser_tabstrip.h" | 41 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 #endif | 185 #endif |
| 185 } | 186 } |
| 186 | 187 |
| 187 InProcessBrowserTest::~InProcessBrowserTest() { | 188 InProcessBrowserTest::~InProcessBrowserTest() { |
| 188 } | 189 } |
| 189 | 190 |
| 190 void InProcessBrowserTest::SetUp() { | 191 void InProcessBrowserTest::SetUp() { |
| 191 // Browser tests will create their own g_browser_process later. | 192 // Browser tests will create their own g_browser_process later. |
| 192 DCHECK(!g_browser_process); | 193 DCHECK(!g_browser_process); |
| 193 | 194 |
| 194 // Clear the FeatureList instance from base/test/test_suite.cc. Since this is | |
| 195 // a browser test, a FeatureList will be registered as part of normal browser | |
| 196 // start up in ChromeBrowserMainParts::SetupMetricsAndFieldTrials(). | |
| 197 base::FeatureList::ClearInstanceForTesting(); | |
| 198 | |
| 199 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 195 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 200 | 196 |
| 201 // Auto-reload breaks many browser tests, which assume error pages won't be | 197 // Auto-reload breaks many browser tests, which assume error pages won't be |
| 202 // reloaded out from under them. Tests that expect or desire this behavior can | 198 // reloaded out from under them. Tests that expect or desire this behavior can |
| 203 // append switches::kEnableOfflineAutoReload, which will override the disable | 199 // append switches::kEnableOfflineAutoReload, which will override the disable |
| 204 // here. | 200 // here. |
| 205 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); | 201 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); |
| 206 | 202 |
| 203 // Turn off preconnects because they break the brittle python webserver; |
| 204 // see http://crbug.com/60035. |
| 205 scoped_feature_list_.InitAndDisableFeature(features::kNetworkPrediction); |
| 206 |
| 207 // Allow subclasses to change the command line before running any tests. | 207 // Allow subclasses to change the command line before running any tests. |
| 208 SetUpCommandLine(command_line); | 208 SetUpCommandLine(command_line); |
| 209 // Add command line arguments that are used by all InProcessBrowserTests. | 209 // Add command line arguments that are used by all InProcessBrowserTests. |
| 210 SetUpDefaultCommandLine(command_line); | 210 SetUpDefaultCommandLine(command_line); |
| 211 | 211 |
| 212 // Create a temporary user data directory if required. | 212 // Create a temporary user data directory if required. |
| 213 ASSERT_TRUE(CreateUserDataDirectory()) | 213 ASSERT_TRUE(CreateUserDataDirectory()) |
| 214 << "Could not create user data directory."; | 214 << "Could not create user data directory."; |
| 215 | 215 |
| 216 // Allow subclasses the opportunity to make changes to the default user data | 216 // Allow subclasses the opportunity to make changes to the default user data |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 // On the Mac, this eventually reaches | 627 // On the Mac, this eventually reaches |
| 628 // -[BrowserWindowController windowWillClose:], which will post a deferred | 628 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 629 // -autorelease on itself to ultimately destroy the Browser object. The line | 629 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 630 // below is necessary to pump these pending messages to ensure all Browsers | 630 // below is necessary to pump these pending messages to ensure all Browsers |
| 631 // get deleted. | 631 // get deleted. |
| 632 content::RunAllPendingInMessageLoop(); | 632 content::RunAllPendingInMessageLoop(); |
| 633 delete autorelease_pool_; | 633 delete autorelease_pool_; |
| 634 autorelease_pool_ = NULL; | 634 autorelease_pool_ = NULL; |
| 635 #endif | 635 #endif |
| 636 } | 636 } |
| OLD | NEW |