commit a15d5b81c4cb7ea0fa24841d398dadebab012fc4 parent 9e381078c88d83fa3b6c3a0f8f34289df9bfc268 Author: Mike Wasserman <msw@chromium.org> Date: Wed, 15 Oct 2025 08:43:48 +0000 Bug 1993928 [wpt PR 55366] - Built-In AI APIs: Fix WPT GC util function, a=testonly Automatic update from web-platform-tests Built-In AI APIs: Fix WPT GC util function Various tests were incorrectly using gc(), which is a wpt_internal util. Use the centralized WPT common/gc.js garbageGollect() function instead. Fixed: 443911574 Test: WPTs still pass in local runs and wpt.live Change-Id: I52d5c07f7e641f94c083af69e9caa83a196f9fe0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7032847 Reviewed-by: Brad Triebwasser <btriebw@chromium.org> Commit-Queue: Brad Triebwasser <btriebw@chromium.org> Commit-Queue: Mike Wasserman <msw@chromium.org> Auto-Submit: Mike Wasserman <msw@chromium.org> Cr-Commit-Position: refs/heads/main@{#1528418} -- wpt-commits: 39370837c72b1cceed5cf86c2a9770fb1b250cea wpt-pr: 55366 Diffstat:
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/testing/web-platform/tests/ai/rewriter/rewriter-rewrite-streaming.tentative.https.window.js b/testing/web-platform/tests/ai/rewriter/rewriter-rewrite-streaming.tentative.https.window.js @@ -1,4 +1,5 @@ // META: title=Rewriter Rewrite Streaming +// META: script=/common/gc.js // META: script=/resources/testdriver.js // META: script=../resources/util.js // META: timeout=long @@ -51,13 +52,13 @@ promise_test(async () => { promise_test(async () => { const rewriter = await createRewriter(); const streamingResponse = rewriter.rewriteStreaming(kTestPrompt); - gc(); + garbageCollect(); assert_equals(Object.prototype.toString.call(streamingResponse), '[object ReadableStream]'); let result = ''; for await (const value of streamingResponse) { result += value; - gc(); + garbageCollect(); } assert_greater_than(result.length, 0, 'The result should not be empty.'); }, 'Rewrite Streaming API must continue even after GC has been performed.'); diff --git a/testing/web-platform/tests/ai/summarizer/summarizer-summarize-streaming.tentative.https.window.js b/testing/web-platform/tests/ai/summarizer/summarizer-summarize-streaming.tentative.https.window.js @@ -1,4 +1,5 @@ // META: title=Summarizer Summarize Streaming +// META: script=/common/gc.js // META: script=/resources/testdriver.js // META: script=../resources/util.js // META: timeout=long @@ -51,13 +52,13 @@ promise_test(async () => { promise_test(async t => { const summarizer = await createSummarizer(); const streamingResponse = summarizer.summarizeStreaming(kTestPrompt); - gc(); + garbageCollect(); assert_equals(Object.prototype.toString.call(streamingResponse), '[object ReadableStream]'); let result = ''; for await (const value of streamingResponse) { result += value; - gc(); + garbageCollect(); } assert_greater_than(result.length, 0, 'The result should not be empty.'); }, 'Summarize Streaming API must continue even after GC has been performed.'); diff --git a/testing/web-platform/tests/ai/translator/translator.optional.https.window.js b/testing/web-platform/tests/ai/translator/translator.optional.https.window.js @@ -2,6 +2,7 @@ // META: global=window // META: timeout=long // META: script=../resources/util.js +// META: script=/common/gc.js // META: script=/resources/testdriver.js // META: script=resources/util.js // @@ -49,15 +50,15 @@ promise_test(async () => { const translator = await createTranslator({sourceLanguage: 'en', targetLanguage: 'ja'}); const streamingResponse = translator.translateStreaming('hello'); - gc(); + garbageCollect(); assert_equals(Object.prototype.toString.call(streamingResponse), '[object ReadableStream]'); let result = ''; for await (const value of streamingResponse) { result += value; - gc(); + garbageCollect(); } -assert_greater_than(result.length, 0, 'The result should not be empty.'); + assert_greater_than(result.length, 0, 'The result should not be empty.'); }, 'Translate Streaming API must continue even after GC has been performed.'); promise_test(async t => { diff --git a/testing/web-platform/tests/ai/writer/writer-write-streaming.tentative.https.window.js b/testing/web-platform/tests/ai/writer/writer-write-streaming.tentative.https.window.js @@ -1,4 +1,5 @@ // META: title=Writer Write Streaming +// META: script=/common/gc.js // META: script=/resources/testdriver.js // META: script=../resources/util.js // META: timeout=long @@ -51,13 +52,13 @@ promise_test(async () => { promise_test(async () => { const writer = await createWriter(); const streamingResponse = writer.writeStreaming(kTestPrompt); - gc(); + garbageCollect(); assert_equals(Object.prototype.toString.call(streamingResponse), '[object ReadableStream]'); let result = ''; for await (const value of streamingResponse) { result += value; - gc(); + garbageCollect(); } assert_greater_than(result.length, 0, 'The result should not be empty.'); }, 'Write Streaming API must continue even after GC has been performed.');