| OLD | NEW |
| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(), |
| 281 "domAutomationController.send(window.innerHeight)", &new_height)); | 281 "domAutomationController.send(window.innerHeight)", &new_height)); |
| 282 ASSERT_DOUBLE_EQ(2.0, static_cast<double>(old_height) / new_height); | 282 ASSERT_DOUBLE_EQ(2.0, static_cast<double>(old_height) / new_height); |
| 283 } | 283 } |
| 284 | 284 |
| 285 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SynthesizeScrollGesture) { | 285 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, DISABLED_SynthesizeScrollGesture) { |
| 286 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html"); | 286 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html"); |
| 287 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); | 287 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 288 Attach(); | 288 Attach(); |
| 289 | 289 |
| 290 int scroll_top; | 290 int scroll_top; |
| 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", std::move(params)); | 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, DISABLED_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 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 GURL("javascript:x=1"), | 482 GURL("javascript:x=1"), |
| 483 nullptr, | 483 nullptr, |
| 484 gfx::Size()); | 484 gfx::Size()); |
| 485 WaitForLoadStop(window->web_contents()); | 485 WaitForLoadStop(window->web_contents()); |
| 486 Attach(); | 486 Attach(); |
| 487 SendCommand("Page.reload", nullptr, false); | 487 SendCommand("Page.reload", nullptr, false); |
| 488 // Should not crash at this point. | 488 // Should not crash at this point. |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace content | 491 } // namespace content |
| OLD | NEW |