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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 subprocess_path.Append(chrome::kHelperProcessExecutablePath); | 242 subprocess_path.Append(chrome::kHelperProcessExecutablePath); |
243 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, | 243 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, |
244 subprocess_path); | 244 subprocess_path); |
245 #endif | 245 #endif |
246 | 246 |
247 // TODO(pkotwicz): Investigate if we can remove this switch. | 247 // TODO(pkotwicz): Investigate if we can remove this switch. |
248 if (exit_when_last_browser_closes_) | 248 if (exit_when_last_browser_closes_) |
249 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); | 249 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); |
250 | 250 |
251 if (command_line->GetArgs().empty()) | 251 if (command_line->GetArgs().empty()) |
252 command_line->AppendArg(content::kAboutBlankURL); | 252 command_line->AppendArg(url::kAboutBlankURL); |
253 } | 253 } |
254 | 254 |
255 bool InProcessBrowserTest::CreateUserDataDirectory() { | 255 bool InProcessBrowserTest::CreateUserDataDirectory() { |
256 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 256 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
257 base::FilePath user_data_dir = | 257 base::FilePath user_data_dir = |
258 command_line->GetSwitchValuePath(switches::kUserDataDir); | 258 command_line->GetSwitchValuePath(switches::kUserDataDir); |
259 if (user_data_dir.empty()) { | 259 if (user_data_dir.empty()) { |
260 if (temp_user_data_dir_.CreateUniqueTempDir() && | 260 if (temp_user_data_dir_.CreateUniqueTempDir() && |
261 temp_user_data_dir_.IsValid()) { | 261 temp_user_data_dir_.IsValid()) { |
262 user_data_dir = temp_user_data_dir_.path(); | 262 user_data_dir = temp_user_data_dir_.path(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 app_name, false /* trusted_source */, gfx::Rect(), profile, | 335 app_name, false /* trusted_source */, gfx::Rect(), profile, |
336 chrome::GetActiveDesktop())); | 336 chrome::GetActiveDesktop())); |
337 AddBlankTabAndShow(browser); | 337 AddBlankTabAndShow(browser); |
338 return browser; | 338 return browser; |
339 } | 339 } |
340 | 340 |
341 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 341 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
342 content::WindowedNotificationObserver observer( | 342 content::WindowedNotificationObserver observer( |
343 content::NOTIFICATION_LOAD_STOP, | 343 content::NOTIFICATION_LOAD_STOP, |
344 content::NotificationService::AllSources()); | 344 content::NotificationService::AllSources()); |
345 chrome::AddSelectedTabWithURL(browser, GURL(content::kAboutBlankURL), | 345 chrome::AddSelectedTabWithURL(browser, |
| 346 GURL(url::kAboutBlankURL), |
346 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 347 content::PAGE_TRANSITION_AUTO_TOPLEVEL); |
347 observer.Wait(); | 348 observer.Wait(); |
348 | 349 |
349 browser->window()->Show(); | 350 browser->window()->Show(); |
350 } | 351 } |
351 | 352 |
352 #if !defined(OS_MACOSX) | 353 #if !defined(OS_MACOSX) |
353 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { | 354 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { |
354 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); | 355 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); |
355 CommandLine::SwitchMap switches = | 356 CommandLine::SwitchMap switches = |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // On the Mac, this eventually reaches | 472 // On the Mac, this eventually reaches |
472 // -[BrowserWindowController windowWillClose:], which will post a deferred | 473 // -[BrowserWindowController windowWillClose:], which will post a deferred |
473 // -autorelease on itself to ultimately destroy the Browser object. The line | 474 // -autorelease on itself to ultimately destroy the Browser object. The line |
474 // below is necessary to pump these pending messages to ensure all Browsers | 475 // below is necessary to pump these pending messages to ensure all Browsers |
475 // get deleted. | 476 // get deleted. |
476 content::RunAllPendingInMessageLoop(); | 477 content::RunAllPendingInMessageLoop(); |
477 delete autorelease_pool_; | 478 delete autorelease_pool_; |
478 autorelease_pool_ = NULL; | 479 autorelease_pool_ = NULL; |
479 #endif | 480 #endif |
480 } | 481 } |
OLD | NEW |