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

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

Issue 2211713002: Remove dependency of c/b/loader on c/b/host_zoom_map_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months 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/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
11 #include "content/common/frame_owner_properties.h" 11 #include "content/common/frame_owner_properties.h"
12 #include "content/common/view_messages.h" 12 #include "content/common/view_messages.h"
13 #include "content/public/renderer/document_state.h" 13 #include "content/public/renderer/document_state.h"
14 #include "content/public/test/frame_load_waiter.h" 14 #include "content/public/test/frame_load_waiter.h"
15 #include "content/public/test/render_view_test.h" 15 #include "content/public/test/render_view_test.h"
16 #include "content/public/test/test_utils.h" 16 #include "content/public/test/test_utils.h"
17 #include "content/renderer/navigation_state_impl.h" 17 #include "content/renderer/navigation_state_impl.h"
18 #include "content/renderer/render_frame_impl.h" 18 #include "content/renderer/render_frame_impl.h"
19 #include "content/renderer/render_view_impl.h" 19 #include "content/renderer/render_view_impl.h"
20 #include "content/test/fake_compositor_dependencies.h" 20 #include "content/test/fake_compositor_dependencies.h"
21 #include "content/test/test_render_frame.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" 23 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
23 #include "third_party/WebKit/public/platform/WebString.h" 24 #include "third_party/WebKit/public/platform/WebString.h"
24 #include "third_party/WebKit/public/platform/WebURLRequest.h" 25 #include "third_party/WebKit/public/platform/WebURLRequest.h"
25 #include "third_party/WebKit/public/web/WebHistoryItem.h" 26 #include "third_party/WebKit/public/web/WebHistoryItem.h"
26 #include "third_party/WebKit/public/web/WebLocalFrame.h" 27 #include "third_party/WebKit/public/web/WebLocalFrame.h"
28 #include "third_party/WebKit/public/web/WebView.h"
27 29
28 using blink::WebString; 30 using blink::WebString;
29 31
30 namespace { 32 namespace {
31 const int32_t kSubframeRouteId = 20; 33 const int32_t kSubframeRouteId = 20;
32 const int32_t kSubframeWidgetRouteId = 21; 34 const int32_t kSubframeWidgetRouteId = 21;
33 const int32_t kFrameProxyRouteId = 22; 35 const int32_t kFrameProxyRouteId = 22;
34 } // namespace 36 } // namespace
35 37
36 namespace content { 38 namespace content {
(...skipping 299 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()->OnGotZoomLevel(common_params.url, kMinZoomLevel);
358 TestRenderFrame* frame = static_cast<TestRenderFrame*>(GetMainRenderFrame());
359 frame->Navigate(common_params, StartNavigationParams(),
360 RequestNavigationParams());
361
362 ProcessPendingMessages();
363 EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->zoomLevel());
364
365 // It should work even when the zoom limit is temporarily changed in the page.
366 view_->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0),
367 ZoomFactorToZoomLevel(1.0));
368 common_params.url = GURL("data:text/html,max_zoomlimit_test");
369 GetMainRenderFrame()->OnGotZoomLevel(common_params.url, kMaxZoomLevel);
370 frame->Navigate(common_params, StartNavigationParams(),
371 RequestNavigationParams());
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