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

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

Issue 1964273002: Add FrameHost mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android-2 Created 4 years, 7 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
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/view_messages.h" 11 #include "content/common/view_messages.h"
12 #include "content/public/renderer/document_state.h" 12 #include "content/public/renderer/document_state.h"
13 #include "content/public/test/frame_load_waiter.h" 13 #include "content/public/test/frame_load_waiter.h"
14 #include "content/public/test/render_view_test.h" 14 #include "content/public/test/render_view_test.h"
15 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
16 #include "content/renderer/navigation_state_impl.h" 16 #include "content/renderer/navigation_state_impl.h"
17 #include "content/renderer/render_frame_impl.h" 17 #include "content/renderer/render_frame_impl.h"
18 #include "content/renderer/render_view_impl.h" 18 #include "content/renderer/render_view_impl.h"
19 #include "content/test/fake_compositor_dependencies.h" 19 #include "content/test/fake_compositor_dependencies.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" 21 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
22 #include "third_party/WebKit/public/platform/WebURLRequest.h" 22 #include "third_party/WebKit/public/platform/WebURLRequest.h"
23 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" 23 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
24 #include "third_party/WebKit/public/web/WebHistoryItem.h" 24 #include "third_party/WebKit/public/web/WebHistoryItem.h"
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" 25 #include "third_party/WebKit/public/web/WebLocalFrame.h"
26 #include "third_party/WebKit/public/web/WebView.h"
26 27
27 namespace { 28 namespace {
28 const int32_t kSubframeRouteId = 20; 29 const int32_t kSubframeRouteId = 20;
29 const int32_t kSubframeWidgetRouteId = 21; 30 const int32_t kSubframeWidgetRouteId = 21;
30 const int32_t kFrameProxyRouteId = 22; 31 const int32_t kFrameProxyRouteId = 22;
31 } // namespace 32 } // namespace
32 33
33 namespace content { 34 namespace content {
34 35
35 // RenderFrameImplTest creates a RenderFrameImpl that is a child of the 36 // RenderFrameImplTest creates a RenderFrameImpl that is a child of the
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); 284 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit);
284 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, 285 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown,
285 GetMainRenderFrame()->getEffectiveConnectionType()); 286 GetMainRenderFrame()->getEffectiveConnectionType());
286 287
287 // The subframe would be deleted here after a cross-document navigation. 288 // The subframe would be deleted here after a cross-document navigation.
288 // It happens to be left around in this test because this does not simulate 289 // It happens to be left around in this test because this does not simulate
289 // the frame detach. 290 // the frame detach.
290 } 291 }
291 } 292 }
292 293
294 TEST_F(RenderFrameImplTest, ZoomLimit) {
295 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor);
296 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor);
297
298 // Verifies navigation to a URL with preset zoom level indeed sets the level.
299 // Regression test for http://crbug.com/139559, where the level was not
300 // properly set when it is out of the default zoom limits of WebView.
301 CommonNavigationParams common_params;
302 common_params.url = GURL("data:text/html,min_zoomlimit_test");
303 GetMainRenderFrame()->OnGotZoomLevel(common_params.url, kMinZoomLevel);
304 GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(),
305 RequestNavigationParams());
306 ProcessPendingMessages();
307 EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->zoomLevel());
308
309 // It should work even when the zoom limit is temporarily changed in the page.
310 view_->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0),
311 ZoomFactorToZoomLevel(1.0));
312 common_params.url = GURL("data:text/html,max_zoomlimit_test");
313 GetMainRenderFrame()->OnGotZoomLevel(common_params.url, kMaxZoomLevel);
314 GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(),
315 RequestNavigationParams());
316 ProcessPendingMessages();
317 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel());
318 }
319
293 } // namespace 320 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698