Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: tools/page_cycler/common/head.js

Issue 151053: Add common page_cycler and checkout acid3 cycler. (Closed)
Patch Set: remove README.chromium Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | tools/page_cycler/common/report.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 var __c = ""; // that's good enough for me.
30 var __td;
31 var __tf;
32 var __tl;
33 var __iterations;
34 var __cycle;
35 var __results = false;
36 var __page;
37 var __TIMEOUT = 15;
38 function __get_cookie(name) {
39 var cookies = document.cookie.split("; ");
40 for (var i = 0; i < cookies.length; ++i) {
41 var t = cookies[i].split("=");
42 if (t[0] == name && t[1])
43 return t[1];
44 }
45 return "";
46 }
47 function __pages() { // fetch lazily
48 if (!("data" in this))
49 this.data = __get_cookie("__pc_pages").split(",");
50 return this.data;
51 }
52 function __get_timings() {
53 return __get_cookie("__pc_timings");
54 }
55 function __set_timings(timings) {
56 document.cookie = "__pc_timings=" + timings + "; path=/";
57 }
58 function __ontimeout() {
59 var doc;
60
61 // Call GC twice to cleanup JS heap before starting a new test.
62 if (window.gc) {
63 window.gc();
64 window.gc();
65 }
66
67 var ts = (new Date()).getTime();
68 var tlag = (ts - __te) - __TIMEOUT;
69 if (tlag > 0)
70 __tf = __tf + tlag;
71 if (__cycle == (__pages().length * __iterations)) {
72 document.cookie = "__pc_done=1; path=/";
73 doc = "../../common/report.html";
74 } else {
75 doc = "../" + __pages()[__page] + "/index.html"
76 }
77
78 var timings = __tl;
79 var oldTimings = __get_timings();
80 if (oldTimings != "") {
81 timings = oldTimings + "," + timings;
82 }
83 __set_timings(timings);
84
85 var url = doc + "?n=" + __iterations + "&i=" + __cycle + "&p=" + __page + "&ts =" + ts + "&td=" + __td + "&tf=" + __tf;
86 document.location.href = url;
87 }
88 function __onload() {
89 if (__results)
90 return;
91 var unused = document.body.offsetHeight; // force layout
92
93 var ts = 0, td = 0, te = (new Date()).getTime(), tf = 0;
94
95 var s = document.location.search;
96 if (s) {
97 var params = s.substring(1).split('&');
98 for (var i = 0; i < params.length; ++i) {
99 var f = params[i].split('=');
100 switch (f[0]) {
101 case 'skip':
102 // No calculation, just viewing
103 return;
104 case 'n':
105 __iterations = f[1];
106 break;
107 case 'i':
108 __cycle = (f[1] - 0) + 1;
109 break;
110 case 'p':
111 __page = ((f[1] - 0) + 1) % __pages().length;
112 break;
113 case 'ts':
114 ts = (f[1] - 0);
115 break;
116 case 'td':
117 td = (f[1] - 0);
118 break;
119 case 'tf':
120 tf = (f[1] - 0);
121 break;
122 }
123 }
124 }
125 __tl = (te - ts);
126 __td = td + __tl;
127 __te = te;
128 __tf = tf; // record t-fudge
129
130 setTimeout("__ontimeout()", __TIMEOUT);
131 }
132
133 if (window.attachEvent)
134 window.attachEvent("onload", __onload);
135 else
136 addEventListener("load", __onload, false);
OLDNEW
« no previous file with comments | « DEPS ('k') | tools/page_cycler/common/report.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698