Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: content/renderer/render_frame_impl_browsertest.cc

Issue 2374863002: Remove usage of HostZoomMap from c/b/loader via ReadyToCommitNavigation (Closed)
Patch Set: init Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/frame_messages.h" 11 #include "content/common/frame_messages.h"
11 #include "content/common/frame_owner_properties.h" 12 #include "content/common/frame_owner_properties.h"
12 #include "content/common/renderer.mojom.h" 13 #include "content/common/renderer.mojom.h"
13 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
14 #include "content/public/renderer/document_state.h" 15 #include "content/public/renderer/document_state.h"
15 #include "content/public/test/frame_load_waiter.h" 16 #include "content/public/test/frame_load_waiter.h"
16 #include "content/public/test/render_view_test.h" 17 #include "content/public/test/render_view_test.h"
17 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
18 #include "content/renderer/navigation_state_impl.h" 19 #include "content/renderer/navigation_state_impl.h"
19 #include "content/renderer/render_frame_impl.h" 20 #include "content/renderer/render_frame_impl.h"
20 #include "content/renderer/render_view_impl.h" 21 #include "content/renderer/render_view_impl.h"
21 #include "content/test/fake_compositor_dependencies.h" 22 #include "content/test/fake_compositor_dependencies.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" 24 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
24 #include "third_party/WebKit/public/platform/WebString.h" 25 #include "third_party/WebKit/public/platform/WebString.h"
25 #include "third_party/WebKit/public/platform/WebURLRequest.h" 26 #include "third_party/WebKit/public/platform/WebURLRequest.h"
26 #include "third_party/WebKit/public/web/WebHistoryItem.h" 27 #include "third_party/WebKit/public/web/WebHistoryItem.h"
27 #include "third_party/WebKit/public/web/WebLocalFrame.h" 28 #include "third_party/WebKit/public/web/WebLocalFrame.h"
29 #include "third_party/WebKit/public/web/WebView.h"
28 30
29 using blink::WebString; 31 using blink::WebString;
30 32
31 namespace { 33 namespace {
32 const int32_t kSubframeRouteId = 20; 34 const int32_t kSubframeRouteId = 20;
33 const int32_t kSubframeWidgetRouteId = 21; 35 const int32_t kSubframeWidgetRouteId = 21;
34 const int32_t kFrameProxyRouteId = 22; 36 const int32_t kFrameProxyRouteId = 22;
35 } // namespace 37 } // namespace
36 38
37 namespace content { 39 namespace content {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 338
337 const std::string exceeded_data_url(1024 * 1024 * 20 + 1, 'd'); 339 const std::string exceeded_data_url(1024 * 1024 * 20 + 1, 'd');
338 340
339 frame()->saveImageFromDataURL(WebString::fromUTF8(exceeded_data_url)); 341 frame()->saveImageFromDataURL(WebString::fromUTF8(exceeded_data_url));
340 ProcessPendingMessages(); 342 ProcessPendingMessages();
341 const IPC::Message* msg4 = render_thread_->sink().GetFirstMessageMatching( 343 const IPC::Message* msg4 = render_thread_->sink().GetFirstMessageMatching(
342 FrameHostMsg_SaveImageFromDataURL::ID); 344 FrameHostMsg_SaveImageFromDataURL::ID);
343 EXPECT_FALSE(msg4); 345 EXPECT_FALSE(msg4);
344 } 346 }
345 347
348 TEST_F(RenderFrameImplTest, ZoomLimit) {
349 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor);
350 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor);
351
352 // Verifies navigation to a URL with preset zoom level indeed sets the level.
353 // Regression test for http://crbug.com/139559, where the level was not
354 // properly set when it is out of the default zoom limits of WebView.
355 CommonNavigationParams common_params;
356 common_params.url = GURL("data:text/html,min_zoomlimit_test");
357 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMinZoomLevel);
358 GetMainRenderFrame()->NavigateInternal(
359 common_params, StartNavigationParams(), RequestNavigationParams(),
360 std::unique_ptr<StreamOverrideParameters>());
361 ProcessPendingMessages();
362 EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->zoomLevel());
363
364 // It should work even when the zoom limit is temporarily changed in the page.
365 view_->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0),
366 ZoomFactorToZoomLevel(1.0));
367 common_params.url = GURL("data:text/html,max_zoomlimit_test");
368 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel);
369 GetMainRenderFrame()->NavigateInternal(
370 common_params, StartNavigationParams(), RequestNavigationParams(),
371 std::unique_ptr<StreamOverrideParameters>());
372 ProcessPendingMessages();
373 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel());
374 }
375
346 } // namespace 376 } // namespace
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698