diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/memory/test/unit/test_action-clear-snapshots_06.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/memory/test/unit/test_action-clear-snapshots_06.js')
-rw-r--r-- | devtools/client/memory/test/unit/test_action-clear-snapshots_06.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js b/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js new file mode 100644 index 000000000..1ee32bb12 --- /dev/null +++ b/devtools/client/memory/test/unit/test_action-clear-snapshots_06.js @@ -0,0 +1,65 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that clearSnapshots disables diffing when deleting snapshots + +const { + takeSnapshotAndCensus, + clearSnapshots +} = require("devtools/client/memory/actions/snapshot"); +const { + snapshotState: states, + actions, + treeMapState +} = require("devtools/client/memory/constants"); +const { + toggleDiffing, + selectSnapshotForDiffingAndRefresh +} = require("devtools/client/memory/actions/diffing"); + +function run_test() { + run_next_test(); +} + +add_task(function* () { + let front = new StubbedMemoryFront(); + let heapWorker = new HeapAnalysesClient(); + yield front.attach(); + let store = Store(); + const { getState, dispatch } = store; + + ok(true, "create 2 snapshots with a saved census"); + dispatch(takeSnapshotAndCensus(front, heapWorker)); + dispatch(takeSnapshotAndCensus(front, heapWorker)); + yield waitUntilCensusState(store, snapshot => snapshot.treeMap, + [treeMapState.SAVED, treeMapState.SAVED]); + ok(true, "snapshots created with a saved census"); + + dispatch(toggleDiffing()); + dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, + getState().snapshots[0])); + dispatch(selectSnapshotForDiffingAndRefresh(heapWorker, + getState().snapshots[1])); + + ok(getState().diffing, "We should be in diffing view"); + + yield waitUntilAction(store, actions.TAKE_CENSUS_DIFF_END); + ok(true, "Received TAKE_CENSUS_DIFF_END action"); + + ok(true, "Dispatch clearSnapshots action"); + let deleteEvents = Promise.all([ + waitUntilAction(store, actions.DELETE_SNAPSHOTS_START), + waitUntilAction(store, actions.DELETE_SNAPSHOTS_END) + ]); + dispatch(clearSnapshots(heapWorker)); + yield deleteEvents; + ok(true, "received delete snapshots events"); + + ok(getState().snapshots.length === 0, "Snapshots array should be empty"); + ok(!getState().diffing, "We should no longer be diffing"); + + heapWorker.destroy(); + yield front.detach(); +}); |