diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/parakeet | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/parakeet')
4 files changed, 175 insertions, 0 deletions
diff --git a/testing/web-platform/tests/parakeet/META.yml b/testing/web-platform/tests/parakeet/META.yml new file mode 100644 index 0000000000..cb059fe6bb --- /dev/null +++ b/testing/web-platform/tests/parakeet/META.yml @@ -0,0 +1,2 @@ +suggested_reviewers: + - Brandr0id diff --git a/testing/web-platform/tests/parakeet/createAdRequest.tentative.https.sub.window.js b/testing/web-platform/tests/parakeet/createAdRequest.tentative.https.sub.window.js new file mode 100644 index 0000000000..1cb3b7d9af --- /dev/null +++ b/testing/web-platform/tests/parakeet/createAdRequest.tentative.https.sub.window.js @@ -0,0 +1,120 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +'use strict'; + +const okayAdRequest = { + adRequestUrl: "https://{{host}}:{{ports[https][0]}}", + adProperties: [ + { width: "42", height: "32", slot: "first", lang: "en-ca", adType: "test-ad1", bidFloor: 42.0 }, + { width: "24", height: "48", slot: "first", lang: "en-us", adType: "test-ad2", bidFloor: 42.0 }], + publisherCode: "pubCode123", + targeting: { interests: ["interest1", "interest2"] }, + anonymizedProxiedSignals: [], + fallbackSource: "https://{{domains[www2]}}:{{ports[https][0]}}" +}; + +test(() => { + assert_not_equals(navigator.createAdRequest, undefined); +}, "createAdRequest() should be supported on the navigator interface."); + +promise_test(async t => { + const createPromise = navigator.createAdRequest(okayAdRequest); + + await promise_rejects_dom(t, "NotSupportedError", createPromise); +}, "createAdRequest() should reject with NotSupported initially."); + +promise_test(async t => { + const createPromise = navigator.createAdRequest(); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject missing parameters."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + delete adRequest.adRequestUrl; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject a missing adRequestUrl."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + adRequest.adRequestUrl = "http://{{host}}:{{ports[https][0]}}"; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject a HTTP adRequestUrl."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + delete adRequest.adProperties; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject missing adProperties."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + adRequest.adProperties = []; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject empty adProperties."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + adRequest.fallbackSource = "http://{{host}}:{{ports[https][0]}}"; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject a HTTP fallbackSource."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + + // delete all optional params and the request should still be okay. + delete adRequest.anonymizedProxiedSignals; + delete adRequest.fallbackSource; + delete adRequest.publisherCode; + delete adRequest.targeting; + + const createPromise = navigator.createAdRequest(adRequest); + + // Until fully implemented we expect a NotSupportedError instead of success. + await promise_rejects_dom(t, "NotSupportedError", createPromise); +}, "createAdRequest() should have optional params."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + // A single adProperties object should be accepted as well as a sequence. + adRequest.adProperties = { width: "24", height: "48", slot: "first", lang: "en-us", adType: "test-ad2", bidFloor: 42.0 }; + + const createPromise = navigator.createAdRequest(adRequest); + + // Until fully implemented we expect a NotSupportedError instead of success. + await promise_rejects_dom(t, "NotSupportedError", createPromise); +}, "createAdRequest() should accept a single adProperties."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + adRequest.anonymizedProxiedSignals = ["coarse-geolocation", "coarse-ua", "targeting", "user-ad-interests"]; + + const createPromise = navigator.createAdRequest(adRequest); + + // Until fully implemented we expect a NotSupportedError instead of success. + await promise_rejects_dom(t, "NotSupportedError", createPromise); +}, "createAdRequest() should accept valid anonymizedProxiedSignals."); + +promise_test(async t => { + const adRequest = Object.assign({}, okayAdRequest); + adRequest.anonymizedProxiedSignals = ["coarse-geolocation", "unknown-type"]; + + const createPromise = navigator.createAdRequest(adRequest); + + await promise_rejects_js(t, TypeError, createPromise); +}, "createAdRequest() should reject unknown anonymizedPRoxiedSignals.");
\ No newline at end of file diff --git a/testing/web-platform/tests/parakeet/finalizeAd.tentative.https.sub.window.js b/testing/web-platform/tests/parakeet/finalizeAd.tentative.https.sub.window.js new file mode 100644 index 0000000000..e8bf6753f0 --- /dev/null +++ b/testing/web-platform/tests/parakeet/finalizeAd.tentative.https.sub.window.js @@ -0,0 +1,39 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +'use strict'; + +const okayAuctionRequest = { + seller: "https://{{host}}:{{ports[https][0]}}", + decisionLogicUrl: "https://{{host}}:{{ports[https][0]}}", + perBuyerSignals: {"{{host}}": { randomParam: "value1" }}, + auctionSignals: "pubCode123", + sellerSignals: { someKey: "sellerValue" } +}; + +test(() => { + assert_not_equals(navigator.finalizeAd, undefined); +}, "finalizeAd() should be supported on the navigator interface."); + +promise_test(async t => { + const finalizePromise = navigator.finalizeAd({}, okayAuctionRequest); + + await promise_rejects_js(t, TypeError, finalizePromise); +}, "finalizeAd() should reject an invalid Ads object."); + +promise_test(async t => { + const auctionRequest = Object.assign({}, okayAuctionRequest); + delete auctionRequest.decisionLogicUrl; + + const finalizePromise = navigator.finalizeAd({}, auctionRequest); + + await promise_rejects_js(t, TypeError, finalizePromise); +}, "finalizeAd() should reject a missing decisionLogicUrl."); + +promise_test(async t => { + const auctionRequest = Object.assign({}, okayAuctionRequest); + auctionRequest.decisionLogicUrl = "http://{{host}}:{{ports[https][0]}}"; + + const finalizePromise = navigator.finalizeAd({}, auctionRequest); + + await promise_rejects_js(t, TypeError, finalizePromise); +}, "finalizeAd() should reject a non-HTTPS decisionLogicUrl.");
\ No newline at end of file diff --git a/testing/web-platform/tests/parakeet/idlharness.tentative.https.window.js b/testing/web-platform/tests/parakeet/idlharness.tentative.https.window.js new file mode 100644 index 0000000000..ac6862f06e --- /dev/null +++ b/testing/web-platform/tests/parakeet/idlharness.tentative.https.window.js @@ -0,0 +1,14 @@ +// META: global=window,worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +'use strict'; + +idl_test( + ['parakeet.tentative'], + ['html'], + idl_array => { + idl_array.add_objects({ + Navigator: ['navigator'], + }); + } +); |