Files
sousa-gecko/testing/web-platform/tests/ai/classifier/classifier-create.tentative.https.window.js
T
devincabillo 35b084a941 Bug 2031466 [wpt PR 59058] - Introduces an AIClassifier to the Chrome browser., a=testonly
Automatic update from web-platform-tests
Introduces an AIClassifier to the Chrome browser.

AIClassifier is a new feature that allows the browser to classify text.
This new feature is exposed to Blink via a new Mojo interface.

I2P:
https://groups.google.com/a/chromium.org/g/blink-dev/c/5dQNl-gyjgU/m/6YBJJIiDAQAJ

The change includes the following:

Blink Mojom: New AIClassifier interface and associated data structures.
Chrome Implementation: AIClassifier class in chrome/browser/ai that uses
an OnDeviceSession to interact with the classification model. AIManager
Integration: Added CanCreateClassifier and CreateClassifier methods to
AIManager to allow Blink to request and create AIClassifier instances.
Content Implementation: EchoAIClassifier for testing purposes.

Metrics: Added kClassifier to the AISessionType enum.
Renderer: Updated classifier.cc to call the new AIManager methods.
Bug: 483707607
Change-Id: I04676439afb3feed54237a701365b332910a10f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7688370
Reviewed-by: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Jingyun Liu <jingyun@google.com>
Commit-Queue: Devin Cabillo <devincabillo@google.com>
Cr-Commit-Position: refs/heads/main@{#1611826}

--

wpt-commits: c8f85b5816fc1990da0b3051e58d90578220efa3
wpt-pr: 59058
2026-04-23 10:09:19 +00:00

20 lines
817 B
JavaScript

// 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();
assert_implements_optional(availability !== 'unavailable', 'classifier is unavailable');
const classifier = await createClassifier();
assert_true(!!classifier, 'Classifier was successfully created');
}, 'Classifier.create() behavior depends on availability');
promise_test(async t => {
const availability = await Classifier.availability();
assert_implements_optional(availability !== 'unavailable', 'classifier is unavailable');
await testCreateMonitorCallbackThrowsError(t, createClassifier);
}, 'If monitor throws an error, Classifier.create() rejects with that error');