Index: third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html |
diff --git a/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html b/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..42376d40e8b7e57aa6b0a7b3ac5d2bdac384bf20 |
--- /dev/null |
+++ b/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html |
@@ -0,0 +1,48 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src = "../resources/runner.js"></script> |
+<script> |
+var canvas_idle = null; |
+var isDone = false; |
+ |
+function createCanvas4k(canvas_id) { |
+ var myCanvas = document.createElement("canvas"); |
+ myCanvas.id = canvas_id; |
+ myCanvas.width = 4000; |
+ myCanvas.height = 4000; |
+ myCanvas.getContext("2d").fillStyle = "rgba(0, 255, 0, 0.5)"; |
+ myCanvas.getContext("2d").fillRect(0, 0, myCanvas.width, myCanvas.height); |
+ return myCanvas; |
+} |
+ |
+function invokeToBlobJpg(myCanvas) { |
+ var startTime = PerfTestRunner.now(); |
+ myCanvas.toBlob(function(blob){ |
+ PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime); |
+ if (!isDone) { |
+ PerfTestRunner.gc(); |
+ runTest(myCanvas); |
+ } |
+ }, "image/jpeg"); |
+} |
+ |
+function runTest(myCanvas) { |
+ invokeToBlobJpg(myCanvas); |
+} |
+ |
+window.onload = function () { |
+ canvas_idle = createCanvas4k("canvas_idle"); |
+ PerfTestRunner.prepareToMeasureValuesAsync({ |
+ unit: 'ms', |
+ done: function () { |
+ isDone = true; |
+ }, |
+ description: "Measures performance of canvas." |
+ }); |
+ runTest(canvas_idle); |
+}; |
+</script> |
+</body> |
+</html> |
+ |