diff options
author | Pale Moon <git-repo@palemoon.org> | 2016-09-01 13:39:08 +0200 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2016-09-01 13:39:08 +0200 |
commit | 3d8ce1a11a7347cc94a937719c4bc8df46fb8d14 (patch) | |
tree | 8c26ca375a6312751c00a27e1653fb6f189f0463 /browser/devtools/profiler/test/browser_profiler_shared-front-05.js | |
parent | e449bdb1ec3a82f204bffdd9c3c54069d086eee3 (diff) | |
download | palemoon-gre-3d8ce1a11a7347cc94a937719c4bc8df46fb8d14.tar.gz |
Base import of Tycho code (warning: huge commit)
Diffstat (limited to 'browser/devtools/profiler/test/browser_profiler_shared-front-05.js')
-rw-r--r-- | browser/devtools/profiler/test/browser_profiler_shared-front-05.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/browser/devtools/profiler/test/browser_profiler_shared-front-05.js b/browser/devtools/profiler/test/browser_profiler_shared-front-05.js new file mode 100644 index 000000000..26e564daf --- /dev/null +++ b/browser/devtools/profiler/test/browser_profiler_shared-front-05.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests if the framerate front is kept recording only when required. + */ + +let test = Task.async(function*() { + let [,, panel] = yield initFrontend(SIMPLE_URL); + let front = panel.panelWin.gFront; + + let SharedProfilerUtils = devtools.require("devtools/profiler/shared"); + let sharedProfilerConnection = SharedProfilerUtils.getProfilerConnection(panel._toolbox); + + ok(!(yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should not be recording yet."); + + yield front.startRecording(); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should now be recording."); + + yield consoleProfile(sharedProfilerConnection, "1"); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (1)."); + + yield front.startRecording(); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (2)."); + + yield consoleProfile(sharedProfilerConnection, "2"); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (3)."); + + yield front.stopRecording(); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (4)."); + + yield consoleProfileEnd(sharedProfilerConnection); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (5)."); + + yield front.stopRecording(); + ok((yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should still be recording (6)."); + + yield consoleProfileEnd(sharedProfilerConnection); + ok(!(yield sharedProfilerConnection._framerate.isRecording()), + "The framerate actor should finally have stopped recording."); + + yield teardown(panel); + finish(); +}); + +function* consoleProfile(connection, label) { + let notified = connection.once("profile"); + console.profile(label); + yield notified; +} + +function* consoleProfileEnd(connection) { + let notified = connection.once("profileEnd"); + console.profileEnd(); + yield notified; +} |