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

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

Issue 1229473002: mac: Fix five browser_tests on Yosemite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ifdefs. Created 5 years, 5 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
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_browsertest.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/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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 AddTabAtIndexToBrowser(browser(), index, url, transition, true); 404 AddTabAtIndexToBrowser(browser(), index, url, transition, true);
405 } 405 }
406 406
407 bool InProcessBrowserTest::SetUpUserDataDirectory() { 407 bool InProcessBrowserTest::SetUpUserDataDirectory() {
408 return true; 408 return true;
409 } 409 }
410 410
411 // Creates a browser with a single tab (about:blank), waits for the tab to 411 // Creates a browser with a single tab (about:blank), waits for the tab to
412 // finish loading and shows the browser. 412 // finish loading and shows the browser.
413 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { 413 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
414 #if defined(OS_MACOSX)
415 base::mac::ScopedNSAutoreleasePool pool;
416 #endif // defined(OS_MACOSX)
414 Browser* browser = new Browser( 417 Browser* browser = new Browser(
415 Browser::CreateParams(profile, chrome::GetActiveDesktop())); 418 Browser::CreateParams(profile, chrome::GetActiveDesktop()));
416 AddBlankTabAndShow(browser); 419 AddBlankTabAndShow(browser);
417 return browser; 420 return browser;
418 } 421 }
419 422
420 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { 423 Browser* InProcessBrowserTest::CreateIncognitoBrowser() {
424 #if defined(OS_MACOSX)
425 base::mac::ScopedNSAutoreleasePool pool;
426 #endif // defined(OS_MACOSX)
421 // Create a new browser with using the incognito profile. 427 // Create a new browser with using the incognito profile.
422 Browser* incognito = new Browser( 428 Browser* incognito = new Browser(
423 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile(), 429 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile(),
424 chrome::GetActiveDesktop())); 430 chrome::GetActiveDesktop()));
425 AddBlankTabAndShow(incognito); 431 AddBlankTabAndShow(incognito);
426 return incognito; 432 return incognito;
427 } 433 }
428 434
429 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { 435 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) {
436 #if defined(OS_MACOSX)
437 base::mac::ScopedNSAutoreleasePool pool;
438 #endif // defined(OS_MACOSX)
430 Browser* browser = 439 Browser* browser =
431 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile, 440 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile,
432 chrome::GetActiveDesktop())); 441 chrome::GetActiveDesktop()));
433 AddBlankTabAndShow(browser); 442 AddBlankTabAndShow(browser);
434 return browser; 443 return browser;
435 } 444 }
436 445
437 Browser* InProcessBrowserTest::CreateBrowserForApp( 446 Browser* InProcessBrowserTest::CreateBrowserForApp(
438 const std::string& app_name, 447 const std::string& app_name,
439 Profile* profile) { 448 Profile* profile) {
449 #if defined(OS_MACOSX)
450 base::mac::ScopedNSAutoreleasePool pool;
451 #endif // defined(OS_MACOSX)
440 Browser* browser = new Browser( 452 Browser* browser = new Browser(
441 Browser::CreateParams::CreateForApp( 453 Browser::CreateParams::CreateForApp(
442 app_name, false /* trusted_source */, gfx::Rect(), profile, 454 app_name, false /* trusted_source */, gfx::Rect(), profile,
443 chrome::GetActiveDesktop())); 455 chrome::GetActiveDesktop()));
444 AddBlankTabAndShow(browser); 456 AddBlankTabAndShow(browser);
445 return browser; 457 return browser;
446 } 458 }
447 459
448 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { 460 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) {
449 content::WindowedNotificationObserver observer( 461 content::WindowedNotificationObserver observer(
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // On the Mac, this eventually reaches 603 // On the Mac, this eventually reaches
592 // -[BrowserWindowController windowWillClose:], which will post a deferred 604 // -[BrowserWindowController windowWillClose:], which will post a deferred
593 // -autorelease on itself to ultimately destroy the Browser object. The line 605 // -autorelease on itself to ultimately destroy the Browser object. The line
594 // below is necessary to pump these pending messages to ensure all Browsers 606 // below is necessary to pump these pending messages to ensure all Browsers
595 // get deleted. 607 // get deleted.
596 content::RunAllPendingInMessageLoop(); 608 content::RunAllPendingInMessageLoop();
597 delete autorelease_pool_; 609 delete autorelease_pool_;
598 autorelease_pool_ = NULL; 610 autorelease_pool_ = NULL;
599 #endif 611 #endif
600 } 612 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698