Index: third_party/WebKit/LayoutTests/fast/images/webgl-teximage2d.html |
diff --git a/third_party/WebKit/LayoutTests/fast/images/webgl-teximage2d.html b/third_party/WebKit/LayoutTests/fast/images/webgl-teximage2d.html |
index ed96a5d72095a27a2f606a634be6d69fcceb5c29..00276201492c92f4224ad7a4c250b222ce0df1e9 100644 |
--- a/third_party/WebKit/LayoutTests/fast/images/webgl-teximage2d.html |
+++ b/third_party/WebKit/LayoutTests/fast/images/webgl-teximage2d.html |
@@ -1,36 +1,18 @@ |
-<script src="../../resources/js-test.js"></script> |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
<script src="../canvas/webgl/resources/webgl-test.js"></script> |
-<canvas id="canvas" width="0" height="0"> </canvas> |
-<img src="resources/green.jpg" width="0" height="0" id="image"></img> |
+<canvas width="0" height="0"> </canvas> |
+<img src="resources/green.jpg" width="0" height="0"></img> |
<script> |
-jsTestIsAsync = true; |
- |
-var gl = create3DContext(document.getElementById("canvas")); |
-if (!gl) { |
- testFailed("context does not exist"); |
-} else { |
- testPassed("context exists"); |
-} |
- |
-var enums = new Array(); |
-for (var name in gl) { |
- if (typeof gl[name] == 'number') |
- enums[gl[name]] = name; |
-} |
- |
-var img = document.getElementById("image"); |
-img.onload = function() { |
- var texture = gl.createTexture(); |
- gl.bindTexture(gl.TEXTURE_2D, texture); |
- try { |
+async_test(function(t) { |
+ var gl = create3DContext(document.querySelector("canvas")); |
+ var img = document.querySelector("img"); |
+ img.onload = t.step_func_done(function() { |
+ var texture = gl.createTexture(); |
+ gl.bindTexture(gl.TEXTURE_2D, texture); |
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); |
- var err = gl.getError(); |
- if (err != gl.NO_ERROR) |
- throw "WebGL error: " + enums[err]; |
- testPassed("OK"); |
- } catch (e) { |
- testFailed(e.toString()); |
- } |
- finishJSTest(); |
-} |
+ assert_equals(gl.getError(), gl.NO_ERROR); |
+ }); |
+}); |
</script> |