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

Unified Diff: third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js

Issue 1521943002: Use iframe in blink_perf.pywebsocket perf tests to remove --disable-web-security (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated DEPS. Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js
diff --git a/third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js b/third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js
index 20021a418c42eae4d200f0032b7c21c76fa2a80d..a201b9e6ea6676fc9c81f6b9572e9a3f4326407d 100644
--- a/third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js
+++ b/third_party/WebKit/PerformanceTests/Pywebsocket/resources/util_performance_test.js
@@ -1,64 +1,48 @@
-function perfTestAddToLog(text) {
- PerfTestRunner.log(text);
-}
-
-function perfTestAddToSummary(text) {
-}
-
-function perfTestMeasureValue(value) {
- PerfTestRunner.measureValueAsync(value);
- PerfTestRunner.gc();
-}
-
-function perfTestNotifyAbort() {
- PerfTestRunner.logFatalError("benchmark aborted");
-}
-
const numIterations = 10;
const numWarmUpIterations = 5;
-function getConfigForPerformanceTest(connectionType, dataType, async,
- verifyData) {
- return {
- prefixUrl:
- connectionType === 'WebSocket' ? 'ws://localhost:8001/benchmark_helper' :
- 'http://localhost:8001/073be001e10950692ccbf3a2ad21c245', // XHR or fetch
- printSize: true,
- numXHRs: 1,
- numFetches: 1,
- numSockets: 1,
- // + 1 is for a warmup iteration by the Telemetry framework.
- numIterations: numIterations + numWarmUpIterations + 1,
- numWarmUpIterations: numWarmUpIterations,
- minTotal: 10240000,
- startSize: 10240000,
- stopThreshold: 10240000,
- multipliers: [2],
- verifyData: verifyData,
- dataType: dataType,
- async: async,
- addToLog: perfTestAddToLog,
- addToSummary: perfTestAddToSummary,
- measureValue: perfTestMeasureValue,
- notifyAbort: perfTestNotifyAbort
- };
-}
-
function startPerformanceTest(connectionType, benchmarkName,
dataType, isWorker, async, verifyData){
- initWorker(connectionType, 'http://localhost:8001');
-
- PerfTestRunner.prepareToMeasureValuesAsync({
- done: function() {
- var config = getConfigForPerformanceTest(connectionType, dataType,
- async, verifyData);
- doAction(config, isWorker, 'stop');
- },
- unit: 'ms',
- dromaeoIterationCount: numIterations
- });
-
- var config = getConfigForPerformanceTest(connectionType, dataType, async,
- verifyData);
- doAction(config, isWorker, benchmarkName);
+ var iframe = document.createElement('iframe');
+ if (connectionType === 'WebSocket') {
+ iframe.src = "http://localhost:8001/performance_test_iframe.html";
+ } else if (connectionType === 'XHR') {
+ iframe.src = "http://localhost:8001/xhr_performance_test_iframe.html";
+ } else {
+ iframe.src = "http://localhost:8001/fetch_performance_test_iframe.html";
+ }
+ iframe.onload = function() {
+ var child = iframe.contentWindow;
+ PerfTestRunner.prepareToMeasureValuesAsync({
+ done: function() {
+ child.postMessage({'command': 'stop'},
+ 'http://localhost:8001');
+ },
+ unit: 'ms',
+ dromaeoIterationCount: numIterations
+ });
+
+ child.postMessage({'command': 'start',
+ 'connectionType': connectionType,
+ 'benchmarkName': benchmarkName,
+ 'dataType': dataType,
+ 'isWorker': isWorker,
+ 'async': async,
+ 'verifyData': verifyData,
+ 'numIterations': numIterations,
+ 'numWarmUpIterations': numWarmUpIterations},
+ 'http://localhost:8001');
+ };
+ document.body.appendChild(iframe);
}
+
+onmessage = function(message) {
+ if (message.data.command === 'log') {
+ PerfTestRunner.log(message.data.value);
+ } else if (message.data.command === 'measureValue') {
+ PerfTestRunner.measureValueAsync(message.data.value);
+ PerfTestRunner.gc();
+ } else if (message.data.command === 'notifyAbort') {
+ PerfTestRunner.logFatalError("benchmark aborted");
+ }
+};
« no previous file with comments | « third_party/WebKit/PerformanceTests/Pywebsocket/resources/generate.py ('k') | tools/perf/benchmarks/blink_perf.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698