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