author | Makoto Kato <m_kato@ga2.so-net.ne.jp> |
Wed, 14 Mar 2018 15:05:54 +0900 | |
changeset 767275 | 87aa002a8fbc6dbf308279cd4ce9a5500ea88c35 |
parent 767269 | 6f5962c213ad5ead21a1307439961fc954c41c2d |
push id | 102549 |
push user | bmo:m_kato@ga2.so-net.ne.jp |
push date | Wed, 14 Mar 2018 07:42:40 +0000 |
reviewers | gregtatum |
bugs | 1444796 |
milestone | 61.0a1 |
--- a/devtools/server/actors/perf.js +++ b/devtools/server/actors/perf.js @@ -136,14 +136,17 @@ exports.PerfActor = ActorClassWithSpec(p if (PrivateBrowsingUtils.isWindowPrivate(subject)) { this.emit("profile-locked-by-private-browsing"); } break; case "last-pb-context-exited": this.emit("profile-unlocked-from-private-browsing"); break; case "profiler-started": + let param = subject.QueryInterface(Ci.nsIProfilerStartParams); + this.emit(topic, param.entries, param.interval, param.features); + break; case "profiler-stopped": this.emit(topic); break; } } });
--- a/devtools/server/tests/browser/browser.ini +++ b/devtools/server/tests/browser/browser.ini @@ -71,16 +71,17 @@ skip-if = e10s # Bug 1183605 - devtools/ [browser_markers-parse-html.js] [browser_markers-styles.js] [browser_markers-timestamp.js] [browser_navigateEvents.js] skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still disabled in E10S [browser_perf-01.js] [browser_perf-02.js] [browser_perf-03.js] +[browser_perf-04.js] [browser_perf-allocation-data.js] skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still disabled in E10S [browser_perf-profiler-01.js] [browser_perf-profiler-02.js] skip-if = true # Needs to be updated for async actor destruction [browser_perf-profiler-03.js] skip-if = true # Needs to be updated for async actor destruction [browser_perf-realtime-markers.js]
new file mode 100644 --- /dev/null +++ b/devtools/server/tests/browser/browser_perf-04.js @@ -0,0 +1,36 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +/** + * Run through a series of basic recording actions for the perf actor. + */ +add_task(async function() { + const {front, client} = await initPerfFront(); + + // Assert the initial state. + is(await front.isSupportedPlatform(), true, + "This test only runs on supported platforms."); + is(await front.isLockedForPrivateBrowsing(), false, + "The browser is not in private browsing mode."); + is(await front.isActive(), false, + "The profiler is not active yet."); + + front.once("profiler-started", (entries, interval, features) => { + is(entries, 1000, "Should apply entries by startProfiler"); + is(interval, 0.1, "Should apply interval by startProfiler"); + is(features, 0x82, "Should apply features by startProfiler"); + }); + + // Start the profiler. + await front.startProfiler({ entries: 1000, interval: 0.1, + features: ["js", "stackwalk"] }); + + is(await front.isActive(), true, "The profiler is active."); + + // clean up + await front.stopProfilerAndDiscardProfile(); + await front.destroy(); + await client.close(); +});
--- a/devtools/shared/specs/perf.js +++ b/devtools/shared/specs/perf.js @@ -1,21 +1,24 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { Option, RetVal, generateActorSpec } = require("devtools/shared/protocol"); +const { Arg, Option, RetVal, generateActorSpec } = require("devtools/shared/protocol"); const perfDescription = { typeName: "perf", events: { "profiler-started": { - type: "profiler-started" + type: "profiler-started", + entries: Arg(0, "number"), + interval: Arg(1, "number"), + features: Arg(2, "number"), }, "profiler-stopped": { type: "profiler-stopped" }, "profile-locked-by-private-browsing": { type: "profile-locked-by-private-browsing" }, "profile-unlocked-from-private-browsing": {