Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: content/browser/iframe_zoom_browsertest.cc

Issue 2136453004: Reland of place string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/frame_host/render_frame_host_impl.h" 9 #include "content/browser/frame_host/render_frame_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/host_zoom_map.h" 11 #include "content/public/browser/host_zoom_map.h"
11 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/common/page_zoom.h" 13 #include "content/public/common/page_zoom.h"
13 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
14 #include "content/public/test/content_browser_test.h" 15 #include "content/public/test/content_browser_test.h"
15 #include "content/public/test/content_browser_test_utils.h" 16 #include "content/public/test/content_browser_test_utils.h"
16 #include "content/public/test/test_navigation_observer.h" 17 #include "content/public/test/test_navigation_observer.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const char kOnResizeCallbackSetup[] = 115 const char kOnResizeCallbackSetup[] =
115 "document.body.onresize = function(){" 116 "document.body.onresize = function(){"
116 " window.domAutomationController.setAutomationId(0);" 117 " window.domAutomationController.setAutomationId(0);"
117 " window.domAutomationController.send('%s ' + window.innerWidth);" 118 " window.domAutomationController.send('%s ' + window.innerWidth);"
118 "};"; 119 "};";
119 EXPECT_TRUE(ExecuteScript( 120 EXPECT_TRUE(ExecuteScript(
120 adapter, base::StringPrintf(kOnResizeCallbackSetup, label.c_str()))); 121 adapter, base::StringPrintf(kOnResizeCallbackSetup, label.c_str())));
121 } 122 }
122 123
123 void Check(const std::string& status_msg) { 124 void Check(const std::string& status_msg) {
124 if (status_msg.find(msg_label) != 0) 125 if (!base::StartsWith(status_msg, msg_label, base::CompareCase::SENSITIVE))
125 return; 126 return;
126 127
127 double inner_width = std::stod(status_msg.substr(msg_label.length() + 1)); 128 double inner_width = std::stod(status_msg.substr(msg_label.length() + 1));
128 zoomed_correctly = std::abs(expected_inner_width - inner_width) < tolerance; 129 zoomed_correctly = std::abs(expected_inner_width - inner_width) < tolerance;
129 } 130 }
130 131
131 FrameResizeObserver* toThis() {return this;} 132 FrameResizeObserver* toThis() {return this;}
132 133
133 RenderFrameHost* frame_host; 134 RenderFrameHost* frame_host;
134 std::string msg_label; 135 std::string msg_label;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL()); 472 EXPECT_EQ(redirect_url, web_contents()->GetLastCommittedURL());
472 473
473 EXPECT_NEAR( 474 EXPECT_NEAR(
474 kZoomFactorForRedirectedHost, 475 kZoomFactorForRedirectedHost,
475 GetMainFrameZoomFactor(web_contents(), main_frame_window_border), 476 GetMainFrameZoomFactor(web_contents(), main_frame_window_border),
476 0.001); 477 0.001);
477 } 478 }
478 #endif 479 #endif
479 480
480 } // namespace content 481 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698