summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/extensions/api_test/webrequest/test_newTab.html
blob: b81337464150f307f1e2ea66751b0d0af67c5668 (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
<script src="framework.js">
</script>
<script>
runTests([
  // Navigates to a page with a link with target=_blank. Then simulates a click
  // on that link and verifies that the new tab has a correct tab ID assigned.
  function () {
    expect(
      [  // events
        { label: "a-onBeforeRequest",
          event: "onBeforeRequest",
          details: {
            url: getURL("newTab/a.html"),
            frameUrl: getURL("newTab/a.html")
          }
        },
        { label: "a-onResponseStarted",
          event: "onResponseStarted",
          details: {
            url: getURL("newTab/a.html"),
            statusCode: 200,
            fromCache: false,
            statusLine: "HTTP/1.1 200 OK",
            // Request to chrome-extension:// url has no IP.
          }
        },
        { label: "a-onCompleted",
          event: "onCompleted",
          details: {
            url: getURL("newTab/a.html"),
            statusCode: 200,
            fromCache: false,
            statusLine: "HTTP/1.1 200 OK",
            // Request to chrome-extension:// url has no IP.
          }
        },
        { label: "b-onBeforeRequest",
          event: "onBeforeRequest",
          details: {
            url: getURL("newTab/b.html"),
            frameUrl: getURL("newTab/b.html"),
            tabId: 1,
          }
        },
        { label: "b-onResponseStarted",
          event: "onResponseStarted",
          details: {
            url: getURL("newTab/b.html"),
            statusCode: 200,
            fromCache: false,
            statusLine: "HTTP/1.1 200 OK",
            // Request to chrome-extension:// url has no IP.
            tabId: 1,
          }
        },
        { label: "b-onCompleted",
          event: "onCompleted",
          details: {
            url: getURL("newTab/b.html"),
            statusCode: 200,
            fromCache: false,
            statusLine: "HTTP/1.1 200 OK",
            // Request to chrome-extension:// url has no IP.
            tabId: 1,
          }
        },
      ],
      [  // event order
      ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted",
       "b-onBeforeRequest", "b-onResponseStarted", "b-onCompleted"] ]);
    // Notify the api test that we're waiting for the user.
    chrome.test.notifyPass();
  },
]);
</script>