Skip to content

Commit

Permalink
Revert "[shapedetection] Upstream TextDetection tests to WPT"
Browse files Browse the repository at this point in the history
This reverts commit a0d18c1.

Reason for revert: Deterministically fails on Mac10.10, first failure: https://ci.chromium.org/p/chromium/builders/ci/Mac10.10%20Tests/52676

Original change's description:
> [shapedetection] Upstream TextDetection tests to WPT
> 
> This CL upstreams the reset of shapedetection tests(mainly
> TextDetection tests) to WPT.
> 
> - Moves tests under
>   third_party/blink/web_tests/shapedetection/,
>   third_party/blink/web_tests/fast/shapedetection/,
>   third_party/blink/web_tests/http/tests/shapedetection/,
>   to third_party/blink/web_tests/external/wpt/shape-detection.
> - Moves third_party/blink/web_tests/shapedetection/resources/mock-textdetection.js
>   to third_party/blink/web_tests/external/wpt/resources/chromium/.
> - Removes third_party/blink/web_tests/fast/shapedetection/shapedetection-creation.html
>   as which should be covered in idlharness tests.
> - Introduces simulateClosedPipe() to MockBarcodeDetectionProvider to simulate
>   'no implementation available' case for
>   third_party/blink/web_tests/external/wpt/shape-detection/detection-getSupportedFormats.https.html
> - Improves third_party/blink/web_tests/external/wpt/shape-detection/detection-options.https.html
>   by using assert_throws_js BTW.
> 
> Bug: 932382
> Change-Id: I2f795e4fa4f23b33c49b7924cdbcbccde5ac6ed4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131154
> Reviewed-by: Reilly Grant <reillyg@chromium.org>
> Commit-Queue: Wanming Lin <wanming.lin@intel.com>
> Cr-Commit-Position: refs/heads/master@{#756131}

TBR=reillyg@chromium.org,mcasas@chromium.org,wanming.lin@intel.com,foolip@chromium.org

Change-Id: Iabb63b96afc3f4eba5b3ba9708dd04296ccf86cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 932382
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134030
Reviewed-by: Meredith Lane <meredithl@chromium.org>
Commit-Queue: Meredith Lane <meredithl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756158}
  • Loading branch information
Meredith Lane authored and Commit Bot committed Apr 3, 2020
1 parent 7afc0af commit aafc7a8
Show file tree
Hide file tree
Showing 42 changed files with 837 additions and 327 deletions.
2 changes: 1 addition & 1 deletion third_party/blink/web_tests/SmokeTests
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ external/wpt/shadow-dom/Element-interface-shadowRoot-attribute.html
external/wpt/shadow-dom/event-with-related-target.html
external/wpt/shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/dom-tree-accessors-002.html
external/wpt/shadow-dom/untriaged/styles/test-008.html
external/wpt/shape-detection/shapedetection-empty-input.https.html
external/wpt/streams/byte-length-queuing-strategy.html
external/wpt/streams/piping/close-propagation-backward.html
external/wpt/streams/piping/multiple-propagation.html
Expand Down Expand Up @@ -727,6 +726,7 @@ fast/scrolling/scrollable-area-overflow-not-set.html
fast/selectors/018.html
fast/selectors/061.html
fast/serviceworker/serviceworkercontainer-interface.html
fast/shapedetection/shapedetection-empty-input.html
fast/shapes/crash-caused-by-dirtying-a-shape-while-computing-it-requires-a-long-filename-to-crash.html
fast/shapes/parsing/parsing-shape-property-aliases.html
fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -5557,6 +5557,7 @@ crbug.com/942134 [ Win ] virtual/exotic-color-space/images/feature-policy-oversi
crbug.com/943388 [ Win ] http/tests/devtools/network/network-recording-after-reload-with-screenshots-enabled.js [ Pass Failure ]

# Sheriff 2019-03-20
crbug.com/732103 [ Mac10.11 ] http/tests/shapedetection/shapedetection-cross-origin.html [ Timeout Pass ]
crbug.com/943969 [ Win ] inspector-protocol/css/css-get-media-queries.js [ Pass Failure ]
crbug.com/943969 [ Mac10.10 ] inspector-protocol/css/css-get-media-queries.js [ Pass Failure ]
crbug.com/943969 [ Mac10.11 ] inspector-protocol/css/css-get-media-queries.js [ Pass Failure ]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ var BarcodeDetectionTest = (() => {

this.interceptor_ = new MojoInterfaceInterceptor(
shapeDetection.mojom.BarcodeDetectionProvider.name);
this.interceptor_.oninterfacerequest = e => {
if (this.should_close_pipe_on_request_)
e.handle.close();
else
this.bindingSet_.addBinding(this, e.handle);
}
this.interceptor_.oninterfacerequest =
e => this.bindingSet_.addBinding(this, e.handle);
this.interceptor_.start();
this.should_close_pipe_on_request_ = false;
}

createBarcodeDetection(request, options) {
Expand All @@ -44,15 +39,9 @@ var BarcodeDetectionTest = (() => {

reset() {
this.mockService_ = null;
this.should_close_pipe_on_request_ = false;
this.bindingSet_.closeAllBindings();
this.interceptor_.stop();
}

// simulate a 'no implementation available' case
simulateNoImplementation() {
this.should_close_pipe_on_request_ = true;
}
}

// Class that mocks BarcodeDetection interface defined in
Expand Down

This file was deleted.

This file was deleted.

25 changes: 3 additions & 22 deletions third_party/blink/web_tests/external/wpt/shape-detection/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The `shapedetection-helpers.js` tests require implementations of
the `FaceDetectionTest`, `BarcodeDetectionTest` and `TextDetectionTest`
interfaces, which should emulate platform shape detection backends.
the `FaceDetectionTest` and `BarcodeDetectionTest` interfaces, which
should emulate platform shape detection backends.

The `FaceDetectionTest` interface is defined as:

Expand Down Expand Up @@ -34,30 +34,11 @@ The `BarcodeDetectionTest` interface is defined as:
async enumerateSupportedFormats(); //Enumerates supported formats
getFrameData(); //Gets frame data of detection result.
getFormats(); //Gets value of `formats` in `BarcodeDetector` constructor
simulateNoImplementation(); // simulate a 'no implementation available' case
};
```

The Chromium implementation of the `BarcodeDetectionTest` interface is located in
[mock-barcodedetection.js](../resources/chromium/mock-barcodedetection.js).

The `TextDetectionTest` interface is defined as:

```
class TextDetectionTest {
async initialize(); // Sets up the testing environment.
async reset(); // Frees the resources.
MockTextDetection(); //Returns `MockTextDetection` interface.
};
class MockTextDetection {
getFrameData(); //Gets frame data of detection result.
};
```

The Chromium implementation of the `TextDetectionTest` interface is located in
[mock-textdetection.js](../resources/chromium/mock-textdetection.js).

Other browser vendors should provide their own implementations of
the `FaceDetectionTest`, `BarcodeDetectionTest` and `TextDetectionTest`
interfaces.
the `FaceDetectionTest` and `BarcodeDetectionTest` interfaces.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script src="resources/shapedetection-helpers.js"></script>
<script>

// These tests verify that detected{Face, Barcode, Text}'s boundingBox
// These tests verify that detected{Face, Barcode}'s boundingBox
// should be DOMRectReadOnly.
const imageDataTests =
[
Expand All @@ -17,11 +17,6 @@
createDetector: () => { return new BarcodeDetector(); },
mockTestName: "BarcodeDetectionTest",
name: "Barcode - detectedBarcode.boundingBox should be DOMRectReadOnly"
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
name: "Text - detectedText.boundingBox should be DOMRectReadOnly"
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script src="resources/shapedetection-helpers.js"></script>
<script>

// These tests verify that Detected{Face, Barcode, Text} can be passed to
// These tests verify that Detected{Face, Barcode} can be passed to
// postMessage().
const postMessageTests =
[
Expand All @@ -19,13 +19,7 @@
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - DetectedBarcode can be passed to postMessage()"
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - DetectedText can be passed to postMessage()",
},
}
];

for (let postMessageTest of postMessageTests) {
Expand Down Expand Up @@ -72,19 +66,4 @@
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}

function TextDetectorDetectionResultTest(detectionResult) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
for (let i = 0; i < detectionResult.length; i++) {
assert_equals(detectionResult[i].boundingBox.x, detectionResult[i].cornerPoints[0].x);
assert_equals(detectionResult[i].boundingBox.y, detectionResult[i].cornerPoints[0].y);
assert_equals(detectionResult[i].boundingBox.width,
detectionResult[i].cornerPoints[2].x - detectionResult[i].cornerPoints[3].x);
assert_equals(detectionResult[i].boundingBox.height,
detectionResult[i].cornerPoints[2].y - detectionResult[i].cornerPoints[1].y);
}

}

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - detect(OffscreenCanvas)"
},
{
createDetector: () => { return new TextDetector(); },
createCanvas: () => { return document.createElement("canvas"); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(HTMLCanvasElement)"
},
{
createDetector: () => { return new TextDetector(); },
createCanvas: () => { return new OffscreenCanvas(300, 150); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(OffscreenCanvas)"
}
];

Expand Down Expand Up @@ -84,10 +70,4 @@
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}

function TextDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
}

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - detect(HTMLImageElement)",
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(HTMLImageElement)"
}
];

Expand Down Expand Up @@ -68,19 +62,4 @@
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}

function TextDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
for (let i = 0; i < detectionResult.length; i++) {
assert_equals(detectionResult[i].boundingBox.x, detectionResult[i].cornerPoints[0].x);
assert_equals(detectionResult[i].boundingBox.y, detectionResult[i].cornerPoints[0].y);
assert_equals(detectionResult[i].boundingBox.width,
detectionResult[i].cornerPoints[2].x - detectionResult[i].cornerPoints[3].x);
assert_equals(detectionResult[i].boundingBox.height,
detectionResult[i].cornerPoints[2].y - detectionResult[i].cornerPoints[1].y);
}

}

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
createDetector: () => { return new BarcodeDetector(); },
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - detect(HTMLVideoElement)"
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(HTMLVideoElement)"
name: "Barcode - detect(HTMLVideoElement)",
}
];

Expand Down Expand Up @@ -58,10 +52,4 @@
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}

function TextDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
}

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
createDetector: () => { return new BarcodeDetector(); },
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - detect(ImageBitmap)"
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(ImageBitmap)",
name: "Barcode - detect(ImageBitmap)",
}
];

Expand Down Expand Up @@ -57,10 +51,4 @@
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}

function TextDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
}

</script>
Loading

0 comments on commit aafc7a8

Please sign in to comment.