mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 21:58:41 +02:00
Automatic update from web-platform-tests Add worker WPT test writing guide and examples Change-Id: I5de23aad37379fdbf3e0f5934b024b7905a5b7d5 Reviewed-on: https://chromium-review.googlesource.com/c/1406165 Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/master@{#623988} -- wpt-commits: 4fb2d9c4d14af3edc62f6c6157c9152d07306da0 wpt-pr: 14829
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// META: global=!default,worker
|
|
|
|
// See
|
|
// https://web-platform-tests.org/writing-tests/testharness.html#multi-global-tests
|
|
// for how to specify in which global scopes to run this tests,
|
|
// how to specify additional scripts needed, etc.
|
|
|
|
// testharness.js is imported (via importScripts()) by generated glue code by
|
|
// WPT server.
|
|
// See AnyWorkerHandler in
|
|
// https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py.
|
|
|
|
// ============================================================================
|
|
|
|
// Test body.
|
|
// .any.js tests are always testharness.js-based.
|
|
test(() => {
|
|
assert_equals(1, 1, "1 == 1");
|
|
},
|
|
"Test that should pass"
|
|
);
|
|
|
|
test(() => {
|
|
// This file is "general.any.js" but the worker top-level script is
|
|
// "general.any.worker.js", which is generated by the WPT server.
|
|
assert_equals(location.pathname, "/workers/examples/general.any.worker.js");
|
|
},
|
|
"Worker top-level script is a generated script."
|
|
);
|
|
|
|
// done() is NOT needed in .any.js tests, as it is called by generated
|
|
// glue code by the WPT server.
|
|
// See AnyWorkerHandler in
|
|
// https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py.
|