| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |