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

Unified Diff: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html

Issue 2818563006: ShapeDetection: Holding all of mock service to prevent GC (Closed)
Patch Set: ShapeDetection: Make sure tests are running serially Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'");
+ });
});
};
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698