Automatic update from web-platform-tests [Extensions] Add WPT tests for alarms, bookmarks, and browsingData APIs. Previously, there were no Web Platform Tests (WPT) for the chrome.alarms, chrome.bookmarks, and chrome.browsingData APIs in the web-extensions suite. This CL adds WPT tests for these three APIs to verify their presence and basic functionality. We implemented: - browser.alarms.extension.js: Tests create, get, getAll, clear, clearAll, onAlarm listener registration, and error cases. - browser.bookmarks.extension.js: Tests create, get, update, search, getTree, remove, and error cases. - browser.browsingData.extension.js: Tests settings, removeCache, removeCookies, and error cases. The tests are added to TestExpectations as [ Failure ] in chromium since pending changes in web-extensions-helper.js (introduced in github.com/web-platform-tests/wpt/pull/60872) have not been synced to chromium/src due to a temporary WPT importer error (see crbug.com/528388519). TAG=agy CONV=13c67052-fc49-4c0d-808e-ae6eaf3802cd Bug: 527385398 Change-Id: I6923061814f76bfd60e3ab5dd87924c282c714b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8033104 Reviewed-by: Oliver Dunk <oliverdunk@chromium.org> Auto-Submit: Justin Lulejian <jlulejian@chromium.org> Commit-Queue: Justin Lulejian <jlulejian@chromium.org> Cr-Commit-Position: refs/heads/main@{#1657498} -- wpt-commits: 2ac8a782bce6e2b15be340fb154f04090d31669d wpt-pr: 61096
90 lines
3.1 KiB
JavaScript
90 lines
3.1 KiB
JavaScript
browser.test.runTests([
|
|
/**
|
|
* Tests `browser.browsingData.settings` object properties.
|
|
*/
|
|
async function testBrowsingDataSettings() {
|
|
const result = await browser.browsingData.settings();
|
|
browser.test.assertEq(typeof result, 'object',
|
|
'settings() should return an object');
|
|
browser.test.assertEq(typeof result.options, 'object',
|
|
'result.options should be an object');
|
|
browser.test.assertEq(typeof result.options.since, 'number',
|
|
'options.since should be a number');
|
|
browser.test.assertEq(typeof result.dataRemovalPermitted, 'object',
|
|
'result.dataRemovalPermitted should be an object');
|
|
browser.test.assertEq(typeof result.dataRemovalPermitted.cache, 'boolean',
|
|
'dataRemovalPermitted.cache should be a boolean');
|
|
browser.test.assertEq(typeof result.dataRemovalPermitted.cookies, 'boolean',
|
|
'dataRemovalPermitted.cookies should be a boolean');
|
|
browser.test.assertEq(typeof result.dataTypes, 'object',
|
|
'result.dataTypes should be an object');
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.remove`.
|
|
*/
|
|
async function testBrowsingDataRemove() {
|
|
await browser.browsingData.remove({since: 0}, {cache: true, cookies: true});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.removeCache`.
|
|
*/
|
|
async function testBrowsingDataRemoveCache() {
|
|
await browser.browsingData.removeCache({since: 0});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.removeCookies`.
|
|
*/
|
|
async function testBrowsingDataRemoveCookies() {
|
|
await browser.browsingData.removeCookies({since: 0});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.removeDownloads`.
|
|
*/
|
|
async function testBrowsingDataRemoveDownloads() {
|
|
await browser.browsingData.removeDownloads({since: 0});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.removeHistory`.
|
|
*/
|
|
async function testBrowsingDataRemoveHistory() {
|
|
await browser.browsingData.removeHistory({since: 0});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData.removeLocalStorage`.
|
|
*/
|
|
async function testBrowsingDataRemoveLocalStorage() {
|
|
await browser.browsingData.removeLocalStorage({since: 0});
|
|
},
|
|
|
|
/**
|
|
* Tests `browser.browsingData` error cases across multiple methods.
|
|
*/
|
|
function testBrowsingDataErrorCases() {
|
|
// `remove` throws on invalid options argument type.
|
|
browser.test.assertThrows(
|
|
() => browser.browsingData.remove('invalid', {cache: true}));
|
|
|
|
// `remove` throws on invalid dataTypes argument type.
|
|
browser.test.assertThrows(
|
|
() => browser.browsingData.remove({since: 0}, 'invalid'));
|
|
|
|
// `removeCache` throws on invalid options argument type.
|
|
browser.test.assertThrows(() =>
|
|
browser.browsingData.removeCache('invalid'));
|
|
|
|
// `removeCookies` throws on invalid options argument type.
|
|
browser.test.assertThrows(
|
|
() => browser.browsingData.removeCookies('invalid'));
|
|
|
|
// `removeHistory` throws on invalid options argument type.
|
|
browser.test.assertThrows(
|
|
() => browser.browsingData.removeHistory('invalid'));
|
|
}
|
|
]);
|