gecko-dev/browser/devtools/performance/test/browser_perf-options-allocations.js
Patrick Brosset f74b4d25f0 Bug 1168077 - Remove remaining spidermonkey js specific syntax from browser/devtools; r=miker
--HG--
extra : rebase_source : 15f48894284051c2f10d9b71c94d7074f893002a
2015-05-25 14:42:51 +02:00

34 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that setting the `devtools.performance.memory.` prefs propagate to the memory actor.
*/
function* spawnTest() {
let { panel } = yield initPerformance(SIMPLE_URL);
let { EVENTS, PerformanceController, $, gFront } = panel.panelWin;
Services.prefs.setBoolPref(MEMORY_PREF, true);
let originalProbability = Services.prefs.getCharPref(MEMORY_SAMPLE_PROB_PREF);
let originalLogLength = Services.prefs.getIntPref(MEMORY_MAX_LOG_LEN_PREF);
Services.prefs.setCharPref(MEMORY_SAMPLE_PROB_PREF, "0.213");
Services.prefs.setIntPref(MEMORY_MAX_LOG_LEN_PREF, 777777);
yield startRecording(panel);
let { probability, maxLogLength } = yield gFront._request("memory", "getAllocationsSettings");
yield stopRecording(panel);
is(probability, 0.213, "allocations probability option is set on memory actor");
is(maxLogLength, 777777, "allocations max log length option is set on memory actor");
Services.prefs.setBoolPref(MEMORY_PREF, false);
Services.prefs.setCharPref(MEMORY_SAMPLE_PROB_PREF, originalProbability);
Services.prefs.setIntPref(MEMORY_MAX_LOG_LEN_PREF, originalLogLength);
yield teardown(panel);
finish();
}