OLD | NEW |
(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 // This script runs the page cycler. It assumes that __pages is an array |
| 30 // containing the directories for various pages to exercise. |
| 31 |
| 32 document.title = "page cycler"; |
| 33 |
| 34 var initialPage = __pages[0]; |
| 35 |
| 36 document.cookie = "__pc_done=0; path=/"; |
| 37 document.cookie = "__pc_pages=" + __pages + "; path=/"; |
| 38 document.cookie = "__pc_timings=; path=/"; |
| 39 |
| 40 var options = location.search.substring(1).split('&'); |
| 41 |
| 42 function getopt(name) { |
| 43 var r = new RegExp("^" + name + "="); |
| 44 for (i = 0; i < options.length; ++i) { |
| 45 if (options[i].match(r)) { |
| 46 return options[i].substring(name.length + 1); |
| 47 } |
| 48 } |
| 49 return null; |
| 50 } |
| 51 |
| 52 function start() { |
| 53 var iterations = document.getElementById("iterations").value; |
| 54 window.resizeTo(800, 800); |
| 55 var ts = (new Date()).getTime(); |
| 56 var url = initialPage + "/index.html?n=" + iterations + "&i=0&p=0&ts=" + ts +
"&td=0"; |
| 57 window.location = url; |
| 58 } |
| 59 |
| 60 function render_form() { |
| 61 var form = document.createElement("FORM"); |
| 62 form.setAttribute("action", "javascript:start()"); |
| 63 |
| 64 var label = document.createTextNode("Iterations: "); |
| 65 form.appendChild(label); |
| 66 |
| 67 var input = document.createElement("INPUT"); |
| 68 input.setAttribute("id", "iterations"); |
| 69 var iterations = getopt("iterations"); |
| 70 input.setAttribute("value", iterations ? iterations : "5"); |
| 71 form.appendChild(input); |
| 72 |
| 73 input = document.createElement("INPUT"); |
| 74 input.setAttribute("type", "submit"); |
| 75 input.setAttribute("value", "Start"); |
| 76 form.appendChild(input); |
| 77 |
| 78 document.body.appendChild(form); |
| 79 } |
| 80 |
| 81 render_form(); |
| 82 |
| 83 // should we start automatically? |
| 84 if (location.search.match("auto=1")) |
| 85 start(); |
OLD | NEW |