1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Monkey patch performance to get deterministic results.
7 // Web page replay patches Data.now().
8 var start_time = Date.now();
14 // These values are arbitrary.
15 // They are obtained by sampling "performance.now()" on a live web site.
17 "navigationStart": start_time,
18 "unloadEventStart": 0,
22 "fetchStart": start_time + 94,
23 "domainLookupStart": start_time + 94,
24 "domainLookupEnd": start_time + 94,
25 "connectStart": start_time + 94,
26 "connectEnd": start_time + 94,
27 "secureConnectionStart":0,
28 "requestStart": start_time + 98,
29 "responseStart": start_time + 546,
30 "responseEnd": start_time + 1511,
31 "domLoading": start_time + 562,
32 "domInteractive": start_time + 1647,
33 "domContentLoadedEventStart": start_time + 1647,
34 "domContentLoadedEventEnd": start_time + 1654,
35 "domComplete": start_time + 2009,
36 "loadEventStart": start_time + 2009,
37 "loadEventEnd": start_time + 2009
40 Object.defineProperty(window, "performance", {
42 return { 'now' : now, 'timing' : timing() };