OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 function WriteReport(sessionLoader) { |
| 6 var iterations = window.iterations; |
| 7 var reportUrl = window.benchmarkConfiguration.reportUrl; |
| 8 var resultsCollection = sessionLoader.getResultsCollection(); |
| 9 var times = resultsCollection.getTotalTimes(); |
| 10 var pages = resultsCollection.getPages(); |
| 11 |
| 12 reportUrl += "?n=" + iterations; |
| 13 reportUrl += "&i=" + iterations * pages.length; // "cycles" |
| 14 reportUrl += "&td=" + Array.sum(times); // total time |
| 15 reportUrl += "&tf=" + 0; // fudge time |
| 16 console.log('reportUrl: ' + reportUrl); |
| 17 chrome.cookies.set({ |
| 18 "url": reportUrl, |
| 19 "name": "__pc_done", |
| 20 "value": "1", |
| 21 "path": "/", |
| 22 }); |
| 23 chrome.cookies.set({ |
| 24 "url": reportUrl, |
| 25 "name": "__pc_pages", |
| 26 "value": pages.map(function(x) { |
| 27 return x.replace(/=/g, "%3D"); |
| 28 }).join(","), |
| 29 "path": "/", |
| 30 }); |
| 31 chrome.cookies.set({ |
| 32 "url": reportUrl, |
| 33 "name": "__pc_timings", |
| 34 "value": times.join(","), |
| 35 "path": "/", |
| 36 }); |
| 37 |
| 38 chrome.tabs.getSelected(null, function(tab) { |
| 39 console.log("Navigate to the report."); |
| 40 chrome.tabs.update(tab.id, {"url": reportUrl}, null); |
| 41 }); |
| 42 } |
| 43 |
| 44 AddBenchmarkCallback(WriteReport); |
OLD | NEW |