OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 ASSERT_TRUE(embedded_test_server()->Start()); | 1859 ASSERT_TRUE(embedded_test_server()->Start()); |
1860 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 1860 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
1861 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1861 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1862 ui_test_utils::NavigateToURL(browser(), url); | 1862 ui_test_utils::NavigateToURL(browser(), url); |
1863 | 1863 |
1864 CommandUpdater* command_updater = | 1864 CommandUpdater* command_updater = |
1865 browser()->command_controller()->command_updater(); | 1865 browser()->command_controller()->command_updater(); |
1866 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); | 1866 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); |
1867 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); | 1867 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); |
1868 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); | 1868 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); |
1869 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); | |
1870 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); | 1869 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); |
1871 | 1870 |
1872 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 1871 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
1873 | 1872 |
1874 TestInterstitialPage* interstitial = | 1873 TestInterstitialPage* interstitial = |
1875 new TestInterstitialPage(contents, false, GURL()); | 1874 new TestInterstitialPage(contents, false, GURL()); |
1876 content::WaitForInterstitialAttach(contents); | 1875 content::WaitForInterstitialAttach(contents); |
1877 | 1876 |
1878 EXPECT_TRUE(contents->ShowingInterstitialPage()); | 1877 EXPECT_TRUE(contents->ShowingInterstitialPage()); |
1879 | 1878 |
1880 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); | 1879 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); |
1881 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_PRINT)); | 1880 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_PRINT)); |
1882 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); | 1881 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); |
1883 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); | |
1884 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); | 1882 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); |
1885 | 1883 |
1886 // Proceed and wait for interstitial to detach. This doesn't destroy | 1884 // Proceed and wait for interstitial to detach. This doesn't destroy |
1887 // |contents|. | 1885 // |contents|. |
1888 interstitial->Proceed(); | 1886 interstitial->Proceed(); |
1889 content::WaitForInterstitialDetach(contents); | 1887 content::WaitForInterstitialDetach(contents); |
1890 // interstitial is deleted now. | 1888 // interstitial is deleted now. |
1891 | 1889 |
1892 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); | 1890 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); |
1893 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); | 1891 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); |
1894 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); | 1892 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); |
1895 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); | |
1896 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); | 1893 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); |
1897 } | 1894 } |
1898 | 1895 |
1899 // Ensure that creating an interstitial page closes any JavaScript dialogs | 1896 // Ensure that creating an interstitial page closes any JavaScript dialogs |
1900 // that were present on the previous page. See http://crbug.com/295695. | 1897 // that were present on the previous page. See http://crbug.com/295695. |
1901 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialClosesDialogs) { | 1898 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialClosesDialogs) { |
1902 ASSERT_TRUE(embedded_test_server()->Start()); | 1899 ASSERT_TRUE(embedded_test_server()->Start()); |
1903 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 1900 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
1904 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1901 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1905 ui_test_utils::NavigateToURL(browser(), url); | 1902 ui_test_utils::NavigateToURL(browser(), url); |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 Browser* browser = new Browser(params); | 2842 Browser* browser = new Browser(params); |
2846 gfx::Rect bounds = browser->window()->GetBounds(); | 2843 gfx::Rect bounds = browser->window()->GetBounds(); |
2847 | 2844 |
2848 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2845 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
2849 // See https://crbug.com/567925. | 2846 // See https://crbug.com/567925. |
2850 EXPECT_GE(bounds.width(), 100); | 2847 EXPECT_GE(bounds.width(), 100); |
2851 EXPECT_EQ(122, bounds.height()); | 2848 EXPECT_EQ(122, bounds.height()); |
2852 browser->window()->Close(); | 2849 browser->window()->Close(); |
2853 } | 2850 } |
2854 } | 2851 } |
OLD | NEW |