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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/constructors/create-touch-touchlist.html

Issue 1415673004: Added web-exposed constructor for Touch and TouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed runtime enabled for Touch/TouchInit Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/touch-support.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/constructors/create-touch-touchlist.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/create-touch-touchlist.html b/third_party/WebKit/LayoutTests/fast/events/constructors/create-touch-touchlist.html
new file mode 100644
index 0000000000000000000000000000000000000000..f3debffbbea16f6b9a6cdbcf3fa71dbb2fec2628
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/create-touch-touchlist.html
@@ -0,0 +1,101 @@
+<!--
+ TODO(chongz): Remove this file and import from w3c tests after approved.
+ crbug.com/552530
+-->
+<!DOCTYPE HTML>
+<html>
+<!--
+ Test cases for Touch Events v1 Recommendation
+ http://www.w3.org/TR/touch-events/
+
+ These tests are based on Mozilla-Nokia-Google's single-touch tests.
+
+ The primary purpose of the tests in this document is checking that the createTouch and
+ createTouchList interfaces of the Touch Events APIs are correctly implemented.
+ Other interactions are covered in other test files.
+
+ This document references Test Assertions (abbrev TA below) written by Cathy Chan
+ http://www.w3.org/2010/webevents/wiki/TestAssertions
+-->
+
+<head>
+<title>Touch Events createTouch and createTouchList Interface Tests</title>
+<meta name="viewport" content="width=device-width">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="touch-support.js"></script>
+<script>
+ setup({explicit_done: true});
+
+ function check_touch_clientXY(touch) {
+ assert_equals(touch.clientX, touch.pageX - window.pageXOffset, "touch.clientX is touch.pageX - window.pageXOffset.");
+ assert_equals(touch.clientY, touch.pageY - window.pageYOffset, "touch.clientY is touch.pageY - window.pageYOffset.");
+ }
+
+ function run() {
+ var target0 = document.getElementById("target0");
+ var touch1, touch2;
+
+ test(function() {
+ touch1 = document.createTouch(window, target0, 42, 15, 20, 35, 40);
+ assert_equals(touch1.target, target0, "touch.target is target0");
+ assert_equals(touch1.identifier, 42, "touch.identifier is requested value");
+ assert_equals(touch1.pageX, 15, "touch.pageX is requested value");
+ assert_equals(touch1.pageY, 20, "touch.pageY is requested value");
+ check_touch_clientXY(touch1);
+ assert_equals(touch1.screenX, 35, "touch.screenX is requested value");
+ assert_equals(touch1.screenY, 40, "touch.screenY is requested value");
+ }, "document.createTouch exists and creates a Touch object with requested properties");
+
+ touch2 = document.createTouch(window, target0, 44, 25, 30, 45, 50);
+
+ var touchList;
+
+ test(function() {
+ touchList = document.createTouchList();
+ assert_equals(touchList.length, 0, "touchList.length is 0");
+ }, "document.createTouchList exists and correctly creates a TouchList from zero Touch objects");
+
+ if (touchList)
+ check_TouchList_object(touchList);
+
+ test(function() {
+ touchList = document.createTouchList(touch1);
+ assert_equals(touchList.length, 1, "touchList.length is 1");
+ assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
+ }, "document.createTouchList exists and correctly creates a TouchList from a single Touch");
+
+ if (touchList)
+ check_TouchList_object(touchList);
+
+ test(function() {
+ touchList = document.createTouchList(touch1, touch2);
+ assert_equals(touchList.length, 2, "touchList.length is 2");
+ assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
+ assert_equals(touchList.item(1), touch2, "touchList.item(1) is input touch2");
+ }, "document.createTouchList exists and correctly creates a TouchList from two Touch objects");
+
+ if (touchList)
+ check_TouchList_object(touchList);
+
+ target0.innerHTML = "Test complete."
+ done();
+ }
+</script>
+<style>
+ div {
+ margin: 0em;
+ padding: 2em;
+ }
+ #target0 {
+ background: yellow;
+ border: 1px solid orange;
+ }
+</style>
+</head>
+<body onload="run()">
+ <h1>Touch Events: createTouch and createTouchList tests</h1>
+ <div id="target0">Please wait for test to complete...</div>
+ <div id="log"></div>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/touch-support.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698