summaryrefslogtreecommitdiffstats
path: root/browser/components/reportbrokensite/test/browser/browser_antitracking_data_sent.js
blob: 794fcd35a0824b1fb73041754485299120374b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

/* Tests to ensure that the right data is sent for
 * private windows and when ETP blocks content.
 */

/* import-globals-from send.js */
/* import-globals-from send_more_info.js */

"use strict";

Services.scriptloader.loadSubScript(
  getRootDirectory(gTestPath) + "send_more_info.js",
  this
);

add_common_setup();

add_task(setupStrictETP);

add_task(async function testSendButton() {
  ensureReportBrokenSitePreffedOn();
  ensureReasonOptional();

  const win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
  const blockedPromise = waitForContentBlockingEvent(4, win);
  const tab = await openTab(REPORTABLE_PAGE_URL3, win);
  await blockedPromise;

  await testSend(tab, AppMenu(win), {
    breakageCategory: "adblockers",
    description: "another test description",
    antitracking: {
      blockList: "strict",
      isPrivateBrowsing: true,
      hasTrackingContentBlocked: true,
      hasMixedActiveContentBlocked: true,
      hasMixedDisplayContentBlocked: true,
    },
    frameworks: {
      fastclick: true,
      marfeel: true,
      mobify: true,
    },
  });

  await BrowserTestUtils.closeWindow(win);
});

add_task(async function testSendingMoreInfo() {
  ensureReportBrokenSitePreffedOn();
  ensureSendMoreInfoEnabled();

  const win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
  const blockedPromise = waitForContentBlockingEvent(4, win);
  const tab = await openTab(REPORTABLE_PAGE_URL3, win);
  await blockedPromise;

  await testSendMoreInfo(tab, HelpMenu(win), {
    antitracking: {
      blockList: "strict",
      isPrivateBrowsing: true,
      hasTrackingContentBlocked: true,
      hasMixedActiveContentBlocked: true,
      hasMixedDisplayContentBlocked: true,
    },
    frameworks: { fastclick: true, mobify: true, marfeel: true },
    consoleLog: [
      {
        level: "error",
        log(actual) {
          // "Blocked loading mixed display content http://example.com/tests/image/test/mochitest/blue.png"
          return (
            Array.isArray(actual) &&
            actual.length == 1 &&
            actual[0].includes("blue.png")
          );
        },
        pos: "0:1",
        uri: REPORTABLE_PAGE_URL3,
      },
      {
        level: "error",
        log(actual) {
          // "Blocked loading mixed active content http://tracking.example.org/browser/browser/base/content/test/protectionsUI/benignPage.html",
          return (
            Array.isArray(actual) &&
            actual.length == 1 &&
            actual[0].includes("benignPage.html")
          );
        },
        pos: "0:1",
        uri: REPORTABLE_PAGE_URL3,
      },
      {
        level: "warn",
        log(actual) {
          // "The resource at https://trackertest.org/ was blocked because content blocking is enabled.",
          return (
            Array.isArray(actual) &&
            actual.length == 1 &&
            actual[0].includes("trackertest.org")
          );
        },
        pos: "0:0",
        uri: REPORTABLE_PAGE_URL3,
      },
    ],
  });

  await BrowserTestUtils.closeWindow(win);
});