| Index: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| index f5f692ce20589a1744e057d39713e62428878d4e..161df617b40dbb7db7cd537eead8b2157527e0ae 100644
|
| --- a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| @@ -7,14 +7,13 @@
|
| <script src="resources/mock-textdetection.js"></script>
|
| <script>
|
|
|
| -var createTestForCanvasElement = function(createDetector,
|
| - createCanvas,
|
| - mockReady,
|
| - detectionResultTest) {
|
| - async_test(function(t) {
|
| -
|
| - var img = new Image();
|
| - img.onload = function() {
|
| +function detectShapeForCanvas(createDetector,
|
| + createCanvas,
|
| + mockReady,
|
| + detectionResultTest) {
|
| + return new Promise(function(resolve, reject) {
|
| + var img = new Image();
|
| + img.onload = function() {
|
|
|
| var canvas = createCanvas();
|
| canvas.getContext("2d").drawImage(img, 0, 0);
|
| @@ -34,14 +33,29 @@ var createTestForCanvasElement = function(createDetector,
|
| })
|
| .then(detectionResult => {
|
| detectionResultTest(detectionResult, theMock);
|
| - t.done();
|
| + resolve("Success");
|
| })
|
| .catch(error => {
|
| assert_unreached("Error during detect(canvas): " + error);
|
| });
|
| - }
|
| + }
|
|
|
| - img.src = "../media/content/greenbox.png";
|
| + img.src = "../media/content/greenbox.png";
|
| + });
|
| +}
|
| +
|
| +var createTestForCanvasElement = function(createDetector,
|
| + createCanvas,
|
| + mockReady,
|
| + detectionResultTest) {
|
| + promise_test(function() {
|
| + return detectShapeForCanvas(createDetector,
|
| + createCanvas,
|
| + mockReady,
|
| + detectionResultTest)
|
| + .then(function(result) {
|
| + assert_equals(result, "Success", "Detect 'Success'");
|
| + });
|
| });
|
| };
|
|
|
|
|