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

Side by Side Diff: chrome/browser/app_controller_mac_browsertest.mm

Issue 1228723002: Extract duplicated code in browser_tests for closing a browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/WithoutWaiting/Asynchronously 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 | « no previous file | chrome/browser/content_settings/content_settings_browsertest.cc » ('j') | 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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 #import <Cocoa/Cocoa.h> 6 #import <Cocoa/Cocoa.h>
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #import <Foundation/NSAppleEventDescriptor.h> 8 #import <Foundation/NSAppleEventDescriptor.h>
9 #import <objc/message.h> 9 #import <objc/message.h>
10 #import <objc/runtime.h> 10 #import <objc/runtime.h>
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 ui_test_utils::NavigateToURLWithDisposition( 657 ui_test_utils::NavigateToURLWithDisposition(
658 browser(), GURL(test_url3), NEW_WINDOW, 658 browser(), GURL(test_url3), NEW_WINDOW,
659 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); 659 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER);
660 EXPECT_EQ(g_handoff_url, test_url3); 660 EXPECT_EQ(g_handoff_url, test_url3);
661 661
662 // Check that there are exactly 2 browsers. 662 // Check that there are exactly 2 browsers.
663 BrowserList* active_browser_list = 663 BrowserList* active_browser_list =
664 BrowserList::GetInstance(chrome::GetActiveDesktop()); 664 BrowserList::GetInstance(chrome::GetActiveDesktop());
665 EXPECT_EQ(2u, active_browser_list->size()); 665 EXPECT_EQ(2u, active_browser_list->size());
666 666
667 // Close the one and only tab for the second browser window. 667 // Close the second browser window (which only has 1 tab left).
668 Browser* browser2 = active_browser_list->get(1); 668 Browser* browser2 = active_browser_list->get(1);
669 CloseTab(browser2, 0); 669 CloseBrowserSynchronously(browser2);
670 base::RunLoop().RunUntilIdle();
671 EXPECT_EQ(g_handoff_url, test_url2); 670 EXPECT_EQ(g_handoff_url, test_url2);
672 671
673 // The URLs of incognito windows should not be passed to Handoff. 672 // The URLs of incognito windows should not be passed to Handoff.
674 GURL test_url4 = embedded_test_server()->GetURL("/simple.html"); 673 GURL test_url4 = embedded_test_server()->GetURL("/simple.html");
675 ui_test_utils::NavigateToURLWithDisposition( 674 ui_test_utils::NavigateToURLWithDisposition(
676 browser(), GURL(test_url4), OFF_THE_RECORD, 675 browser(), GURL(test_url4), OFF_THE_RECORD,
677 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); 676 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER);
678 EXPECT_EQ(g_handoff_url, GURL()); 677 EXPECT_EQ(g_handoff_url, GURL());
679 678
680 // Open a new tab in the incognito window. 679 // Open a new tab in the incognito window.
681 EXPECT_EQ(2u, active_browser_list->size()); 680 EXPECT_EQ(2u, active_browser_list->size());
682 Browser* browser3 = active_browser_list->get(1); 681 Browser* browser3 = active_browser_list->get(1);
683 ui_test_utils::NavigateToURLWithDisposition( 682 ui_test_utils::NavigateToURLWithDisposition(
684 browser3, test_url4, NEW_FOREGROUND_TAB, 683 browser3, test_url4, NEW_FOREGROUND_TAB,
685 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 684 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
686 EXPECT_EQ(g_handoff_url, GURL()); 685 EXPECT_EQ(g_handoff_url, GURL());
687 686
688 // Navigate the current tab in the incognito window. 687 // Navigate the current tab in the incognito window.
689 ui_test_utils::NavigateToURL(browser3, test_url1); 688 ui_test_utils::NavigateToURL(browser3, test_url1);
690 EXPECT_EQ(g_handoff_url, GURL()); 689 EXPECT_EQ(g_handoff_url, GURL());
691 690
692 // Activate the original browser window. 691 // Activate the original browser window.
693 Browser* browser1 = active_browser_list->get(0); 692 Browser* browser1 = active_browser_list->get(0);
694 browser1->window()->Show(); 693 browser1->window()->Show();
695 EXPECT_EQ(g_handoff_url, test_url2); 694 EXPECT_EQ(g_handoff_url, test_url2);
696 } 695 }
697 696
698 } // namespace 697 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698