| 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 "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "content/browser/frame_host/frame_tree_node.h" | 8 #include "content/browser/frame_host/frame_tree_node.h" |
| 9 #include "content/browser/frame_host/render_frame_host_impl.h" | 9 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 // to b.com, and then a subframe loads, the zoom should change. | 577 // to b.com, and then a subframe loads, the zoom should change. |
| 578 GURL redirect_url(embedded_test_server()->GetURL( | 578 GURL redirect_url(embedded_test_server()->GetURL( |
| 579 redirected_host, "/cross_site_iframe_factory.html?b(b)")); | 579 redirected_host, "/cross_site_iframe_factory.html?b(b)")); |
| 580 GURL url(embedded_test_server()->GetURL( | 580 GURL url(embedded_test_server()->GetURL( |
| 581 initial_host, "/client-redirect?" + redirect_url.spec())); | 581 initial_host, "/client-redirect?" + redirect_url.spec())); |
| 582 | 582 |
| 583 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 2); | 583 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 2); |
| 584 EXPECT_TRUE(IsLastCommittedEntryOfPageType(web_contents(), PAGE_TYPE_NORMAL)); | 584 EXPECT_TRUE(IsLastCommittedEntryOfPageType(web_contents(), PAGE_TYPE_NORMAL)); |
| 585 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); | 585 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); |
| 586 | 586 |
| 587 EXPECT_NEAR( | 587 EXPECT_NEAR(kZoomFactorForRedirectedHost, |
| 588 kZoomFactorForRedirectedHost, | 588 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
| 589 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 589 0.01); |
| 590 0.001); | |
| 591 } | 590 } |
| 592 #endif | 591 #endif |
| 593 | 592 |
| 594 // Tests that on cross-site navigation from a page that has a subframe, the | 593 // Tests that on cross-site navigation from a page that has a subframe, the |
| 595 // appropriate zoom is applied to the new page. | 594 // appropriate zoom is applied to the new page. |
| 596 // crbug.com/673065 | 595 // crbug.com/673065 |
| 597 // Note: We exclude the this test on Android since Android does not set page | 596 // Note: We exclude the this test on Android since Android does not set page |
| 598 // zoom levels for loading pages. | 597 // zoom levels for loading pages. |
| 599 // See RenderFrameImpl::SetHostZoomLevel(). | 598 // See RenderFrameImpl::SetHostZoomLevel(). |
| 600 #if !defined(OS_ANDROID) | 599 #if !defined(OS_ANDROID) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // approximate. As the common failure mode would be that the zoom is ~1 | 651 // approximate. As the common failure mode would be that the zoom is ~1 |
| 653 // instead of ~2, this approximation shouldn't be problematic. | 652 // instead of ~2, this approximation shouldn't be problematic. |
| 654 EXPECT_NEAR( | 653 EXPECT_NEAR( |
| 655 new_zoom_factor, | 654 new_zoom_factor, |
| 656 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 655 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
| 657 .1); | 656 .1); |
| 658 } | 657 } |
| 659 #endif | 658 #endif |
| 660 | 659 |
| 661 } // namespace content | 660 } // namespace content |
| OLD | NEW |