|
6 | 6 | // META: script=third_party/cbor-js/cbor.js
|
7 | 7 | // META: script=/common/subset-tests.js
|
8 | 8 | // META: timeout=long
|
9 |
| -// META: variant=?1-4 |
10 |
| -// META: variant=?5-8 |
11 |
| -// META: variant=?9-12 |
12 |
| -// META: variant=?13-16 |
13 |
| -// META: variant=?17-20 |
14 |
| -// META: variant=?21-24 |
15 |
| -// META: variant=?25-28 |
16 |
| -// META: variant=?29-32 |
17 |
| -// META: variant=?33-36 |
18 |
| -// META: variant=?37-40 |
19 |
| -// META: variant=?41-44 |
20 |
| -// META: variant=?45-48 |
21 |
| -// META: variant=?49-52 |
22 |
| -// META: variant=?53-56 |
23 |
| -// META: variant=?57-60 |
24 |
| -// META: variant=?61-64 |
| 9 | +// META: variant=?1-6 |
| 10 | +// META: variant=?7-10 |
| 11 | +// META: variant=?11-14 |
| 12 | +// META: variant=?15-18 |
| 13 | +// META: variant=?19-22 |
| 14 | +// META: variant=?23-26 |
| 15 | +// META: variant=?27-30 |
| 16 | +// META: variant=?31-34 |
| 17 | +// META: variant=?35-38 |
| 18 | +// META: variant=?39-42 |
| 19 | +// META: variant=?43-46 |
| 20 | +// META: variant=?47-50 |
| 21 | +// META: variant=?51-54 |
| 22 | +// META: variant=?55-58 |
| 23 | +// META: variant=?59-62 |
| 24 | +// META: variant=?63-66 |
25 | 25 |
|
26 | 26 | // These tests focus on the serverResponse field in AuctionConfig, e.g.
|
27 | 27 | // auctions involving bidding and auction services.
|
@@ -68,6 +68,86 @@ subsetTest(promise_test, async test => {
|
68 | 68 | await waitForObservedRequests(uuid, [adA]);
|
69 | 69 | }, 'Basic B&A auction');
|
70 | 70 |
|
| 71 | +subsetTest(promise_test, async test => { |
| 72 | + const uuid = generateUuid(test); |
| 73 | + const adA = createTrackerURL(window.location.origin, uuid, 'track_get', 'a'); |
| 74 | + const adB = createTrackerURL(window.location.origin, uuid, 'track_get', 'b'); |
| 75 | + const adsArray = |
| 76 | + [{renderURL: adA, adRenderId: 'a'}, {renderURL: adB, adRenderId: 'b'}]; |
| 77 | + await joinInterestGroup(test, uuid, {ads: adsArray}); |
| 78 | + |
| 79 | + const result = await navigator.getInterestGroupAdAuctionData({ |
| 80 | + coordinatorOrigin: await BA.configureCoordinator(), |
| 81 | + seller: window.location.origin |
| 82 | + }); |
| 83 | + assert_true(result.requestId !== null); |
| 84 | + assert_true(result.request.length > 0); |
| 85 | + |
| 86 | + let decoded = await BA.decodeInterestGroupData(result.request); |
| 87 | + |
| 88 | + let serverResponseMsg = { |
| 89 | + 'nonce': uuid, |
| 90 | + 'biddingGroups': {}, |
| 91 | + 'adRenderURL': adsArray[0].renderURL, |
| 92 | + 'interestGroupName': DEFAULT_INTEREST_GROUP_NAME, |
| 93 | + 'interestGroupOwner': window.location.origin, |
| 94 | + }; |
| 95 | + serverResponseMsg.biddingGroups[window.location.origin] = [0]; |
| 96 | + |
| 97 | + let serverResponse = |
| 98 | + await BA.encodeServerResponse(serverResponseMsg, decoded); |
| 99 | + |
| 100 | + let hashString = await BA.payloadHash(serverResponse); |
| 101 | + await BA.authorizeServerResponseNonces([uuid]); |
| 102 | + |
| 103 | + let auctionResult = await navigator.runAdAuction({ |
| 104 | + 'seller': window.location.origin, |
| 105 | + 'requestId': result.requestId, |
| 106 | + 'serverResponse': serverResponse, |
| 107 | + 'resolveToConfig': true, |
| 108 | + }); |
| 109 | + expectSuccess(auctionResult); |
| 110 | + createAndNavigateFencedFrame(test, auctionResult); |
| 111 | + await waitForObservedRequests(uuid, [adA]); |
| 112 | +}, 'Basic B&A auction - nonces'); |
| 113 | + |
| 114 | +subsetTest(promise_test, async test => { |
| 115 | + const uuid = generateUuid(test); |
| 116 | + const adA = createTrackerURL(window.location.origin, uuid, 'track_get', 'a'); |
| 117 | + const adB = createTrackerURL(window.location.origin, uuid, 'track_get', 'b'); |
| 118 | + const adsArray = |
| 119 | + [{renderURL: adA, adRenderId: 'a'}, {renderURL: adB, adRenderId: 'b'}]; |
| 120 | + await joinInterestGroup(test, uuid, {ads: adsArray}); |
| 121 | + |
| 122 | + const result = await navigator.getInterestGroupAdAuctionData({ |
| 123 | + coordinatorOrigin: await BA.configureCoordinator(), |
| 124 | + seller: window.location.origin |
| 125 | + }); |
| 126 | + assert_true(result.requestId !== null); |
| 127 | + assert_true(result.request.length > 0); |
| 128 | + |
| 129 | + let decoded = await BA.decodeInterestGroupData(result.request); |
| 130 | + |
| 131 | + let serverResponseMsg = { |
| 132 | + 'biddingGroups': {}, |
| 133 | + 'adRenderURL': adsArray[0].renderURL, |
| 134 | + 'interestGroupName': DEFAULT_INTEREST_GROUP_NAME, |
| 135 | + 'interestGroupOwner': window.location.origin, |
| 136 | + }; |
| 137 | + serverResponseMsg.biddingGroups[window.location.origin] = [0]; |
| 138 | + |
| 139 | + let serverResponse = |
| 140 | + await BA.encodeServerResponse(serverResponseMsg, decoded); |
| 141 | + |
| 142 | + let auctionResult = await navigator.runAdAuction({ |
| 143 | + 'seller': window.location.origin, |
| 144 | + 'requestId': result.requestId, |
| 145 | + 'serverResponse': serverResponse, |
| 146 | + 'resolveToConfig': true, |
| 147 | + }); |
| 148 | + expectNoWinner(auctionResult); |
| 149 | +}, 'Basic B&A auction - not authorized'); |
| 150 | + |
71 | 151 | subsetTest(promise_test, async test => {
|
72 | 152 | const uuid = generateUuid(test);
|
73 | 153 | const adA = createTrackerURL(window.location.origin, uuid, 'track_get', 'a');
|
|
0 commit comments