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" | |
8 #include "content/browser/frame_host/frame_tree_node.h" | 7 #include "content/browser/frame_host/frame_tree_node.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 8 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
11 #include "content/public/browser/host_zoom_map.h" | 10 #include "content/public/browser/host_zoom_map.h" |
12 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
13 #include "content/public/common/page_zoom.h" | 12 #include "content/public/common/page_zoom.h" |
14 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
15 #include "content/public/test/content_browser_test.h" | 14 #include "content/public/test/content_browser_test.h" |
16 #include "content/public/test/content_browser_test_utils.h" | 15 #include "content/public/test/content_browser_test_utils.h" |
17 #include "content/public/test/test_navigation_observer.h" | 16 #include "content/public/test/test_navigation_observer.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const char kOnResizeCallbackSetup[] = | 114 const char kOnResizeCallbackSetup[] = |
116 "document.body.onresize = function(){" | 115 "document.body.onresize = function(){" |
117 " window.domAutomationController.setAutomationId(0);" | 116 " window.domAutomationController.setAutomationId(0);" |
118 " window.domAutomationController.send('%s ' + window.innerWidth);" | 117 " window.domAutomationController.send('%s ' + window.innerWidth);" |
119 "};"; | 118 "};"; |
120 EXPECT_TRUE(ExecuteScript( | 119 EXPECT_TRUE(ExecuteScript( |
121 adapter, base::StringPrintf(kOnResizeCallbackSetup, label.c_str()))); | 120 adapter, base::StringPrintf(kOnResizeCallbackSetup, label.c_str()))); |
122 } | 121 } |
123 | 122 |
124 void Check(const std::string& status_msg) { | 123 void Check(const std::string& status_msg) { |
125 if (!base::StartsWith(status_msg, msg_label, base::CompareCase::SENSITIVE)) | 124 if (status_msg.find(msg_label) != 0) |
126 return; | 125 return; |
127 | 126 |
128 double inner_width = std::stod(status_msg.substr(msg_label.length() + 1)); | 127 double inner_width = std::stod(status_msg.substr(msg_label.length() + 1)); |
129 zoomed_correctly = std::abs(expected_inner_width - inner_width) < tolerance; | 128 zoomed_correctly = std::abs(expected_inner_width - inner_width) < tolerance; |
130 } | 129 } |
131 | 130 |
132 FrameResizeObserver* toThis() {return this;} | 131 FrameResizeObserver* toThis() {return this;} |
133 | 132 |
134 RenderFrameHost* frame_host; | 133 RenderFrameHost* frame_host; |
135 std::string msg_label; | 134 std::string msg_label; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); | 471 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); |
473 | 472 |
474 EXPECT_NEAR( | 473 EXPECT_NEAR( |
475 kZoomFactorForRedirectedHost, | 474 kZoomFactorForRedirectedHost, |
476 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), | 475 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), |
477 0.001); | 476 0.001); |
478 } | 477 } |
479 #endif | 478 #endif |
480 | 479 |
481 } // namespace content | 480 } // namespace content |
OLD | NEW |