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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 1552733002: Convert Pass()→std::move() in //content (Android edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 int old_height; 261 int old_height;
262 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 262 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
263 shell()->web_contents(), 263 shell()->web_contents(),
264 "domAutomationController.send(window.innerHeight)", &old_height)); 264 "domAutomationController.send(window.innerHeight)", &old_height));
265 265
266 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 266 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue());
267 params->SetInteger("x", old_width / 2); 267 params->SetInteger("x", old_width / 2);
268 params->SetInteger("y", old_height / 2); 268 params->SetInteger("y", old_height / 2);
269 params->SetDouble("scaleFactor", 2.0); 269 params->SetDouble("scaleFactor", 2.0);
270 SendCommand("Input.synthesizePinchGesture", params.Pass()); 270 SendCommand("Input.synthesizePinchGesture", std::move(params));
271 271
272 int new_width; 272 int new_width;
273 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 273 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
274 shell()->web_contents(), 274 shell()->web_contents(),
275 "domAutomationController.send(window.innerWidth)", &new_width)); 275 "domAutomationController.send(window.innerWidth)", &new_width));
276 ASSERT_DOUBLE_EQ(2.0, static_cast<double>(old_width) / new_width); 276 ASSERT_DOUBLE_EQ(2.0, static_cast<double>(old_width) / new_width);
277 277
278 int new_height; 278 int new_height;
279 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 279 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
280 shell()->web_contents(), 280 shell()->web_contents(),
(...skipping 10 matching lines...) Expand all
291 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 291 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
292 shell()->web_contents(), 292 shell()->web_contents(),
293 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); 293 "domAutomationController.send(document.body.scrollTop)", &scroll_top));
294 ASSERT_EQ(0, scroll_top); 294 ASSERT_EQ(0, scroll_top);
295 295
296 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 296 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue());
297 params->SetInteger("x", 0); 297 params->SetInteger("x", 0);
298 params->SetInteger("y", 0); 298 params->SetInteger("y", 0);
299 params->SetInteger("xDistance", 0); 299 params->SetInteger("xDistance", 0);
300 params->SetInteger("yDistance", -100); 300 params->SetInteger("yDistance", -100);
301 SendCommand("Input.synthesizeScrollGesture", params.Pass()); 301 SendCommand("Input.synthesizeScrollGesture", std::move(params));
302 302
303 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 303 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
304 shell()->web_contents(), 304 shell()->web_contents(),
305 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); 305 "domAutomationController.send(document.body.scrollTop)", &scroll_top));
306 ASSERT_EQ(100, scroll_top); 306 ASSERT_EQ(100, scroll_top);
307 } 307 }
308 308
309 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SynthesizeTapGesture) { 309 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SynthesizeTapGesture) {
310 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html"); 310 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html");
311 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); 311 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1);
312 Attach(); 312 Attach();
313 313
314 int scroll_top; 314 int scroll_top;
315 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 315 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
316 shell()->web_contents(), 316 shell()->web_contents(),
317 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); 317 "domAutomationController.send(document.body.scrollTop)", &scroll_top));
318 ASSERT_EQ(0, scroll_top); 318 ASSERT_EQ(0, scroll_top);
319 319
320 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 320 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue());
321 params->SetInteger("x", 16); 321 params->SetInteger("x", 16);
322 params->SetInteger("y", 16); 322 params->SetInteger("y", 16);
323 params->SetString("gestureSourceType", "touch"); 323 params->SetString("gestureSourceType", "touch");
324 SendCommand("Input.synthesizeTapGesture", params.Pass()); 324 SendCommand("Input.synthesizeTapGesture", std::move(params));
325 325
326 // The link that we just tapped should take us to the bottom of the page. The 326 // The link that we just tapped should take us to the bottom of the page. The
327 // new value of |document.body.scrollTop| will depend on the screen dimensions 327 // new value of |document.body.scrollTop| will depend on the screen dimensions
328 // of the device that we're testing on, but in any case it should be greater 328 // of the device that we're testing on, but in any case it should be greater
329 // than 0. 329 // than 0.
330 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 330 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
331 shell()->web_contents(), 331 shell()->web_contents(),
332 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); 332 "domAutomationController.send(document.body.scrollTop)", &scroll_top));
333 ASSERT_GT(scroll_top, 0); 333 ASSERT_GT(scroll_top, 0);
334 } 334 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 GURL("javascript:x=1"), 480 GURL("javascript:x=1"),
481 nullptr, 481 nullptr,
482 gfx::Size()); 482 gfx::Size());
483 WaitForLoadStop(window->web_contents()); 483 WaitForLoadStop(window->web_contents());
484 Attach(); 484 Attach();
485 SendCommand("Page.reload", nullptr, false); 485 SendCommand("Page.reload", nullptr, false);
486 // Should not crash at this point. 486 // Should not crash at this point.
487 } 487 }
488 488
489 } // namespace content 489 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/java/java_type.cc ('k') | content/browser/media/android/browser_media_player_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698