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

Unified Diff: content/test/gpu/gpu_tests/trace_test.py

Issue 1826343003: Add safety checks and reenable Canvas2D/WebGL trace_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/test/gpu/gpu_tests/trace_test.py
diff --git a/content/test/gpu/gpu_tests/trace_test.py b/content/test/gpu/gpu_tests/trace_test.py
index 19ba60aab9906c2124798638f4e45498e70f2463..4b42a8acf86d4066d5f84d8447712237aa7b6f33 100644
--- a/content/test/gpu/gpu_tests/trace_test.py
+++ b/content/test/gpu/gpu_tests/trace_test.py
@@ -24,13 +24,18 @@ test_harness_script = r"""
domAutomationController.send = function(msg) {
// Issue a read pixel to synchronize the gpu process to ensure
// the asynchronous category enabling is finished.
- var canvas = document.createElement("canvas")
- canvas.width = 1;
- canvas.height = 1;
- var gl = canvas.getContext("webgl");
- gl.clear(gl.COLOR_BUFFER_BIT);
- var id = new Uint8Array(4);
- gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, id);
+ var temp_canvas = document.createElement("canvas")
+ temp_canvas.width = 1;
+ temp_canvas.height = 1;
+ var temp_gl = temp_canvas.getContext("experimental-webgl") ||
+ temp_canvas.getContext("webgl");
+ if (temp_gl) {
+ temp_gl.clear(temp_gl.COLOR_BUFFER_BIT);
+ var id = new Uint8Array(4);
+ temp_gl.readPixels(0, 0, 1, 1, temp_gl.RGBA, temp_gl.UNSIGNED_BYTE, id);
+ } else {
+ console.log('Failed to get WebGL context.');
+ }
domAutomationController._finished = true;
}
« no previous file with comments | « content/test/data/gpu/pixel_canvas2d_webgl.html ('k') | content/test/gpu/gpu_tests/trace_test_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698