tor-browser

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

test_census_diff_03.js (1337B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test diffing census reports of breakdown by "coarseType".
      6 
      7 const BREAKDOWN = {
      8  by: "coarseType",
      9  objects: { by: "count", count: true, bytes: true },
     10  scripts: { by: "count", count: true, bytes: true },
     11  strings: { by: "count", count: true, bytes: true },
     12  other: { by: "count", count: true, bytes: true },
     13  domNode: { by: "count", count: true, bytes: true },
     14 };
     15 
     16 const REPORT1 = {
     17  objects: {
     18    count: 1,
     19    bytes: 10,
     20  },
     21  scripts: {
     22    count: 1,
     23    bytes: 10,
     24  },
     25  strings: {
     26    count: 1,
     27    bytes: 10,
     28  },
     29  other: {
     30    count: 3,
     31    bytes: 30,
     32  },
     33  domNode: {
     34    count: 0,
     35    bytes: 0,
     36  },
     37 };
     38 
     39 const REPORT2 = {
     40  objects: {
     41    count: 1,
     42    bytes: 10,
     43  },
     44  scripts: {
     45    count: 0,
     46    bytes: 0,
     47  },
     48  strings: {
     49    count: 2,
     50    bytes: 20,
     51  },
     52  other: {
     53    count: 4,
     54    bytes: 40,
     55  },
     56  domNode: {
     57    count: 0,
     58    bytes: 0,
     59  },
     60 };
     61 
     62 const EXPECTED = {
     63  objects: {
     64    count: 0,
     65    bytes: 0,
     66  },
     67  scripts: {
     68    count: -1,
     69    bytes: -10,
     70  },
     71  strings: {
     72    count: 1,
     73    bytes: 10,
     74  },
     75  other: {
     76    count: 1,
     77    bytes: 10,
     78  },
     79  domNode: {
     80    count: 0,
     81    bytes: 0,
     82  },
     83 };
     84 
     85 function run_test() {
     86  assertDiff(BREAKDOWN, REPORT1, REPORT2, EXPECTED);
     87 }