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

Side by Side Diff: content/browser/iframe_zoom_browsertest.cc

Issue 1953503005: RenderView needs to know zoom level for loading pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stale comment. 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
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <vector> 5 #include <vector>
6 6
7 #include "content/browser/frame_host/frame_tree_node.h" 7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/frame_host/render_frame_host_impl.h" 8 #include "content/browser/frame_host/render_frame_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/host_zoom_map.h" 10 #include "content/public/browser/host_zoom_map.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 EXPECT_TRUE(observer.last_navigation_succeeded()); 420 EXPECT_TRUE(observer.last_navigation_succeeded());
421 EXPECT_EQ(url, observer.last_navigation_url()); 421 EXPECT_EQ(url, observer.last_navigation_url());
422 422
423 // Check that the child frame maintained the same scale after navigating 423 // Check that the child frame maintained the same scale after navigating
424 // cross-site. 424 // cross-site.
425 double new_child_width = 425 double new_child_width =
426 GetSubframeWidth(root->child_at(0)->current_frame_host()); 426 GetSubframeWidth(root->child_at(0)->current_frame_host());
427 EXPECT_EQ(scale_one_child_width, new_child_width); 427 EXPECT_EQ(scale_one_child_width, new_child_width);
428 } 428 }
429 429
430 // http://crbug.com/609213
431 #if !defined(OS_ANDROID)
432 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest,
433 RedirectToPageWithSubframeZoomsCorrectly) {
434 std::string initial_host("a.com");
435 std::string redirected_host("b.com");
436 EXPECT_TRUE(NavigateToURL(shell(), GURL(embedded_test_server()->GetURL(
437 initial_host, "/title2.html"))));
438 double main_frame_window_border = GetMainframeWindowBorder(web_contents());
439 EXPECT_DOUBLE_EQ(
440 1.0, GetMainFrameZoomFactor(web_contents(), main_frame_window_border));
441
442 // Set a zoom level for b.com before we navigate to it.
443 const double kZoomFactorForRedirectedHost = 1.5;
444 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents());
445 host_zoom_map->SetZoomLevelForHost(
446 redirected_host, ZoomFactorToZoomLevel(kZoomFactorForRedirectedHost));
447
448 // Navigation to a.com doesn't change the zoom level, but when it redirects
449 // to b.com, and then a subframe loads, the zoom should change.
450 GURL redirect_url(embedded_test_server()->GetURL(
451 redirected_host, "/cross_site_iframe_factory.html?b(b)"));
452 GURL url(embedded_test_server()->GetURL(
453 initial_host, "/client-redirect?" + redirect_url.spec()));
454
455 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 2);
456 EXPECT_TRUE(IsLastCommittedEntryOfPageType(web_contents(), PAGE_TYPE_NORMAL));
457 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL());
458
459 EXPECT_NEAR(
460 kZoomFactorForRedirectedHost,
461 GetMainFrameZoomFactor(web_contents(), main_frame_window_border),
462 0.001);
463 }
464 #endif
465
430 } // namespace content 466 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698