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

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

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: We have both kinds of compile fixes: mac and windows Created 3 years, 10 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
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/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 chrome::FindTabbedBrowser(profile->GetOffTheRecordProfile(), false); 439 chrome::FindTabbedBrowser(profile->GetOffTheRecordProfile(), false);
440 content::TestNavigationObserver observer( 440 content::TestNavigationObserver observer(
441 browser->tab_strip_model()->GetActiveWebContents()); 441 browser->tab_strip_model()->GetActiveWebContents());
442 observer.Wait(); 442 observer.Wait();
443 return browser; 443 return browser;
444 } 444 }
445 445
446 // Creates a browser with a single tab (about:blank), waits for the tab to 446 // Creates a browser with a single tab (about:blank), waits for the tab to
447 // finish loading and shows the browser. 447 // finish loading and shows the browser.
448 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { 448 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
449 Browser* browser = new Browser(Browser::CreateParams(profile)); 449 Browser* browser = new Browser(Browser::CreateParams(profile, true));
450 AddBlankTabAndShow(browser); 450 AddBlankTabAndShow(browser);
451 return browser; 451 return browser;
452 } 452 }
453 453
454 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { 454 Browser* InProcessBrowserTest::CreateIncognitoBrowser() {
455 // Create a new browser with using the incognito profile. 455 // Create a new browser with using the incognito profile.
456 Browser* incognito = new Browser( 456 Browser* incognito = new Browser(Browser::CreateParams(
457 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile())); 457 browser()->profile()->GetOffTheRecordProfile(), true));
458 AddBlankTabAndShow(incognito); 458 AddBlankTabAndShow(incognito);
459 return incognito; 459 return incognito;
460 } 460 }
461 461
462 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { 462 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) {
463 Browser* browser = 463 Browser* browser =
464 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile)); 464 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile, true));
465 AddBlankTabAndShow(browser); 465 AddBlankTabAndShow(browser);
466 return browser; 466 return browser;
467 } 467 }
468 468
469 Browser* InProcessBrowserTest::CreateBrowserForApp( 469 Browser* InProcessBrowserTest::CreateBrowserForApp(
470 const std::string& app_name, 470 const std::string& app_name,
471 Profile* profile) { 471 Profile* profile) {
472 Browser* browser = new Browser( 472 Browser* browser = new Browser(Browser::CreateParams::CreateForApp(
473 Browser::CreateParams::CreateForApp( 473 app_name, false /* trusted_source */, gfx::Rect(), profile, true));
474 app_name, false /* trusted_source */, gfx::Rect(), profile));
475 AddBlankTabAndShow(browser); 474 AddBlankTabAndShow(browser);
476 return browser; 475 return browser;
477 } 476 }
478 #endif // !defined(OS_MACOSX) 477 #endif // !defined(OS_MACOSX)
479 478
480 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { 479 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) {
481 content::WindowedNotificationObserver observer( 480 content::WindowedNotificationObserver observer(
482 content::NOTIFICATION_LOAD_STOP, 481 content::NOTIFICATION_LOAD_STOP,
483 content::NotificationService::AllSources()); 482 content::NotificationService::AllSources());
484 chrome::AddSelectedTabWithURL(browser, 483 chrome::AddSelectedTabWithURL(browser,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 // On the Mac, this eventually reaches 614 // On the Mac, this eventually reaches
616 // -[BrowserWindowController windowWillClose:], which will post a deferred 615 // -[BrowserWindowController windowWillClose:], which will post a deferred
617 // -autorelease on itself to ultimately destroy the Browser object. The line 616 // -autorelease on itself to ultimately destroy the Browser object. The line
618 // below is necessary to pump these pending messages to ensure all Browsers 617 // below is necessary to pump these pending messages to ensure all Browsers
619 // get deleted. 618 // get deleted.
620 content::RunAllPendingInMessageLoop(); 619 content::RunAllPendingInMessageLoop();
621 delete autorelease_pool_; 620 delete autorelease_pool_;
622 autorelease_pool_ = NULL; 621 autorelease_pool_ = NULL;
623 #endif 622 #endif
624 } 623 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698