2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-03-03 18:22:53 +01:00
|
|
|
import { testPerm, assert, createResolvable } from "./test_util.ts";
|
2019-02-02 09:27:42 +03:00
|
|
|
|
2020-03-03 18:22:53 +01:00
|
|
|
testPerm({ hrtime: false }, async function performanceNow(): Promise<void> {
|
|
|
|
const resolvable = createResolvable();
|
2019-02-02 09:27:42 +03:00
|
|
|
const start = performance.now();
|
2019-04-21 16:40:10 -04:00
|
|
|
setTimeout((): void => {
|
2019-02-02 09:27:42 +03:00
|
|
|
const end = performance.now();
|
|
|
|
assert(end - start >= 10);
|
2020-03-03 18:22:53 +01:00
|
|
|
resolvable.resolve();
|
2019-02-02 09:27:42 +03:00
|
|
|
}, 10);
|
2020-03-03 18:22:53 +01:00
|
|
|
await resolvable;
|
2019-02-02 09:27:42 +03:00
|
|
|
});
|