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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 #endif | 184 #endif |
185 } | 185 } |
186 | 186 |
187 InProcessBrowserTest::~InProcessBrowserTest() { | 187 InProcessBrowserTest::~InProcessBrowserTest() { |
188 } | 188 } |
189 | 189 |
190 void InProcessBrowserTest::SetUp() { | 190 void InProcessBrowserTest::SetUp() { |
191 // Browser tests will create their own g_browser_process later. | 191 // Browser tests will create their own g_browser_process later. |
192 DCHECK(!g_browser_process); | 192 DCHECK(!g_browser_process); |
193 | 193 |
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(); | 194 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
200 | 195 |
201 // Auto-reload breaks many browser tests, which assume error pages won't be | 196 // 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 | 197 // reloaded out from under them. Tests that expect or desire this behavior can |
203 // append switches::kEnableOfflineAutoReload, which will override the disable | 198 // append switches::kEnableOfflineAutoReload, which will override the disable |
204 // here. | 199 // here. |
205 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); | 200 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); |
206 | 201 |
207 // Allow subclasses to change the command line before running any tests. | 202 // Allow subclasses to change the command line before running any tests. |
208 SetUpCommandLine(command_line); | 203 SetUpCommandLine(command_line); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // On the Mac, this eventually reaches | 618 // On the Mac, this eventually reaches |
624 // -[BrowserWindowController windowWillClose:], which will post a deferred | 619 // -[BrowserWindowController windowWillClose:], which will post a deferred |
625 // -autorelease on itself to ultimately destroy the Browser object. The line | 620 // -autorelease on itself to ultimately destroy the Browser object. The line |
626 // below is necessary to pump these pending messages to ensure all Browsers | 621 // below is necessary to pump these pending messages to ensure all Browsers |
627 // get deleted. | 622 // get deleted. |
628 content::RunAllPendingInMessageLoop(); | 623 content::RunAllPendingInMessageLoop(); |
629 delete autorelease_pool_; | 624 delete autorelease_pool_; |
630 autorelease_pool_ = NULL; | 625 autorelease_pool_ = NULL; |
631 #endif | 626 #endif |
632 } | 627 } |
OLD | NEW |