|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>"; |
|
5 |
|
6 let gTab, gPanel; |
|
7 |
|
8 function test() { |
|
9 waitForExplicitFinish(); |
|
10 |
|
11 setUp(URL, (tab, browser, panel) => { |
|
12 gTab = tab; |
|
13 gPanel = panel; |
|
14 |
|
15 openProfiler(tab, runTests); |
|
16 }); |
|
17 } |
|
18 |
|
19 function runTests(toolbox) { |
|
20 let panel = toolbox.getPanel("jsprofiler"); |
|
21 let record = gPanel.controls.record; |
|
22 |
|
23 panel.once("started", () => { |
|
24 is(getSidebarItem(1, panel).attachment.state, PROFILE_RUNNING); |
|
25 |
|
26 openConsole(gTab, (hud) => { |
|
27 panel.once("stopped", () => { |
|
28 is(getSidebarItem(1, panel).attachment.state, PROFILE_COMPLETED); |
|
29 tearDown(gTab, () => gTab = gPanel = null); |
|
30 }); |
|
31 |
|
32 hud.jsterm.execute("console.profileEnd()"); |
|
33 }); |
|
34 }); |
|
35 |
|
36 record.click(); |
|
37 } |