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 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/ui/browser_commands.h" | 34 #include "chrome/browser/ui/browser_commands.h" |
35 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
36 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
37 #include "chrome/browser/ui/browser_list_observer.h" | 37 #include "chrome/browser/ui/browser_list_observer.h" |
38 #include "chrome/browser/ui/browser_navigator.h" | 38 #include "chrome/browser/ui/browser_navigator.h" |
39 #include "chrome/browser/ui/browser_navigator_params.h" | 39 #include "chrome/browser/ui/browser_navigator_params.h" |
40 #include "chrome/browser/ui/browser_tabstrip.h" | 40 #include "chrome/browser/ui/browser_tabstrip.h" |
41 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
42 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 42 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
43 #include "chrome/common/chrome_constants.h" | 43 #include "chrome/common/chrome_constants.h" |
| 44 #include "chrome/common/chrome_features.h" |
44 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
46 #include "chrome/common/features.h" | 47 #include "chrome/common/features.h" |
47 #include "chrome/common/logging_chrome.h" | 48 #include "chrome/common/logging_chrome.h" |
48 #include "chrome/common/url_constants.h" | 49 #include "chrome/common/url_constants.h" |
49 #include "chrome/renderer/chrome_content_renderer_client.h" | 50 #include "chrome/renderer/chrome_content_renderer_client.h" |
50 #include "chrome/test/base/chrome_test_suite.h" | 51 #include "chrome/test/base/chrome_test_suite.h" |
51 #include "chrome/test/base/test_launcher_utils.h" | 52 #include "chrome/test/base/test_launcher_utils.h" |
52 #include "chrome/test/base/testing_browser_process.h" | 53 #include "chrome/test/base/testing_browser_process.h" |
53 #include "components/google/core/browser/google_util.h" | 54 #include "components/google/core/browser/google_util.h" |
(...skipping 130 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 |