|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Test if request and response body logging stays on after opening the console. |
|
6 */ |
|
7 |
|
8 function test() { |
|
9 initNetMonitor(JSON_LONG_URL).then(([aTab, aDebuggee, aMonitor]) => { |
|
10 info("Starting test... "); |
|
11 |
|
12 let { L10N, NetMonitorView } = aMonitor.panelWin; |
|
13 let { RequestsMenu } = NetMonitorView; |
|
14 |
|
15 RequestsMenu.lazyUpdate = false; |
|
16 |
|
17 function verifyRequest(aOffset) { |
|
18 verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOffset), |
|
19 "GET", CONTENT_TYPE_SJS + "?fmt=json-long", { |
|
20 status: 200, |
|
21 statusText: "OK", |
|
22 type: "json", |
|
23 fullMimeType: "text/json; charset=utf-8", |
|
24 size: L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(85975/1024, 2)), |
|
25 time: true |
|
26 }); |
|
27 } |
|
28 |
|
29 waitForNetworkEvents(aMonitor, 1).then(() => { |
|
30 verifyRequest(0); |
|
31 |
|
32 aMonitor._toolbox.once("webconsole-selected", () => { |
|
33 aMonitor._toolbox.once("netmonitor-selected", () => { |
|
34 |
|
35 waitForNetworkEvents(aMonitor, 1).then(() => { |
|
36 waitForNetworkEvents(aMonitor, 1).then(() => { |
|
37 verifyRequest(1); |
|
38 teardown(aMonitor).then(finish); |
|
39 }); |
|
40 |
|
41 // Perform another batch of requests. |
|
42 aDebuggee.performRequests(); |
|
43 }); |
|
44 |
|
45 // Reload debugee. |
|
46 aDebuggee.location.reload(); |
|
47 }); |
|
48 |
|
49 // Switch back to the netmonitor. |
|
50 aMonitor._toolbox.selectTool("netmonitor"); |
|
51 }); |
|
52 |
|
53 // Switch to the webconsole. |
|
54 aMonitor._toolbox.selectTool("webconsole"); |
|
55 }); |
|
56 |
|
57 // Perform first batch of requests. |
|
58 aDebuggee.performRequests(); |
|
59 }); |
|
60 } |