OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/child/web_url_loader_impl.h" | 10 #include "content/child/web_url_loader_impl.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 TEST_F(RenderFrameImplTest, ZoomLimit) { | 336 TEST_F(RenderFrameImplTest, ZoomLimit) { |
337 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | 337 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); |
338 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | 338 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); |
339 | 339 |
340 // Verifies navigation to a URL with preset zoom level indeed sets the level. | 340 // Verifies navigation to a URL with preset zoom level indeed sets the level. |
341 // Regression test for http://crbug.com/139559, where the level was not | 341 // Regression test for http://crbug.com/139559, where the level was not |
342 // properly set when it is out of the default zoom limits of WebView. | 342 // properly set when it is out of the default zoom limits of WebView. |
343 CommonNavigationParams common_params; | 343 CommonNavigationParams common_params; |
344 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | 344 common_params.url = GURL("data:text/html,min_zoomlimit_test"); |
| 345 common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; |
345 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMinZoomLevel); | 346 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMinZoomLevel); |
346 GetMainRenderFrame()->NavigateInternal( | 347 GetMainRenderFrame()->NavigateInternal( |
347 common_params, StartNavigationParams(), RequestNavigationParams(), | 348 common_params, StartNavigationParams(), RequestNavigationParams(), |
348 std::unique_ptr<StreamOverrideParameters>()); | 349 std::unique_ptr<StreamOverrideParameters>()); |
349 ProcessPendingMessages(); | 350 ProcessPendingMessages(); |
350 EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->zoomLevel()); | 351 EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->zoomLevel()); |
351 | 352 |
352 // It should work even when the zoom limit is temporarily changed in the page. | 353 // It should work even when the zoom limit is temporarily changed in the page. |
353 view_->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | 354 view_->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), |
354 ZoomFactorToZoomLevel(1.0)); | 355 ZoomFactorToZoomLevel(1.0)); |
355 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | 356 common_params.url = GURL("data:text/html,max_zoomlimit_test"); |
356 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel); | 357 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel); |
357 GetMainRenderFrame()->NavigateInternal( | 358 GetMainRenderFrame()->NavigateInternal( |
358 common_params, StartNavigationParams(), RequestNavigationParams(), | 359 common_params, StartNavigationParams(), RequestNavigationParams(), |
359 std::unique_ptr<StreamOverrideParameters>()); | 360 std::unique_ptr<StreamOverrideParameters>()); |
360 ProcessPendingMessages(); | 361 ProcessPendingMessages(); |
361 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel()); | 362 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel()); |
362 } | 363 } |
363 | 364 |
364 } // namespace | 365 } // namespace |
OLD | NEW |