 Chromium Code Reviews
 Chromium Code Reviews Issue 2100233002:
  Also use EXPECT_NEAR in AllFramesGetDefaultZoom and SubframeRetainsZoomOnNavigation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2100233002:
  Also use EXPECT_NEAR in AllFramesGetDefaultZoom and SubframeRetainsZoomOnNavigation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 scale_one_grandchild_width, kTolerance); | 309 scale_one_grandchild_width, kTolerance); | 
| 310 | 310 | 
| 311 const double new_default_zoom_level = | 311 const double new_default_zoom_level = | 
| 312 default_zoom_level + ZoomFactorToZoomLevel(new_default_zoom_factor); | 312 default_zoom_level + ZoomFactorToZoomLevel(new_default_zoom_factor); | 
| 313 | 313 | 
| 314 host_zoom_map->SetZoomLevelForHost("b.com", new_default_zoom_level + 1.0); | 314 host_zoom_map->SetZoomLevelForHost("b.com", new_default_zoom_level + 1.0); | 
| 315 host_zoom_map->SetDefaultZoomLevel(new_default_zoom_level); | 315 host_zoom_map->SetDefaultZoomLevel(new_default_zoom_level); | 
| 316 | 316 | 
| 317 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 317 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 
| 318 } | 318 } | 
| 319 EXPECT_DOUBLE_EQ( | 319 // Make this comparison approximate for Nexus5X test; | 
| 320 // https://crbug.com/622858. | |
| 321 EXPECT_NEAR( | |
| 320 new_default_zoom_factor, | 322 new_default_zoom_factor, | 
| 321 GetMainFrameZoomFactor(web_contents(), main_frame_window_border)); | 323 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 
| 324 0.01 | |
| 325 ); | |
| 322 } | 326 } | 
| 323 | 327 | 
| 324 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SiblingFramesZoom) { | 328 IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest, SiblingFramesZoom) { | 
| 325 std::string top_level_host("a.com"); | 329 std::string top_level_host("a.com"); | 
| 326 GURL main_url(embedded_test_server()->GetURL( | 330 GURL main_url(embedded_test_server()->GetURL( | 
| 327 top_level_host, "/cross_site_iframe_factory.html?a(b,b)")); | 331 top_level_host, "/cross_site_iframe_factory.html?a(b,b)")); | 
| 328 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 332 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 
| 329 NavigationEntry* entry = | 333 NavigationEntry* entry = | 
| 330 web_contents()->GetController().GetLastCommittedEntry(); | 334 web_contents()->GetController().GetLastCommittedEntry(); | 
| 331 ASSERT_TRUE(entry); | 335 ASSERT_TRUE(entry); | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 frame_observers.emplace_back(child, "child", | 412 frame_observers.emplace_back(child, "child", | 
| 409 scale_one_child_width, kTolerance); | 413 scale_one_child_width, kTolerance); | 
| 410 | 414 | 
| 411 const double new_zoom_level = | 415 const double new_zoom_level = | 
| 412 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); | 416 default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor); | 
| 413 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); | 417 host_zoom_map->SetZoomLevelForHost(top_level_host, new_zoom_level); | 
| 414 | 418 | 
| 415 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 419 WaitAndCheckFrameZoom(msg_queue, frame_observers); | 
| 416 } | 420 } | 
| 417 | 421 | 
| 418 EXPECT_DOUBLE_EQ( | 422 EXPECT_DOUBLE_EQ( | 
| 
Charlie Reis
2016/06/27 21:23:08
What about this one?
 
wjmaclean
2016/06/27 21:53:58
Sure, given the use of log/exp in converting betwe
 
ghost stip (do not use)
2016/06/27 23:21:16
Done.
 | |
| 419 new_zoom_factor, | 423 new_zoom_factor, | 
| 420 GetMainFrameZoomFactor(web_contents(), main_frame_window_border)); | 424 GetMainFrameZoomFactor(web_contents(), main_frame_window_border)); | 
| 421 | 425 | 
| 422 // Navigate child frame cross site, and make sure zoom is the same. | 426 // Navigate child frame cross site, and make sure zoom is the same. | 
| 423 TestNavigationObserver observer(web_contents()); | 427 TestNavigationObserver observer(web_contents()); | 
| 424 GURL url = embedded_test_server()->GetURL("c.com", "/title1.html"); | 428 GURL url = embedded_test_server()->GetURL("c.com", "/title1.html"); | 
| 425 NavigateFrameToURL(root->child_at(0), url); | 429 NavigateFrameToURL(root->child_at(0), url); | 
| 426 EXPECT_TRUE(observer.last_navigation_succeeded()); | 430 EXPECT_TRUE(observer.last_navigation_succeeded()); | 
| 427 EXPECT_EQ(url, observer.last_navigation_url()); | 431 EXPECT_EQ(url, observer.last_navigation_url()); | 
| 428 | 432 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); | 467 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); | 
| 464 | 468 | 
| 465 EXPECT_NEAR( | 469 EXPECT_NEAR( | 
| 466 kZoomFactorForRedirectedHost, | 470 kZoomFactorForRedirectedHost, | 
| 467 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 471 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 
| 468 0.001); | 472 0.001); | 
| 469 } | 473 } | 
| 470 #endif | 474 #endif | 
| 471 | 475 | 
| 472 } // namespace content | 476 } // namespace content | 
| OLD | NEW |