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

Side by Side Diff: tools/page_cycler/webpagereplay/extension/page_cycler.js

Issue 9956045: Add Web Page Replay test to page cycler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows compile error. Created 8 years, 8 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) 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 // Returns the sum of all values in the array.
6 Array.sum = function(array) {
7 var sum = 0;
8 for (var i = array.length - 1; i >= 0; i--) {
9 sum += array[i];
10 }
11 return sum;
12 };
13
14
15 function WriteReport(sessionLoader) {
16 var iterations = window.iterations;
17 var reportUrl = window.benchmarkConfiguration.reportUrl;
18 var resultsCollection = sessionLoader.getResultsCollection();
19 var times = resultsCollection.getTotalTimes();
20 var pages = resultsCollection.getPages();
21
22 reportUrl += "?n=" + iterations;
23 reportUrl += "&i=" + iterations * pages.length; // "cycles"
24 reportUrl += "&td=" + Array.sum(times); // total time
25 reportUrl += "&tf=" + 0; // fudge time
26 console.log('reportUrl: ' + reportUrl);
27 chrome.cookies.set({
28 "url": reportUrl,
29 "name": "__pc_done",
30 "value": "1",
31 "path": "/",
32 });
33 chrome.cookies.set({
34 "url": reportUrl,
35 "name": "__pc_pages",
36 "value": pages.map(function(x) {
37 return x.replace(/=/g, "%3D");
38 }).join(","),
39 "path": "/",
40 });
41 chrome.cookies.set({
42 "url": reportUrl,
43 "name": "__pc_timings",
44 "value": times.join(","),
45 "path": "/",
46 });
47
48 chrome.tabs.getSelected(null, function(tab) {
49 console.log("Navigate to the report.");
50 chrome.tabs.update(tab.id, {"url": reportUrl}, null);
51 });
52 }
53
54 AddBenchmarkCallback(WriteReport);
OLDNEW
« no previous file with comments | « tools/page_cycler/webpagereplay/extension/manifest.json ('k') | tools/page_cycler/webpagereplay/extension/start.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698