Re: Fix the testharness async test API usage (issue 2114783003 by kochi@chromium.org)

0 views
Skip to first unread message

ko...@chromium.org

unread,
Jul 1, 2016, 5:35:37 AM7/1/16
to hay...@chromium.org, chromium...@chromium.org, blink-...@chromium.org
Reviewers: hayato
CL: https://codereview.chromium.org/2114783003/

Message:
PTAL

It looks the old test worked, but this should be proper API
usage for async_test.

Description:
Fix the testharness async test API usage

This fixes the usage of testharness.js async_test API usages
in pointer lock test for Shadow DOM.

BUG=622584

Base URL: https://chromium.googlesource.com/chromium/src.git@master

Affected files (+38, -42 lines):
M third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
M third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html
M third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html
M third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html


Index: third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html b/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
index da2b77b181c683fc71308f1e85596b8cab153f8b..d7faf9529111567081c8a7a8bb076878b8b81761 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
+++ b/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
@@ -30,12 +30,9 @@

<script>
async_test((test) => {
- document.onpointerlockerror = () => {
- assert_true(false, 'onpointerlockerror is not expected.');
- test.done();
- };
+ document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');

- document.onpointerlockchange = () => {
+ document.onpointerlockchange = test.step_func(() => {
// Not interested in handling before or after exitPointerLock.
if (document.pointerLockElement === null)
return;
@@ -49,7 +46,7 @@ async_test((test) => {

document.exitPointerLock();
test.done();
- };
+ });

convertTemplatesToShadowRootsWithin(host);
var host3 = host2.shadowRoot.querySelector('#host3');
@@ -57,12 +54,14 @@ async_test((test) => {
var host5 = host2.shadowRoot.querySelector('#host5');

// All pointerLockElement should default to null.
- assert_equals(document.pointerLockElement, null);
- assert_equals(host.shadowRoot.pointerLockElement, null);
- assert_equals(host2.shadowRoot.pointerLockElement, null);
- assert_equals(host3.shadowRoot.pointerLockElement, null);
- assert_equals(host4.shadowRoot.pointerLockElement, null);
- assert_equals(host5.shadowRoot.pointerLockElement, null);
+ test.step(() => {
+ assert_equals(document.pointerLockElement, null);
+ assert_equals(host.shadowRoot.pointerLockElement, null);
+ assert_equals(host2.shadowRoot.pointerLockElement, null);
+ assert_equals(host3.shadowRoot.pointerLockElement, null);
+ assert_equals(host4.shadowRoot.pointerLockElement, null);
+ assert_equals(host5.shadowRoot.pointerLockElement, null);
+ });

var canvas = host3.shadowRoot.querySelector('canvas');
canvas.requestPointerLock();
Index: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html
index 4e5ce83c4f9c8f26b5fe8b424b3ebbe75c039362..7537f01f06191d997d962986e278b71898199f1b 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html
+++ b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html
@@ -16,12 +16,9 @@

<script>
async_test((test) => {
- document.onpointerlockerror = () => {
- assert_true(false, 'onpointerlockerror is not expected.');
- test.done();
- };
+ document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');

- document.onpointerlockchange = () => {
+ document.onpointerlockchange = test.step_func(() => {
// Not interested in handling before or after exitPointerLock.
if (document.pointerLockElement === null)
return;
@@ -32,13 +29,15 @@ async_test((test) => {

document.exitPointerLock();
test.done();
- };
+ });

convertTemplatesToShadowRootsWithin(host);

- assert_equals(document.pointerLockElement, null);
- assert_equals(host.shadowRoot.pointerLockElement, null);
- assert_equals(hostV0.shadowRoot.pointerLockElement, null);
+ test.step(() => {
+ assert_equals(document.pointerLockElement, null);
+ assert_equals(host.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV0.shadowRoot.pointerLockElement, null);
+ });

var canvas = hostV0.shadowRoot.querySelector('canvas');
canvas.requestPointerLock();
Index: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html
index e39de0068754d4c96cdc94596227eab01b0eea9b..763d4a43984aae2af9cc7d2957dac31f27e62c15 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html
+++ b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html
@@ -20,12 +20,9 @@

<script>
async_test((test) => {
- document.onpointerlockerror = () => {
- assert_true(false, 'onpointerlockerror is not expected.');
- test.done();
- };
+ document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');

- document.onpointerlockchange = () => {
+ document.onpointerlockchange = test.step_func(() => {
// Not interested in handling before or after exitPointerLock.
if (document.pointerLockElement === null)
return;
@@ -37,15 +34,17 @@ async_test((test) => {

document.exitPointerLock();
test.done();
- };
+ });

convertTemplatesToShadowRootsWithin(host);
var hostV1inV0 = hostV0.shadowRoot.querySelector('#hostV1inV0');

- assert_equals(document.pointerLockElement, null);
- assert_equals(host.shadowRoot.pointerLockElement, null);
- assert_equals(hostV0.shadowRoot.pointerLockElement, null);
- assert_equals(hostV1inV0.shadowRoot.pointerLockElement, null);
+ test.step(() => {
+ assert_equals(document.pointerLockElement, null);
+ assert_equals(host.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV0.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV1inV0.shadowRoot.pointerLockElement, null);
+ });

var canvas = hostV1inV0.shadowRoot.querySelector('canvas');
canvas.requestPointerLock();
Index: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html
index 9849b3d246d87406d44c61f2f7ec37f675ee9aca..105000468fcc8c9cfa05fbe0cda1da226ee24e22 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html
+++ b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.html
@@ -24,12 +24,9 @@

<script>
async_test((test) => {
- document.onpointerlockerror = () => {
- assert_true(false, 'onpointerlockerror is not expected.');
- test.done();
- };
+ document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');

- document.onpointerlockchange = () => {
+ document.onpointerlockchange = test.step_func(() => {
// Not interested in handling before or after exitPointerLock.
if (document.pointerLockElement === null)
return;
@@ -42,17 +39,19 @@ async_test((test) => {

document.exitPointerLock();
test.done();
- };
+ });

convertTemplatesToShadowRootsWithin(host);
var hostV1inV1 = hostV1.shadowRoot.querySelector('#hostV1inV1');
var hostV0inV1inV1 = hostV1inV1.shadowRoot.querySelector('#hostV0inV1inV1');

- assert_equals(document.pointerLockElement, null);
- assert_equals(host.shadowRoot.pointerLockElement, null);
- assert_equals(hostV1.shadowRoot.pointerLockElement, null);
- assert_equals(hostV1inV1.shadowRoot.pointerLockElement, null);
- assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null);
+ test.step(() => {
+ assert_equals(document.pointerLockElement, null);
+ assert_equals(host.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV1.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV1inV1.shadowRoot.pointerLockElement, null);
+ assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null);
+ });

var canvas = hostV0inV1inV1.shadowRoot.querySelector('canvas');
canvas.requestPointerLock();


hay...@chromium.org

unread,
Jul 1, 2016, 9:07:05 AM7/1/16
to ko...@chromium.org, blink-...@chromium.org, chromium...@chromium.org

commit-bot@chromium.org via codereview.chromium.org

unread,
Jul 3, 2016, 11:56:48 AM7/3/16
to ko...@chromium.org, hay...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org

commit-bot@chromium.org via codereview.chromium.org

unread,
Jul 3, 2016, 9:16:34 PM7/3/16
to ko...@chromium.org, hay...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org
Committed patchset #2 (id:20001)

https://codereview.chromium.org/2114783003/

commit-bot@chromium.org via codereview.chromium.org

unread,
Jul 3, 2016, 9:17:58 PM7/3/16
to ko...@chromium.org, hay...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org
Patchset 2 (id:??) landed as
https://crrev.com/7108fffd85ed6c21acdb88991b48395ae2cbb822
Cr-Commit-Position: refs/heads/master@{#403626}

https://codereview.chromium.org/2114783003/
Reply all
Reply to author
Forward
0 new messages