|
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, function onSetUp(tab, browser, panel) { |
|
12 gTab = tab; |
|
13 gPanel = panel; |
|
14 |
|
15 function done() { |
|
16 tearDown(gTab, () => { gPanel = null; gTab = null; }); |
|
17 } |
|
18 |
|
19 Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, false); |
|
20 recordProfile() |
|
21 .then(toggleGeckoDataOption) |
|
22 .then(recordProfile) |
|
23 .then(done); |
|
24 }); |
|
25 } |
|
26 |
|
27 function recordProfile() { |
|
28 let deferred = promise.defer(); |
|
29 let record = gPanel.controls.record; |
|
30 |
|
31 gPanel.once("started", () => { |
|
32 gPanel.once("parsed", () => { |
|
33 // We cannot be sure which data is returned by |
|
34 // the profiler within a test. Until we get rid |
|
35 // of Cleopatra, at least. |
|
36 deferred.resolve(); |
|
37 }); |
|
38 |
|
39 record.click(); |
|
40 }); |
|
41 |
|
42 record.click(); |
|
43 return deferred.promise; |
|
44 } |
|
45 |
|
46 function toggleGeckoDataOption() { |
|
47 ok(!gPanel.showPlatformData, "showPlatformData is not set"); |
|
48 |
|
49 Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, true); |
|
50 |
|
51 ok(gPanel.showPlatformData, "showPlatformData is set"); |
|
52 } |