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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 16174003: Make all tests use GetActiveDesktop() instead of hardcoding HOST_DESKTOP_TYPE_NATIVE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 602
603 // Disabled, http://crbug.com/159214 . 603 // Disabled, http://crbug.com/159214 .
604 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows, 604 IN_PROC_BROWSER_TEST_F(BeforeUnloadAtQuitWithTwoWindows,
605 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) { 605 DISABLED_IfThisTestTimesOutItIndicatesFAILURE) {
606 // In the first browser, set up a page that has a beforeunload handler. 606 // In the first browser, set up a page that has a beforeunload handler.
607 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 607 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
608 ui_test_utils::NavigateToURL(browser(), url); 608 ui_test_utils::NavigateToURL(browser(), url);
609 609
610 // Open a second browser window at about:blank. 610 // Open a second browser window at about:blank.
611 ui_test_utils::BrowserAddedObserver browser_added_observer; 611 ui_test_utils::BrowserAddedObserver browser_added_observer;
612 chrome::NewEmptyWindow(browser()->profile(), 612 chrome::NewEmptyWindow(browser()->profile(), chrome::GetActiveDesktop());
613 chrome::HOST_DESKTOP_TYPE_NATIVE);
614 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser(); 613 Browser* second_window = browser_added_observer.WaitForSingleNewBrowser();
615 ui_test_utils::NavigateToURL(second_window, GURL("about:blank")); 614 ui_test_utils::NavigateToURL(second_window, GURL("about:blank"));
616 615
617 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on 616 // Tell the application to quit. IDC_EXIT calls AttemptUserExit, which on
618 // everything but ChromeOS allows unload handlers to block exit. On that 617 // everything but ChromeOS allows unload handlers to block exit. On that
619 // platform, though, it exits unconditionally. See the comment and bug ID 618 // platform, though, it exits unconditionally. See the comment and bug ID
620 // in AttemptUserExit() in application_lifetime.cc. 619 // in AttemptUserExit() in application_lifetime.cc.
621 #if defined(OS_CHROMEOS) 620 #if defined(OS_CHROMEOS)
622 chrome::AttemptExit(); 621 chrome::AttemptExit();
623 #else 622 #else
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 Profile* profile = browser()->profile(); 1880 Profile* profile = browser()->profile();
1882 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); 1881 EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
1883 content::WindowedNotificationObserver observer( 1882 content::WindowedNotificationObserver observer(
1884 chrome::NOTIFICATION_BROWSER_CLOSED, 1883 chrome::NOTIFICATION_BROWSER_CLOSED,
1885 content::Source<Browser>(browser())); 1884 content::Source<Browser>(browser()));
1886 chrome::CloseWindow(browser()); 1885 chrome::CloseWindow(browser());
1887 observer.Wait(); 1886 observer.Wait();
1888 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); 1887 EXPECT_EQ(0u, chrome::GetTotalBrowserCount());
1889 1888
1890 ui_test_utils::BrowserAddedObserver browser_added_observer; 1889 ui_test_utils::BrowserAddedObserver browser_added_observer;
1891 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 1890 chrome::NewEmptyWindow(profile, chrome::GetActiveDesktop());
1892 browser_added_observer.WaitForSingleNewBrowser(); 1891 browser_added_observer.WaitForSingleNewBrowser();
1893 1892
1894 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); 1893 EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
1895 } 1894 }
1896 1895
1897 // Tests to ensure that the browser continues running in the background after 1896 // Tests to ensure that the browser continues running in the background after
1898 // the last window closes. 1897 // the last window closes.
1899 class NoStartupWindowTest : public BrowserTest { 1898 class NoStartupWindowTest : public BrowserTest {
1900 public: 1899 public:
1901 NoStartupWindowTest() {} 1900 NoStartupWindowTest() {}
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); 2195 RunTest(browser(), GetHrefURL(), modifiers, button, disposition);
2197 } 2196 }
2198 2197
2199 // Shift-middle-clicks open in a foreground tab. 2198 // Shift-middle-clicks open in a foreground tab.
2200 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) { 2199 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) {
2201 int modifiers = WebKit::WebInputEvent::ShiftKey; 2200 int modifiers = WebKit::WebInputEvent::ShiftKey;
2202 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle; 2201 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle;
2203 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; 2202 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB;
2204 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); 2203 RunTest(browser(), GetHrefURL(), modifiers, button, disposition);
2205 } 2204 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/browser/ui/browser_command_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698