summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shape-detection/README.md
blob: 624b021336aff022d000d97586789e4b8f6c8ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
The `shapedetection-helpers.js` tests require implementations of
the `FaceDetectionTest`, `BarcodeDetectionTest` and `TextDetectionTest`
interfaces, which should emulate platform shape detection backends.

The `FaceDetectionTest` interface is defined as:

```
  class FaceDetectionTest {
    async initialize();  // Sets up the testing environment.
    async reset(); // Frees the resources.
    MockFaceDetectionProvider(); //Returns `MockFaceDetectionProvider` interface.
  };

  class MockFaceDetectionProvider {
    getFrameData(); //Gets frame data of detection result.
    getMaxDetectedFaces(); //Gets value of `maxDetectedFaces` in `FaceDetector` constructor
    getFastMode(); //Gets value of `fastMode` in `FaceDetector` constructor
  };
```

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

The `BarcodeDetectionTest` interface is defined as:

```
  class BarcodeDetectionTest {
    async initialize();  // Sets up the testing environment.
    async reset(); // Frees the resources.
    MockBarcodeDetectionProvider(); //Returns `MockBarcodeDetectionProvider` interface.
  };

  class MockBarcodeDetectionProvider {
    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.