You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert_equals(typeofself.performance,"object","self.performance is an object");
4
+
assert_equals((typeofself.performance.now),"function","self.performance.now() is a function");
5
+
assert_equals(typeofself.performance.now(),"number","self.performance.now() returns a number");
6
+
},"self.performance.now() is a function that returns a number");
7
+
8
+
test(function(){
9
+
assert_true(self.performance.now()>0);
10
+
},"self.performance.now() returns a positive number");
11
+
12
+
test(function(){
13
+
varnow1=self.performance.now();
14
+
varnow2=self.performance.now();
15
+
assert_true((now2-now1)>=0);
16
+
},"self.performance.now() difference is not negative");
17
+
18
+
async_test(function(){
19
+
// Check whether the performance.now() method is close to Date() within 30ms (due to inaccuracies)
20
+
varinitial_hrt=self.performance.now();
21
+
varinitial_date=Date.now();
22
+
this.step_timeout(function(){
23
+
varfinal_hrt=self.performance.now();
24
+
varfinal_date=Date.now();
25
+
assert_approx_equals(final_hrt-initial_hrt,final_date-initial_date,30,'High resolution time value increased by approximately the same amount as time from date object');
26
+
this.done();
27
+
},2000);
28
+
},'High resolution time has approximately the right relative magnitude');
// The time values returned when calling the now method MUST be monotonically increasing and not subject to system clock adjustments or system clock skew.
assert_greater_than_equal(workerOrigin-windowOrigin,200,'We waited 200ms to spawn the second worker, so its timeOrigin should be greater than that of the window.');
40
+
}));
41
+
},200);
42
+
},'Window and worker timeOrigins differ when worker is created after a delay.');
0 commit comments