Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
5 const BASE = "http://example.com/browser/browser/devtools/profiler/test/";
6 const PAGE = BASE + "mock_console_api.html";
8 let gTab, gPanel, gToolbox;
10 function test() {
11 waitForExplicitFinish();
13 setUp(URL, (tab, browser, panel) => {
14 gTab = tab;
15 gPanel = panel;
17 openProfiler(tab, (toolbox) => {
18 gToolbox = toolbox;
19 loadUrl(PAGE, tab, () => {
20 gPanel.sidebar.on("stateChanged", (_, item) => {
21 if (item.attachment.state !== PROFILE_COMPLETED)
22 return;
24 runTests();
25 });
26 });
27 });
28 });
29 }
31 function runTests() {
32 is(getSidebarItem(1).attachment.state, PROFILE_COMPLETED);
34 gPanel.once("parsed", () => {
35 function assertSampleAndFinish() {
36 let [win,doc] = getProfileInternals();
37 let sample = doc.getElementsByClassName("samplePercentage");
39 if (sample.length <= 0)
40 return void setTimeout(assertSampleAndFinish, 100);
42 ok(sample.length > 0, "We have Cleopatra UI displayed");
43 tearDown(gTab, () => {
44 gTab = null;
45 gPanel = null;
46 gToolbox = null;
47 });
48 }
50 assertSampleAndFinish();
51 });
53 let profile = gPanel.profiles.get(1);
54 gPanel.sidebar.selectedItem = gPanel.sidebar.getItemByProfile(profile);
55 }