Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /ai/classifier/classifier-create.tentative.https.window.html - WPT Dashboard Interop Dashboard
// META: title=Classifier Create
// META: script=/resources/testdriver.js
// META: script=../resources/util.js
// META: timeout=long
'use strict';
promise_test(async (t) => {
const availability = await Classifier.availability();
if (availability === 'unavailable') {
// TODO(crbug.com/487291285): Update NotAllowedError to NotSupportedError.
await promise_rejects_dom(
t,
'NotAllowedError',
Classifier.create()
);
} else {
// If the API is available, it should successfully create.
const classifier = await Classifier.create();
assert_true(!!classifier, 'Classifier was successfully created');
}
}, 'Classifier.create() behavior depends on availability');