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

Side by Side Diff: page_cycler/acid3/acid3.acidtests.org/head.js

Issue 151051: Add Acid3-based page cycler.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: 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 | Annotate | Revision Log
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
89 function test_complete(errors, elapsed_time) {
90 if (__results)
91 return;
92 var unused = document.body.offsetHeight; // force layout
93
94 var ts = 0, td = 0, te = (new Date()).getTime(), tf = 0;
95
96 var s = document.location.search;
97 if (s) {
98 var params = s.substring(1).split('&');
99 for (var i = 0; i < params.length; ++i) {
100 var f = params[i].split('=');
101 switch (f[0]) {
102 case 'skip':
103 // No calculation, just viewing
104 return;
105 case 'n':
106 __iterations = f[1];
107 break;
108 case 'i':
109 __cycle = (f[1] - 0) + 1;
110 break;
111 case 'p':
112 __page = ((f[1] - 0) + 1) % __pages().length;
113 break;
114 case 'ts':
115 ts = (f[1] - 0);
116 break;
117 case 'td':
118 td = (f[1] - 0);
119 break;
120 case 'tf':
121 tf = (f[1] - 0);
122 break;
123 }
124 }
125 }
126 __tl = (te - ts);
127 __td = td + __tl;
128 __te = te;
129 __tf = tf; // record t-fudge
130
131 setTimeout("__ontimeout()", __TIMEOUT);
132 }
133
134 /*
135 if (window.attachEvent)
136 window.attachEvent("onload", __onload);
137 else
138 addEventListener("load", __onload, false);
139 */
OLDNEW
« no previous file with comments | « page_cycler/acid3/acid3.acidtests.org/font.ttf ('k') | page_cycler/acid3/acid3.acidtests.org/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698