OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/zoom/zoom_controller.h" | 5 #include "chrome/browser/ui/zoom/zoom_controller.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ZoomChangedWatcher zoom_change_watcher(web_contents, zoom_change_data); | 108 ZoomChangedWatcher zoom_change_watcher(web_contents, zoom_change_data); |
109 // TODO(wjmaclean): Convert this to call partition-specific zoom level prefs | 109 // TODO(wjmaclean): Convert this to call partition-specific zoom level prefs |
110 // when they become available. | 110 // when they become available. |
111 browser()->profile()->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( | 111 browser()->profile()->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( |
112 new_default_zoom_level); | 112 new_default_zoom_level); |
113 // Because this test relies on a round-trip IPC to/from the renderer process, | 113 // Because this test relies on a round-trip IPC to/from the renderer process, |
114 // we need to wait for it to propagate. | 114 // we need to wait for it to propagate. |
115 zoom_change_watcher.Wait(); | 115 zoom_change_watcher.Wait(); |
116 } | 116 } |
117 | 117 |
118 IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, ErrorPagesDoNotZoom) { | 118 IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, ErrorPagesCanZoom) { |
119 ui_test_utils::NavigateToURL(browser(), GURL("http://kjfhkjsdf.com")); | 119 ui_test_utils::NavigateToURL(browser(), GURL("http://kjfhkjsdf.com")); |
120 content::WebContents* web_contents = | 120 content::WebContents* web_contents = |
121 browser()->tab_strip_model()->GetActiveWebContents(); | 121 browser()->tab_strip_model()->GetActiveWebContents(); |
122 | 122 |
123 ZoomController* zoom_controller = | 123 ZoomController* zoom_controller = |
124 ZoomController::FromWebContents(web_contents); | 124 ZoomController::FromWebContents(web_contents); |
125 EXPECT_EQ( | 125 EXPECT_EQ( |
126 content::PAGE_TYPE_ERROR, | 126 content::PAGE_TYPE_ERROR, |
127 web_contents->GetController().GetLastCommittedEntry()->GetPageType()); | 127 web_contents->GetController().GetLastCommittedEntry()->GetPageType()); |
128 | 128 |
129 double old_zoom_level = zoom_controller->GetZoomLevel(); | 129 double old_zoom_level = zoom_controller->GetZoomLevel(); |
130 double new_zoom_level = old_zoom_level + 0.5; | 130 double new_zoom_level = old_zoom_level + 0.5; |
131 | 131 |
132 // The following attempt to change the zoom level for an error page should | 132 // The following attempt to change the zoom level for an error page should |
133 // fail. | 133 // fail. |
134 zoom_controller->SetZoomLevel(new_zoom_level); | 134 zoom_controller->SetZoomLevel(new_zoom_level); |
135 EXPECT_FLOAT_EQ(old_zoom_level, zoom_controller->GetZoomLevel()); | 135 EXPECT_FLOAT_EQ(new_zoom_level, zoom_controller->GetZoomLevel()); |
136 } | 136 } |
OLD | NEW |