| OLD | NEW |
| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 | 1800 |
| 1801 } // namespace | 1801 } // namespace |
| 1802 | 1802 |
| 1803 #if defined(OS_WIN) | 1803 #if defined(OS_WIN) |
| 1804 // Flakes regularly on Windows XP | 1804 // Flakes regularly on Windows XP |
| 1805 // http://crbug.com/146040 | 1805 // http://crbug.com/146040 |
| 1806 #define MAYBE_PageZoom DISABLED_PageZoom | 1806 #define MAYBE_PageZoom DISABLED_PageZoom |
| 1807 #else | 1807 #else |
| 1808 #define MAYBE_PageZoom PageZoom | 1808 #define MAYBE_PageZoom PageZoom |
| 1809 #endif | 1809 #endif |
| 1810 |
| 1811 namespace { |
| 1812 |
| 1813 int GetZoomPercent(const content::WebContents* contents, |
| 1814 bool* enable_plus, |
| 1815 bool* enable_minus) { |
| 1816 int percent = ZoomController::FromWebContents(contents)->GetZoomPercent(); |
| 1817 *enable_plus = percent < contents->GetMaximumZoomPercent(); |
| 1818 *enable_minus = percent > contents->GetMinimumZoomPercent(); |
| 1819 return percent; |
| 1820 } |
| 1821 |
| 1822 } // namespace |
| 1823 |
| 1810 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageZoom) { | 1824 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageZoom) { |
| 1811 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 1825 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1812 bool enable_plus, enable_minus; | 1826 bool enable_plus, enable_minus; |
| 1813 | 1827 |
| 1814 { | 1828 { |
| 1815 scoped_refptr<content::MessageLoopRunner> loop_runner( | 1829 scoped_refptr<content::MessageLoopRunner> loop_runner( |
| 1816 new content::MessageLoopRunner); | 1830 new content::MessageLoopRunner); |
| 1817 content::HostZoomMap::ZoomLevelChangedCallback callback( | 1831 content::HostZoomMap::ZoomLevelChangedCallback callback( |
| 1818 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); | 1832 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); |
| 1819 scoped_ptr<content::HostZoomMap::Subscription> sub = | 1833 scoped_ptr<content::HostZoomMap::Subscription> sub = |
| 1820 content::HostZoomMap::GetForBrowserContext( | 1834 content::HostZoomMap::GetForBrowserContext( |
| 1821 browser()->profile())->AddZoomLevelChangedCallback(callback); | 1835 browser()->profile())->AddZoomLevelChangedCallback(callback); |
| 1822 chrome::Zoom(browser(), content::PAGE_ZOOM_IN); | 1836 chrome::Zoom(browser(), content::PAGE_ZOOM_IN); |
| 1823 loop_runner->Run(); | 1837 loop_runner->Run(); |
| 1824 sub.reset(); | 1838 sub.reset(); |
| 1825 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110); | 1839 EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 110); |
| 1826 EXPECT_TRUE(enable_plus); | 1840 EXPECT_TRUE(enable_plus); |
| 1827 EXPECT_TRUE(enable_minus); | 1841 EXPECT_TRUE(enable_minus); |
| 1828 } | 1842 } |
| 1829 | 1843 |
| 1830 { | 1844 { |
| 1831 scoped_refptr<content::MessageLoopRunner> loop_runner( | 1845 scoped_refptr<content::MessageLoopRunner> loop_runner( |
| 1832 new content::MessageLoopRunner); | 1846 new content::MessageLoopRunner); |
| 1833 content::HostZoomMap::ZoomLevelChangedCallback callback( | 1847 content::HostZoomMap::ZoomLevelChangedCallback callback( |
| 1834 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); | 1848 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); |
| 1835 scoped_ptr<content::HostZoomMap::Subscription> sub = | 1849 scoped_ptr<content::HostZoomMap::Subscription> sub = |
| 1836 content::HostZoomMap::GetForBrowserContext( | 1850 content::HostZoomMap::GetForBrowserContext( |
| 1837 browser()->profile())->AddZoomLevelChangedCallback(callback); | 1851 browser()->profile())->AddZoomLevelChangedCallback(callback); |
| 1838 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); | 1852 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); |
| 1839 loop_runner->Run(); | 1853 loop_runner->Run(); |
| 1840 sub.reset(); | 1854 sub.reset(); |
| 1841 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100); | 1855 EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 100); |
| 1842 EXPECT_TRUE(enable_plus); | 1856 EXPECT_TRUE(enable_plus); |
| 1843 EXPECT_TRUE(enable_minus); | 1857 EXPECT_TRUE(enable_minus); |
| 1844 } | 1858 } |
| 1845 | 1859 |
| 1846 { | 1860 { |
| 1847 scoped_refptr<content::MessageLoopRunner> loop_runner( | 1861 scoped_refptr<content::MessageLoopRunner> loop_runner( |
| 1848 new content::MessageLoopRunner); | 1862 new content::MessageLoopRunner); |
| 1849 content::HostZoomMap::ZoomLevelChangedCallback callback( | 1863 content::HostZoomMap::ZoomLevelChangedCallback callback( |
| 1850 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); | 1864 base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); |
| 1851 scoped_ptr<content::HostZoomMap::Subscription> sub = | 1865 scoped_ptr<content::HostZoomMap::Subscription> sub = |
| 1852 content::HostZoomMap::GetForBrowserContext( | 1866 content::HostZoomMap::GetForBrowserContext( |
| 1853 browser()->profile())->AddZoomLevelChangedCallback(callback); | 1867 browser()->profile())->AddZoomLevelChangedCallback(callback); |
| 1854 chrome::Zoom(browser(), content::PAGE_ZOOM_OUT); | 1868 chrome::Zoom(browser(), content::PAGE_ZOOM_OUT); |
| 1855 loop_runner->Run(); | 1869 loop_runner->Run(); |
| 1856 sub.reset(); | 1870 sub.reset(); |
| 1857 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90); | 1871 EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 90); |
| 1858 EXPECT_TRUE(enable_plus); | 1872 EXPECT_TRUE(enable_plus); |
| 1859 EXPECT_TRUE(enable_minus); | 1873 EXPECT_TRUE(enable_minus); |
| 1860 } | 1874 } |
| 1861 | 1875 |
| 1862 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); | 1876 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); |
| 1863 } | 1877 } |
| 1864 | 1878 |
| 1865 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { | 1879 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { |
| 1866 ASSERT_TRUE(test_server()->Start()); | 1880 ASSERT_TRUE(test_server()->Start()); |
| 1867 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 1881 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 #endif | 2704 #endif |
| 2691 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2705 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
| 2692 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2706 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
| 2693 gfx::Size exp_final_size(initial_wcv_size); | 2707 gfx::Size exp_final_size(initial_wcv_size); |
| 2694 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2708 exp_final_size.Enlarge(wcv_resize_insets.width(), |
| 2695 wcv_resize_insets.height() + height_inset); | 2709 wcv_resize_insets.height() + height_inset); |
| 2696 EXPECT_EQ(exp_final_size, | 2710 EXPECT_EQ(exp_final_size, |
| 2697 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2711 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
| 2698 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2712 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
| 2699 } | 2713 } |
| OLD | NEW |