tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

protected-audience-auction-report-buyers-debug-mode-surface.https.html (5006B)


      1 <!doctype html>
      2 <meta name=timeout content=long>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="resources/protected-audience-helper-module.js"></script>
      7 
      8 <body>
      9 <script>
     10 'use strict';
     11 
     12 promise_test(async test => {
     13  const uuid = generateUuid();
     14 
     15  await runReportTest(
     16      test, uuid, {reportResult: `sendReportTo('${createWritingURL(uuid)}');`},
     17      /*expectedNumReports=*/ 1,
     18      /*overrides=*/ {
     19        runAdAuction: {
     20          auctionReportBuyerKeys: [100n],
     21          auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}}
     22        }
     23      });
     24 }, 'auctionReportBuyerDebugModeConfig missing');
     25 
     26 promise_test(async test => {
     27  const uuid = generateUuid();
     28 
     29  await runReportTest(
     30      test, uuid, {reportResult: `sendReportTo('${createWritingURL(uuid)}');`},
     31      /*expectedNumReports=*/ 1,
     32      /*overrides=*/ {
     33        runAdAuction: {
     34          auctionReportBuyerKeys: [100n],
     35          auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
     36          auctionReportBuyerDebugModeConfig: {enabled: true}
     37        }
     38      });
     39 }, 'auctionReportBuyerDebugModeConfig with enabled true');
     40 
     41 promise_test(async test => {
     42  const uuid = generateUuid();
     43 
     44  await runReportTest(
     45      test, uuid, {reportResult: `sendReportTo('${createWritingURL(uuid)}');`},
     46      /*expectedNumReports=*/ 1,
     47      /*overrides=*/ {
     48        runAdAuction: {
     49          auctionReportBuyerKeys: [100n],
     50          auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
     51          auctionReportBuyerDebugModeConfig: {enabled: true, debugKey: 1234n}
     52        }
     53      });
     54 }, 'auctionReportBuyerDebugModeConfig with enabled true and debug key');
     55 
     56 promise_test(async test => {
     57  const uuid = generateUuid();
     58 
     59  await runReportTest(
     60      test, uuid, {reportResult: `sendReportTo('${createWritingURL(uuid)}');`},
     61      /*expectedNumReports=*/ 1,
     62      /*overrides=*/ {
     63        runAdAuction: {
     64          auctionReportBuyerKeys: [100n],
     65          auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
     66          auctionReportBuyerDebugModeConfig: {enabled: false}
     67        }
     68      });
     69 }, 'auctionReportBuyerDebugModeConfig with enabled false');
     70 
     71 
     72 promise_test(async test => {
     73  const uuid = generateUuid();
     74 
     75  await runReportTest(
     76      test, uuid, {reportResult: `sendReportTo('${createWritingURL(uuid)}');`},
     77      /*expectedNumReports=*/ 1,
     78      /*overrides=*/ {
     79        runAdAuction: {
     80          auctionReportBuyerKeys: [100n],
     81          auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
     82          auctionReportBuyerDebugModeConfig: {}
     83        }
     84      });
     85 }, 'auctionReportBuyerDebugModeConfig empty');
     86 
     87 promise_test(async test => {
     88  const uuid = generateUuid();
     89 
     90  await promise_rejects_js(
     91      test, TypeError,
     92      runReportTest(
     93          test, uuid, {},
     94          /*expectedNumReports=*/ 0,
     95          /*overrides=*/ {
     96            runAdAuction: {
     97              auctionReportBuyerKeys: [100n],
     98              auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
     99              auctionReportBuyerDebugModeConfig: {enabled: true, debugKey: -1n}
    100            }
    101          }));
    102 }, 'auctionReportBuyerDebugModeConfig with negative debug key');
    103 
    104 promise_test(async test => {
    105  const uuid = generateUuid();
    106 
    107  await promise_rejects_js(
    108      test, TypeError,
    109      runReportTest(
    110          test, uuid, {},
    111          /*expectedNumReports=*/ 0,
    112          /*overrides=*/ {
    113            runAdAuction: {
    114              auctionReportBuyerKeys: [100n],
    115              auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
    116              auctionReportBuyerDebugModeConfig:
    117                  {enabled: true, debugKey: 1n << 64n}
    118            }
    119          }));
    120 }, 'auctionReportBuyerDebugModeConfig with too large debug key');
    121 
    122 promise_test(async test => {
    123  const uuid = generateUuid();
    124 
    125  await promise_rejects_js(
    126      test, TypeError,
    127      runReportTest(
    128          test, uuid, {},
    129          /*expectedNumReports=*/ 0,
    130          /*overrides=*/ {
    131            runAdAuction: {
    132              auctionReportBuyerKeys: [100n],
    133              auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
    134              auctionReportBuyerDebugModeConfig:
    135                  {enabled: false, debugKey: 1234n}
    136            }
    137          }));
    138 }, 'auctionReportBuyerDebugModeConfig with debug key and enabled false');
    139 
    140 promise_test(async test => {
    141  const uuid = generateUuid();
    142 
    143  await promise_rejects_js(
    144      test, TypeError,
    145      runReportTest(
    146          test, uuid, {},
    147          /*expectedNumReports=*/ 0,
    148          /*overrides=*/ {
    149            runAdAuction: {
    150              auctionReportBuyerKeys: [100n],
    151              auctionReportBuyers: {interestGroupCount: {bucket: 0n, scale: 1}},
    152              auctionReportBuyerDebugModeConfig: 123
    153            }
    154          }));
    155 }, 'auctionReportBuyerDebugModeConfig not a dictionary');
    156 
    157 </script>
    158 </body>