Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/test/base/in_process_browser_test.cc

Issue 10795038: Enable captive portal detection by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Missed the browser_tests Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/test/test_file_util.h" 15 #include "base/test/test_file_util.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/captive_portal/captive_portal_service.h"
17 #include "chrome/browser/io_thread.h" 18 #include "chrome/browser/io_thread.h"
18 #include "chrome/browser/lifetime/application_lifetime.h" 19 #include "chrome/browser/lifetime/application_lifetime.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/browser/ui/browser_navigator.h" 24 #include "chrome/browser/ui/browser_navigator.h"
24 #include "chrome/browser/ui/browser_tabstrip.h" 25 #include "chrome/browser/ui/browser_tabstrip.h"
25 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 #if defined(OS_MACOSX) 139 #if defined(OS_MACOSX)
139 // On Mac, without the following autorelease pool, code which is directly 140 // On Mac, without the following autorelease pool, code which is directly
140 // executed (as opposed to executed inside a message loop) would autorelease 141 // executed (as opposed to executed inside a message loop) would autorelease
141 // objects into a higher-level pool. This pool is not recycled in-sync with 142 // objects into a higher-level pool. This pool is not recycled in-sync with
142 // the message loops' pools and causes problems with code relying on 143 // the message loops' pools and causes problems with code relying on
143 // deallocation via an autorelease pool (such as browser window closure and 144 // deallocation via an autorelease pool (such as browser window closure and
144 // browser shutdown). To avoid this, the following pool is recycled after each 145 // browser shutdown). To avoid this, the following pool is recycled after each
145 // time code is directly executed. 146 // time code is directly executed.
146 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; 147 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool;
147 #endif 148 #endif
149
150 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
151 captive_portal::CaptivePortalService::set_is_disabled_for_testing(true);
152 #endif
153
148 BrowserTestBase::SetUp(); 154 BrowserTestBase::SetUp();
149 } 155 }
150 156
151 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { 157 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
152 // Propagate commandline settings from test_launcher_utils. 158 // Propagate commandline settings from test_launcher_utils.
153 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); 159 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
154 160
155 // This is a Browser test. 161 // This is a Browser test.
156 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); 162 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);
157 163
(...skipping 10 matching lines...) Expand all
168 subprocess_path = 174 subprocess_path =
169 subprocess_path.Append(chrome::kHelperProcessExecutablePath); 175 subprocess_path.Append(chrome::kHelperProcessExecutablePath);
170 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, 176 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,
171 subprocess_path); 177 subprocess_path);
172 #endif 178 #endif
173 179
174 // TODO(pkotwicz): Investigate if we can remove this switch. 180 // TODO(pkotwicz): Investigate if we can remove this switch.
175 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); 181 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests);
176 182
177 if (!command_line->HasSwitch(switches::kHomePage)) { 183 if (!command_line->HasSwitch(switches::kHomePage)) {
178 command_line->AppendSwitchASCII( 184 command_line->AppendSwitchASCII(
179 switches::kHomePage, chrome::kAboutBlankURL); 185 switches::kHomePage, chrome::kAboutBlankURL);
180 } 186 }
181 if (command_line->GetArgs().empty()) 187 if (command_line->GetArgs().empty())
182 command_line->AppendArg(chrome::kAboutBlankURL); 188 command_line->AppendArg(chrome::kAboutBlankURL);
183 } 189 }
184 190
185 bool InProcessBrowserTest::CreateUserDataDirectory() { 191 bool InProcessBrowserTest::CreateUserDataDirectory() {
186 CommandLine* command_line = CommandLine::ForCurrentProcess(); 192 CommandLine* command_line = CommandLine::ForCurrentProcess();
187 FilePath user_data_dir = 193 FilePath user_data_dir =
188 command_line->GetSwitchValuePath(switches::kUserDataDir); 194 command_line->GetSwitchValuePath(switches::kUserDataDir);
189 if (user_data_dir.empty()) { 195 if (user_data_dir.empty()) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // On the Mac, this eventually reaches 395 // On the Mac, this eventually reaches
390 // -[BrowserWindowController windowWillClose:], which will post a deferred 396 // -[BrowserWindowController windowWillClose:], which will post a deferred
391 // -autorelease on itself to ultimately destroy the Browser object. The line 397 // -autorelease on itself to ultimately destroy the Browser object. The line
392 // below is necessary to pump these pending messages to ensure all Browsers 398 // below is necessary to pump these pending messages to ensure all Browsers
393 // get deleted. 399 // get deleted.
394 ui_test_utils::RunAllPendingInMessageLoop(); 400 ui_test_utils::RunAllPendingInMessageLoop();
395 delete autorelease_pool_; 401 delete autorelease_pool_;
396 autorelease_pool_ = NULL; 402 autorelease_pool_ = NULL;
397 #endif 403 #endif
398 } 404 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698