Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1592592 [wpt PR 19993] - [testharness.js] introduce `assert_preco…
…ndition`, a=testonly

Automatic update from web-platform-tests
[testharness.js] introduce `assert_precondition`

This depends on mozlog 5.0 for the new PRECONDITION_FAILED status:
https://bugzilla.mozilla.org/show_bug.cgi?id=1589056

Implements web-platform-tests/rfcs#16.

Includes parts of web-platform-tests/wpt#16689.

Fixes web-platform-tests/wpt#19844.

--
[vibration] use `assert_precondition` to avoid spurious pass

This demonstrates the use of `assert_precondition` for subtests.

--

wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181
wpt-pr: 19993

UltraBlame original commit: 9b458e91114235eb43711dbac7a3acfe30c83fce
  • Loading branch information
marco-c committed Nov 30, 2019
1 parent c766c63 commit 45ef81a
Show file tree
Hide file tree
Showing 13 changed files with 1,037 additions and 8 deletions.
290 changes: 290 additions & 0 deletions testing/web-platform/tests/docs/writing-tests/testharness-api.md
Expand Up @@ -2038,6 +2038,266 @@ harness
.
#
#
Preconditions
#
#
When
a
test
would
be
invalid
unless
certain
conditions
are
met
but
yet
doesn
'
t
explicitly
depend
on
those
preconditions
assert_precondition
can
be
used
.
For
example
:
js
async_test
(
(
t
)
=
>
{
const
video
=
document
.
createElement
(
"
video
"
)
;
assert_precondition
(
video
.
canPlayType
(
"
video
/
webm
"
)
)
;
video
.
src
=
"
multitrack
.
webm
"
;
/
/
test
something
specific
to
multiple
audio
tracks
in
a
WebM
container
t
.
done
(
)
;
}
"
WebM
with
multiple
audio
tracks
"
)
;
A
failing
assert_precondition
call
is
reported
as
a
status
of
PRECONDITION_FAILED
for
the
subtest
.
assert_precondition
can
also
be
used
during
test
setup
.
For
example
:
js
setup
(
(
)
=
>
{
assert_precondition
(
"
onfoo
"
in
document
.
body
"
'
foo
'
event
supported
"
)
;
}
)
;
async_test
(
(
)
=
>
{
/
*
test
#
1
waiting
for
"
foo
"
event
*
/
}
)
;
async_test
(
(
)
=
>
{
/
*
test
#
2
waiting
for
"
foo
"
event
*
/
}
)
;
A
failing
assert_precondition
during
setup
is
reported
as
a
status
of
PRECONDITION_FAILED
for
the
test
and
the
subtests
will
not
run
.
See
also
the
.
optional
[
file
name
convention
]
(
file
-
names
.
md
)
which
is
appropriate
when
the
precondition
is
explicitly
optional
behavior
.
#
#
Cleanup
#
#
Expand Down Expand Up @@ -3801,6 +4061,7 @@ to
the
PASS
FAIL
PRECONDITION_FAILED
TIMEOUT
and
NOTRUN
Expand Down Expand Up @@ -3855,6 +4116,7 @@ compared
to
the
OK
PRECONDITION_FAILED
ERROR
and
TIMEOUT
Expand All @@ -3870,7 +4132,10 @@ when
the
status
is
PRECONDITION_FAILED
or
ERROR
.
#
#
External
Expand Down Expand Up @@ -5208,6 +5473,31 @@ Assertions
#
#
#
assert_precondition
(
condition
description
)
asserts
that
condition
is
truthy
.
See
[
preconditions
]
(
#
preconditions
)
for
usage
.
#
#
#
assert_true
(
actual
Expand Down

0 comments on commit 45ef81a

Please sign in to comment.