tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

general.worker.js (1335B)


      1 // This file is an example of a test using *.worker.js mechanism.
      2 // The parent document that calls fetch_tests_from_worker() is auto-generated
      3 // but there are no generated code in the worker side.
      4 
      5 // fetch_tests_from_worker() requires testharness.js both on the parent
      6 // document and on the worker.
      7 importScripts("/resources/testharness.js");
      8 
      9 // ============================================================================
     10 
     11 // Test body.
     12 test(() => {
     13    assert_equals(1, 1, "1 == 1");
     14  },
     15  "Test that should pass"
     16 );
     17 
     18 test(() => {
     19    // This file is "general.worker.js" and this file itself is the worker
     20    // top-level script (which is different from the .any.js case).
     21    assert_equals(location.pathname, "/workers/examples/general.worker.js");
     22  },
     23  "Worker top-level script is the .worker.js file itself."
     24 );
     25 
     26 // ============================================================================
     27 
     28 // `done()` is always needed at the bottom for dedicated workers and shared
     29 // workers, even if you write `async_test()` or `promise_test()`.
     30 // `async_test()` and `promise_test()` called before this `done()`
     31 // will continue and assertions/failures after this `done()` are not ignored.
     32 // See
     33 // https://web-platform-tests.org/writing-tests/testharness-api.html#determining-when-all-tests-are-complete
     34 // for details.
     35 done();