| 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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 EXPECT_NE(app_name.find(extension_app->id()), std::string::npos) | 1629 EXPECT_NE(app_name.find(extension_app->id()), std::string::npos) |
| 1630 << "Name " << app_name << " should contain id "<< extension_app->id(); | 1630 << "Name " << app_name << " should contain id "<< extension_app->id(); |
| 1631 } | 1631 } |
| 1632 #endif // !defined(OS_MACOSX) | 1632 #endif // !defined(OS_MACOSX) |
| 1633 | 1633 |
| 1634 // Makes sure the browser doesn't crash when | 1634 // Makes sure the browser doesn't crash when |
| 1635 // set_show_state(ui::SHOW_STATE_MAXIMIZED) has been invoked. | 1635 // set_show_state(ui::SHOW_STATE_MAXIMIZED) has been invoked. |
| 1636 IN_PROC_BROWSER_TEST_F(BrowserTest, StartMaximized) { | 1636 IN_PROC_BROWSER_TEST_F(BrowserTest, StartMaximized) { |
| 1637 Browser::Type types[] = { Browser::TYPE_TABBED, Browser::TYPE_POPUP }; | 1637 Browser::Type types[] = { Browser::TYPE_TABBED, Browser::TYPE_POPUP }; |
| 1638 for (size_t i = 0; i < arraysize(types); ++i) { | 1638 for (size_t i = 0; i < arraysize(types); ++i) { |
| 1639 Browser::CreateParams params(types[i], browser()->profile()); | 1639 Browser::CreateParams params(types[i], browser()->profile(), true); |
| 1640 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; | 1640 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; |
| 1641 AddBlankTabAndShow(new Browser(params)); | 1641 AddBlankTabAndShow(new Browser(params)); |
| 1642 } | 1642 } |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 // Aura doesn't support minimized window. crbug.com/104571. | 1645 // Aura doesn't support minimized window. crbug.com/104571. |
| 1646 #if defined(USE_AURA) | 1646 #if defined(USE_AURA) |
| 1647 #define MAYBE_StartMinimized DISABLED_StartMinimized | 1647 #define MAYBE_StartMinimized DISABLED_StartMinimized |
| 1648 #else | 1648 #else |
| 1649 #define MAYBE_StartMinimized StartMinimized | 1649 #define MAYBE_StartMinimized StartMinimized |
| 1650 #endif | 1650 #endif |
| 1651 // Makes sure the browser doesn't crash when | 1651 // Makes sure the browser doesn't crash when |
| 1652 // set_show_state(ui::SHOW_STATE_MINIMIZED) has been invoked. | 1652 // set_show_state(ui::SHOW_STATE_MINIMIZED) has been invoked. |
| 1653 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_StartMinimized) { | 1653 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_StartMinimized) { |
| 1654 Browser::Type types[] = { Browser::TYPE_TABBED, Browser::TYPE_POPUP }; | 1654 Browser::Type types[] = { Browser::TYPE_TABBED, Browser::TYPE_POPUP }; |
| 1655 for (size_t i = 0; i < arraysize(types); ++i) { | 1655 for (size_t i = 0; i < arraysize(types); ++i) { |
| 1656 Browser::CreateParams params(types[i], browser()->profile()); | 1656 Browser::CreateParams params(types[i], browser()->profile(), true); |
| 1657 params.initial_show_state = ui::SHOW_STATE_MINIMIZED; | 1657 params.initial_show_state = ui::SHOW_STATE_MINIMIZED; |
| 1658 AddBlankTabAndShow(new Browser(params)); | 1658 AddBlankTabAndShow(new Browser(params)); |
| 1659 } | 1659 } |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 // Makes sure the forward button is disabled immediately when navigating | 1662 // Makes sure the forward button is disabled immediately when navigating |
| 1663 // forward to a slow-to-commit page. | 1663 // forward to a slow-to-commit page. |
| 1664 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { | 1664 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { |
| 1665 GURL blank_url(url::kAboutBlankURL); | 1665 GURL blank_url(url::kAboutBlankURL); |
| 1666 ui_test_utils::NavigateToURL(browser(), blank_url); | 1666 ui_test_utils::NavigateToURL(browser(), blank_url); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 // Bookmarks & Settings commands should get disabled. | 1711 // Bookmarks & Settings commands should get disabled. |
| 1712 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); | 1712 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); |
| 1713 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); | 1713 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); |
| 1714 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1714 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1715 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1715 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1716 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1716 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1717 // New Incognito Window command, however, should be enabled. | 1717 // New Incognito Window command, however, should be enabled. |
| 1718 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); | 1718 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); |
| 1719 | 1719 |
| 1720 // Create a new browser. | 1720 // Create a new browser. |
| 1721 Browser* new_browser = new Browser( | 1721 Browser* new_browser = new Browser(Browser::CreateParams( |
| 1722 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile())); | 1722 browser()->profile()->GetOffTheRecordProfile(), true)); |
| 1723 CommandUpdater* new_command_updater = | 1723 CommandUpdater* new_command_updater = |
| 1724 new_browser->command_controller()->command_updater(); | 1724 new_browser->command_controller()->command_updater(); |
| 1725 // It should have Bookmarks & Settings commands disabled by default. | 1725 // It should have Bookmarks & Settings commands disabled by default. |
| 1726 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); | 1726 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); |
| 1727 EXPECT_FALSE(new_command_updater->IsCommandEnabled( | 1727 EXPECT_FALSE(new_command_updater->IsCommandEnabled( |
| 1728 IDC_SHOW_BOOKMARK_MANAGER)); | 1728 IDC_SHOW_BOOKMARK_MANAGER)); |
| 1729 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1729 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1730 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1730 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1731 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1731 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1732 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); | 1732 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1745 // should be enabled. | 1745 // should be enabled. |
| 1746 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); | 1746 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); |
| 1747 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); | 1747 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); |
| 1748 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); | 1748 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); |
| 1749 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1749 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1750 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1750 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1751 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1751 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1752 | 1752 |
| 1753 // Create a new browser. | 1753 // Create a new browser. |
| 1754 Browser* new_browser = | 1754 Browser* new_browser = |
| 1755 new Browser(Browser::CreateParams(browser()->profile())); | 1755 new Browser(Browser::CreateParams(browser()->profile(), true)); |
| 1756 CommandUpdater* new_command_updater = | 1756 CommandUpdater* new_command_updater = |
| 1757 new_browser->command_controller()->command_updater(); | 1757 new_browser->command_controller()->command_updater(); |
| 1758 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); | 1758 EXPECT_FALSE(new_command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW)); |
| 1759 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); | 1759 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); |
| 1760 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); | 1760 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); |
| 1761 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1761 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1762 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1762 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1763 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1763 EXPECT_TRUE(new_command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1764 } | 1764 } |
| 1765 | 1765 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1778 // Make sure Manage Extensions command is disabled. | 1778 // Make sure Manage Extensions command is disabled. |
| 1779 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1779 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1780 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); | 1780 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW)); |
| 1781 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); | 1781 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER)); |
| 1782 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1782 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1783 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1783 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1784 | 1784 |
| 1785 // Create a popup (non-main-UI-type) browser. Settings command as well | 1785 // Create a popup (non-main-UI-type) browser. Settings command as well |
| 1786 // as Extensions should be disabled. | 1786 // as Extensions should be disabled. |
| 1787 Browser* popup_browser = new Browser( | 1787 Browser* popup_browser = new Browser( |
| 1788 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 1788 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); |
| 1789 CommandUpdater* popup_command_updater = | 1789 CommandUpdater* popup_command_updater = |
| 1790 popup_browser->command_controller()->command_updater(); | 1790 popup_browser->command_controller()->command_updater(); |
| 1791 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); | 1791 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS)); |
| 1792 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1792 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1793 EXPECT_TRUE(popup_command_updater->IsCommandEnabled( | 1793 EXPECT_TRUE(popup_command_updater->IsCommandEnabled( |
| 1794 IDC_SHOW_BOOKMARK_MANAGER)); | 1794 IDC_SHOW_BOOKMARK_MANAGER)); |
| 1795 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1795 EXPECT_FALSE(popup_command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1796 } | 1796 } |
| 1797 | 1797 |
| 1798 // Makes sure Extensions and Settings commands are disabled in certain | 1798 // Makes sure Extensions and Settings commands are disabled in certain |
| 1799 // circumstances even though normally they should stay enabled. | 1799 // circumstances even though normally they should stay enabled. |
| 1800 IN_PROC_BROWSER_TEST_F(BrowserTest, | 1800 IN_PROC_BROWSER_TEST_F(BrowserTest, |
| 1801 DisableOptionsAndImportMenuItemsConsistently) { | 1801 DisableOptionsAndImportMenuItemsConsistently) { |
| 1802 // Create a popup browser. | 1802 // Create a popup browser. |
| 1803 Browser* popup_browser = new Browser( | 1803 Browser* popup_browser = new Browser( |
| 1804 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 1804 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); |
| 1805 CommandUpdater* command_updater = | 1805 CommandUpdater* command_updater = |
| 1806 popup_browser->command_controller()->command_updater(); | 1806 popup_browser->command_controller()->command_updater(); |
| 1807 // OPTIONS and IMPORT_SETTINGS are disabled for a non-normal UI. | 1807 // OPTIONS and IMPORT_SETTINGS are disabled for a non-normal UI. |
| 1808 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); | 1808 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); |
| 1809 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); | 1809 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); |
| 1810 | 1810 |
| 1811 // Set Incognito to FORCED. | 1811 // Set Incognito to FORCED. |
| 1812 IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(), | 1812 IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(), |
| 1813 IncognitoModePrefs::FORCED); | 1813 IncognitoModePrefs::FORCED); |
| 1814 // OPTIONS and IMPORT_SETTINGS are disabled when Incognito is forced. | 1814 // OPTIONS and IMPORT_SETTINGS are disabled when Incognito is forced. |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2859 // set by params.initial_bounds are the same as the contents bounds in the | 2859 // set by params.initial_bounds are the same as the contents bounds in the |
| 2860 // initialized window. See crbug.com/585856. | 2860 // initialized window. See crbug.com/585856. |
| 2861 { | 2861 { |
| 2862 // Minimum height a popup window should have added to the supplied content | 2862 // Minimum height a popup window should have added to the supplied content |
| 2863 // bounds when drawn. This accommodates the browser toolbar. | 2863 // bounds when drawn. This accommodates the browser toolbar. |
| 2864 const int minimum_popup_padding = 26; | 2864 const int minimum_popup_padding = 26; |
| 2865 | 2865 |
| 2866 // Creates an untrusted popup window and asserts that the eventual height is | 2866 // Creates an untrusted popup window and asserts that the eventual height is |
| 2867 // padded with the toolbar and title bar height (initial height is content | 2867 // padded with the toolbar and title bar height (initial height is content |
| 2868 // height). | 2868 // height). |
| 2869 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); | 2869 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), |
| 2870 true); |
| 2870 params.initial_bounds = gfx::Rect(0, 0, 100, 122); | 2871 params.initial_bounds = gfx::Rect(0, 0, 100, 122); |
| 2871 Browser* browser = new Browser(params); | 2872 Browser* browser = new Browser(params); |
| 2872 gfx::Rect bounds = browser->window()->GetBounds(); | 2873 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2873 | 2874 |
| 2874 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2875 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2875 // See https://crbug.com/567925. | 2876 // See https://crbug.com/567925. |
| 2876 EXPECT_GE(bounds.width(), 100); | 2877 EXPECT_GE(bounds.width(), 100); |
| 2877 | 2878 |
| 2878 // EXPECT_GE as Mac will have a larger height with the additional title bar. | 2879 // EXPECT_GE as Mac will have a larger height with the additional title bar. |
| 2879 EXPECT_GE(bounds.height(), 122 + minimum_popup_padding); | 2880 EXPECT_GE(bounds.height(), 122 + minimum_popup_padding); |
| 2880 browser->window()->Close(); | 2881 browser->window()->Close(); |
| 2881 } | 2882 } |
| 2882 | 2883 |
| 2883 { | 2884 { |
| 2884 // Creates a trusted popup window and asserts that the eventual height | 2885 // Creates a trusted popup window and asserts that the eventual height |
| 2885 // doesn't change (initial height is window height). | 2886 // doesn't change (initial height is window height). |
| 2886 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); | 2887 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), |
| 2888 true); |
| 2887 params.initial_bounds = gfx::Rect(0, 0, 100, 122); | 2889 params.initial_bounds = gfx::Rect(0, 0, 100, 122); |
| 2888 params.trusted_source = true; | 2890 params.trusted_source = true; |
| 2889 Browser* browser = new Browser(params); | 2891 Browser* browser = new Browser(params); |
| 2890 gfx::Rect bounds = browser->window()->GetBounds(); | 2892 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2891 | 2893 |
| 2892 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2894 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2893 // See https://crbug.com/567925. | 2895 // See https://crbug.com/567925. |
| 2894 EXPECT_GE(bounds.width(), 100); | 2896 EXPECT_GE(bounds.width(), 100); |
| 2895 EXPECT_EQ(122, bounds.height()); | 2897 EXPECT_EQ(122, bounds.height()); |
| 2896 browser->window()->Close(); | 2898 browser->window()->Close(); |
| 2897 } | 2899 } |
| 2898 | 2900 |
| 2899 { | 2901 { |
| 2900 // Creates an untrusted app window and asserts that the eventual height | 2902 // Creates an untrusted app window and asserts that the eventual height |
| 2901 // doesn't change. | 2903 // doesn't change. |
| 2902 Browser::CreateParams params = Browser::CreateParams::CreateForApp( | 2904 Browser::CreateParams params = Browser::CreateParams::CreateForApp( |
| 2903 "app-name", false, gfx::Rect(0, 0, 100, 122), browser()->profile()); | 2905 "app-name", false, gfx::Rect(0, 0, 100, 122), browser()->profile(), |
| 2906 true); |
| 2904 Browser* browser = new Browser(params); | 2907 Browser* browser = new Browser(params); |
| 2905 gfx::Rect bounds = browser->window()->GetBounds(); | 2908 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2906 | 2909 |
| 2907 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2910 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2908 // See https://crbug.com/567925. | 2911 // See https://crbug.com/567925. |
| 2909 EXPECT_GE(bounds.width(), 100); | 2912 EXPECT_GE(bounds.width(), 100); |
| 2910 EXPECT_EQ(122, bounds.height()); | 2913 EXPECT_EQ(122, bounds.height()); |
| 2911 browser->window()->Close(); | 2914 browser->window()->Close(); |
| 2912 } | 2915 } |
| 2913 | 2916 |
| 2914 { | 2917 { |
| 2915 // Creates a trusted app window and asserts that the eventual height | 2918 // Creates a trusted app window and asserts that the eventual height |
| 2916 // doesn't change. | 2919 // doesn't change. |
| 2917 Browser::CreateParams params = Browser::CreateParams::CreateForApp( | 2920 Browser::CreateParams params = Browser::CreateParams::CreateForApp( |
| 2918 "app-name", true, gfx::Rect(0, 0, 100, 122), browser()->profile()); | 2921 "app-name", true, gfx::Rect(0, 0, 100, 122), browser()->profile(), |
| 2922 true); |
| 2919 Browser* browser = new Browser(params); | 2923 Browser* browser = new Browser(params); |
| 2920 gfx::Rect bounds = browser->window()->GetBounds(); | 2924 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2921 | 2925 |
| 2922 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2926 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2923 // See https://crbug.com/567925. | 2927 // See https://crbug.com/567925. |
| 2924 EXPECT_GE(bounds.width(), 100); | 2928 EXPECT_GE(bounds.width(), 100); |
| 2925 EXPECT_EQ(122, bounds.height()); | 2929 EXPECT_EQ(122, bounds.height()); |
| 2926 browser->window()->Close(); | 2930 browser->window()->Close(); |
| 2927 } | 2931 } |
| 2928 | 2932 |
| 2929 { | 2933 { |
| 2930 // Creates a devtools window and asserts that the eventual height | 2934 // Creates a devtools window and asserts that the eventual height |
| 2931 // doesn't change. | 2935 // doesn't change. |
| 2932 Browser::CreateParams params = | 2936 Browser::CreateParams params = |
| 2933 Browser::CreateParams::CreateForDevTools(browser()->profile()); | 2937 Browser::CreateParams::CreateForDevTools(browser()->profile()); |
| 2934 params.initial_bounds = gfx::Rect(0, 0, 100, 122); | 2938 params.initial_bounds = gfx::Rect(0, 0, 100, 122); |
| 2935 Browser* browser = new Browser(params); | 2939 Browser* browser = new Browser(params); |
| 2936 gfx::Rect bounds = browser->window()->GetBounds(); | 2940 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2937 | 2941 |
| 2938 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2942 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2939 // See https://crbug.com/567925. | 2943 // See https://crbug.com/567925. |
| 2940 EXPECT_GE(bounds.width(), 100); | 2944 EXPECT_GE(bounds.width(), 100); |
| 2941 EXPECT_EQ(122, bounds.height()); | 2945 EXPECT_EQ(122, bounds.height()); |
| 2942 browser->window()->Close(); | 2946 browser->window()->Close(); |
| 2943 } | 2947 } |
| 2944 } | 2948 } |
| OLD | NEW |