| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 frame_observers.emplace_back(grandchild, "grandchild", | 199 frame_observers.emplace_back(grandchild, "grandchild", |
| 200 scale_one_grandchild_width, kTolerance); | 200 scale_one_grandchild_width, kTolerance); |
| 201 | 201 |
| 202 const double new_zoom_level = | 202 const double new_zoom_level = |
| 203 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); | 203 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); |
| 204 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); | 204 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); |
| 205 | 205 |
| 206 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 206 WaitAndCheckFrameZoom(msg_queue, frame_observers); |
| 207 } | 207 } |
| 208 | 208 |
| 209 EXPECT_DOUBLE_EQ( | 209 // Make this comparison approximate for Nexus5X test; |
| 210 // https://crbug.com/622858. |
| 211 EXPECT_NEAR( |
| 210 new_zoom_factor, | 212 new_zoom_factor, |
| 211 GetMainFrameZoomFactor(web_contents(), main_frame_window_border)); | 213 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
| 214 0.01); |
| 212 } | 215 } |
| 213 | 216 |
| 214 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SubframesDontZoomIndependently) { | 217 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SubframesDontZoomIndependently) { |
| 215 std::string top_level_host("a.com"); | 218 std::string top_level_host("a.com"); |
| 216 GURL main_url(embedded_test_server()->GetURL( | 219 GURL main_url(embedded_test_server()->GetURL( |
| 217 top_level_host, "/cross_site_iframe_factory.html?a(b(a))")); | 220 top_level_host, "/cross_site_iframe_factory.html?a(b(a))")); |
| 218 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 221 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 219 NavigationEntry* entry = | 222 NavigationEntry* entry = |
| 220 web_contents()->GetController().GetLastCommittedEntry(); | 223 web_contents()->GetController().GetLastCommittedEntry(); |
| 221 ASSERT_TRUE(entry); | 224 ASSERT_TRUE(entry); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 frame_observers.emplace_back(child2, "child2", | 359 frame_observers.emplace_back(child2, "child2", |
| 357 scale_one_child2_width, kTolerance); | 360 scale_one_child2_width, kTolerance); |
| 358 | 361 |
| 359 const double new_zoom_level = | 362 const double new_zoom_level = |
| 360 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); | 363 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); |
| 361 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); | 364 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); |
| 362 | 365 |
| 363 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 366 WaitAndCheckFrameZoom(msg_queue, frame_observers); |
| 364 } | 367 } |
| 365 | 368 |
| 366 EXPECT_DOUBLE_EQ( | 369 // Make this comparison approximate for Nexus5X test; |
| 370 // https://crbug.com/622858. |
| 371 EXPECT_NEAR( |
| 367 new_zoom_factor, | 372 new_zoom_factor, |
| 368 GetMainFrameZoomFactor(web_contents(), main_frame_window_border)); | 373 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
| 374 0.01); |
| 369 } | 375 } |
| 370 | 376 |
| 371 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SubframeRetainsZoomOnNavigation) { | 377 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SubframeRetainsZoomOnNavigation) { |
| 372 std::string top_level_host("a.com"); | 378 std::string top_level_host("a.com"); |
| 373 GURL main_url(embedded_test_server()->GetURL( | 379 GURL main_url(embedded_test_server()->GetURL( |
| 374 top_level_host, "/cross_site_iframe_factory.html?a(b)")); | 380 top_level_host, "/cross_site_iframe_factory.html?a(b)")); |
| 375 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 381 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 376 NavigationEntry* entry = | 382 NavigationEntry* entry = |
| 377 web_contents()->GetController().GetLastCommittedEntry(); | 383 web_contents()->GetController().GetLastCommittedEntry(); |
| 378 ASSERT_TRUE(entry); | 384 ASSERT_TRUE(entry); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); | 463 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); |
| 458 | 464 |
| 459 EXPECT_NEAR( | 465 EXPECT_NEAR( |
| 460 kZoomFactorForRedirectedHost, | 466 kZoomFactorForRedirectedHost, |
| 461 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 467 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
| 462 0.001); | 468 0.001); |
| 463 } | 469 } |
| 464 #endif | 470 #endif |
| 465 | 471 |
| 466 } // namespace content | 472 } // namespace content |
| OLD | NEW |