Skip to content

Commit

Permalink
Use NotFoundError instead of InvalidPointerId
Browse files Browse the repository at this point in the history
This cl follows the new pointerevent spec which
uses more common WebIDL specified exception
NotFoundError instead of defining new
InvalidPointerId exception.

Bug: 885321
Change-Id: I28e946ffcb96c9fb4f70c76a4b9c09be620f981d
Reviewed-on: https://chromium-review.googlesource.com/1231990
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Ella Ge <eirage@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592903}
  • Loading branch information
NavidZ authored and chromium-wpt-export-bot committed Sep 20, 2018
1 parent 6718d7d commit c73ea25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!doctype html>
<html>
<head>
<title>Pointer Event: releasePointerCapture DOMException - InvalidPointerId</title>
<meta name="assert" content="releasePointerCapture DOMException - InvalidPointerId"/>
<title>Pointer Event: releasePointerCapture DOMException - NotFoundError</title>
<meta name="assert" content="releasePointerCapture DOMException - NotFoundError"/>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<link rel="author" title="Microsoft" href="http://www.microsoft.com/"/>
<link rel="help" href="http://www.w3.org/wiki/PointerEvents/TestAssertions">
<meta name="assert" content="When the releasePointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name InvalidPointerId must be thrown."/>
<meta name="assert" content="When the releasePointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name NotFoundError must be thrown."/>
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<!-- /resources/testharness.js -->
<script src="/resources/testharness.js"></script>
Expand All @@ -15,13 +15,13 @@
<script type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript">
var detected_pointertypes = {};
var test_pointerEvent = async_test("releasePointerCapture: DOMException InvalidPointerId"); // set up test harness
var test_pointerEvent = async_test("releasePointerCapture: DOMException NotFoundError"); // set up test harness
// showPointerTypes is defined in pointerevent_support.js
// Requirements: the callback function will reference the test_pointerEvent object and
// will fail unless the async_test is created with the var name "test_pointerEvent".
add_completion_callback(showPointerTypes);

var invalid_pointerId = 314159265358973923;
var INVALID_POINTERID = 314159265358973923;

function run() {
var target0 = document.getElementById("target0");
Expand All @@ -32,17 +32,11 @@
on_event(listener, "pointermove", function (event) {
detected_pointertypes[event.pointerType] = true;

try {
listener.releasePointerCapture(invalid_pointerId);
test_pointerEvent.step(function() {
assert_throws("NotFoundError", function(){ listener.releasePointerCapture(INVALID_POINTERID); },
"It should not be possible to release capture an invalid pointer id");
});

test_pointerEvent.step(function () {
assert_true(false, "DOMException not thrown. Expected: InvalidPointerId should have been thrown");
});
} catch (e) {
test_pointerEvent.step(function () {
assert_true(e.name == "InvalidPointerId", "DOMException should be InvalidPointerId");
});
}
test_pointerEvent.done(); // complete test
});

Expand All @@ -56,11 +50,11 @@
</head>
<body onload="run()">
<div id="listener"></div>
<h1> Pointer Event: releasePointerCapture() DOMException - InvalidPointerId</h1>
<h1> Pointer Event: releasePointerCapture() DOMException - NotFoundError</h1>
<h4>
Test Description:
Upon invocation of the releasePointerCapture method, if the provided pointerId value does not match any of the
active pointers, a DOMException with the name InvalidPointerId must be thrown.
active pointers, a DOMException with the name NotFoundError must be thrown.
</h4>
<br />
<div id="target0">
Expand All @@ -73,4 +67,4 @@ <h4>
</div>
<div id="log"></div>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!doctype html>
<html>
<head>
<title>Pointer Event: gotPiontercapture is fired first.</title>
<title>Pointer Event: gotPointercapture is fired first.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://www.w3.org/wiki/PointerEvents/TestAssertions">
<meta name="assert" content="When the setPointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name InvalidPointerId must be thrown." />
<meta name="assert" content="When the setPointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name NotFountError must be thrown." />
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<!-- /resources/testharness.js -->
<script src="/resources/testharness.js"></script>
Expand All @@ -14,7 +14,7 @@
<script type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript">
var detected_pointertypes = {};
var test_pointerEvent = async_test("setPointerCapture: DOMException InvalidPointerId"); // set up test harness
var test_pointerEvent = async_test("setPointerCapture: DOMException NotFoundError"); // set up test harness
// showPointerTypes is defined in pointerevent_support.js
// Requirements: the callback function will reference the test_pointerEvent object and
// will fail unless the async_test is created with the var name "test_pointerEvent".
Expand All @@ -29,27 +29,19 @@

on_event(target0, "pointerdown", function (event) {
detected_pointertypes[event.pointerType] = true;

try {
listener.setPointerCapture(INVALID_POINTERID);

test_pointerEvent.step(function () {
assert_true(false, "DOMException: InvalidPointerId should have been thrown.");
});
} catch (e) {
test_pointerEvent.step(function () {
assert_equals(e.name, "InvalidPointerId", "DOMException should be InvalidPointerId");
});
}
test_pointerEvent.step(function() {
assert_throws("NotFoundError", function(){ listener.setPointerCapture(INVALID_POINTERID); },
"It should not be possible to capture an invalid pointer id");
});
test_pointerEvent.done(); // complete test
});
}
</script>
</head>
<body onload="run()">
<h1>Pointer Event: DOMException InvalidPointerId</h1>
<h1>Pointer Event: DOMException NotFoundError</h1>
<h4>Test Description:
When the setPointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name InvalidPointerId must be thrown.
When the setPointerCapture method is invoked, if the provided pointerId value does not match any of the active pointers, a DOMException with the name NotFoundError must be thrown.
</h4>
<br />
<div id="target0">
Expand All @@ -62,4 +54,4 @@ <h4>Test Description:
</div>
<div id="log"></div>
</body>
</html>
</html>

0 comments on commit c73ea25

Please sign in to comment.