зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1240344 - Fix filter propname used when creating toolbar. r=fitzgen
This commit fixes the prop name used when creating the Toolbar component from app.js : Toolbar expects fitlerString, app was providing filter. Extended browser_memory_filter_01.js to check the filter value is preserved after switching views.
This commit is contained in:
Родитель
d3d162692d
Коммит
7d88e0623c
|
@ -109,7 +109,7 @@ const MemoryApp = createClass({
|
|||
inverted,
|
||||
onToggleInverted: () =>
|
||||
dispatch(toggleInvertedAndRefresh(heapWorker)),
|
||||
filter,
|
||||
filterString: filter,
|
||||
setFilterString: filterString =>
|
||||
dispatch(setFilterStringAndRefresh(filterString, heapWorker)),
|
||||
diffing,
|
||||
|
|
|
@ -39,10 +39,7 @@ this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
|
|||
|
||||
// Wait for the dominator tree to be computed and fetched.
|
||||
|
||||
yield waitUntilState(store, state =>
|
||||
state.snapshots[0] &&
|
||||
state.snapshots[0].dominatorTree &&
|
||||
state.snapshots[0].dominatorTree.state === dominatorTreeState.LOADED);
|
||||
yield waitUntilDominatorTreeState(store, [dominatorTreeState.LOADED]);
|
||||
ok(true, "Computed and fetched the dominator tree.");
|
||||
|
||||
// Expand all the dominator tree nodes that are eagerly fetched, except for
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { snapshotState } = require("devtools/client/memory/constants");
|
||||
const { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot");
|
||||
const { toggleInverted } = require("devtools/client/memory/actions/inverted");
|
||||
const {
|
||||
dominatorTreeState,
|
||||
snapshotState,
|
||||
viewState,
|
||||
} = require("devtools/client/memory/constants");
|
||||
const { changeViewAndRefresh } = require("devtools/client/memory/actions/view");
|
||||
|
||||
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
|
||||
|
||||
|
@ -27,7 +30,7 @@ this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
|
|||
EventUtils.synthesizeMouseAtCenter(takeSnapshotButton, {}, panel.panelWin);
|
||||
yield waitUntilSnapshotState(store, [snapshotState.SAVED_CENSUS]);
|
||||
|
||||
const filterInput = doc.getElementById("filter");
|
||||
let filterInput = doc.getElementById("filter");
|
||||
EventUtils.synthesizeMouseAtCenter(filterInput, {}, panel.panelWin);
|
||||
EventUtils.sendString("js::Shape", panel.panelWin);
|
||||
|
||||
|
@ -36,7 +39,32 @@ this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
|
|||
|
||||
yield waitUntilSnapshotState(store, [snapshotState.SAVED_CENSUS]);
|
||||
|
||||
const nameElem = doc.querySelector(".heap-tree-item-field.heap-tree-item-name");
|
||||
let nameElem = doc.querySelector(".heap-tree-item-field.heap-tree-item-name");
|
||||
ok(nameElem, "Should get a tree item row with a name");
|
||||
is(nameElem.textContent.trim(), "js::Shape", "and the tree item should be the one we filtered for");
|
||||
is(nameElem.textContent.trim(), "js::Shape", "the tree item should be the one we filtered for");
|
||||
is(filterInput.value, "js::Shape",
|
||||
"and filter input contains the user value");
|
||||
|
||||
// Now switch the dominator view, then switch back to census view
|
||||
// and check that the filter word is still correctly applied
|
||||
dispatch(changeViewAndRefresh(viewState.DOMINATOR_TREE, heapWorker));
|
||||
ok(true, "change view to dominator tree");
|
||||
|
||||
// Wait for the dominator tree to be computed and fetched.
|
||||
yield waitUntilDominatorTreeState(store, [dominatorTreeState.LOADED]);
|
||||
ok(true, "computed and fetched the dominator tree.");
|
||||
|
||||
dispatch(changeViewAndRefresh(viewState.CENSUS, heapWorker));
|
||||
ok(true, "change view back to census");
|
||||
|
||||
yield waitUntilSnapshotState(store, [snapshotState.SAVED_CENSUS]);
|
||||
|
||||
nameElem = doc.querySelector(".heap-tree-item-field.heap-tree-item-name");
|
||||
filterInput = doc.getElementById("filter");
|
||||
|
||||
ok(nameElem, "Should still get a tree item row with a name");
|
||||
is(nameElem.textContent.trim(), "js::Shape",
|
||||
"the tree item should still be the one we filtered for");
|
||||
is(filterInput.value, "js::Shape",
|
||||
"and filter input still contains the user value");
|
||||
});
|
||||
|
|
|
@ -96,6 +96,30 @@ function waitUntilSnapshotState (store, expected) {
|
|||
return waitUntilState(store, predicate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that will resolve when the provided store matches
|
||||
* the expected array. expectedStates is an array of dominatorTree states.
|
||||
* Expectations :
|
||||
* - store.getState().snapshots.length == expected.length
|
||||
* - snapshots[i].dominatorTree.state == expected[i]
|
||||
*
|
||||
* @param {Store} store
|
||||
* @param {Array<string>} expectedStates [description]
|
||||
* @return {Promise}
|
||||
*/
|
||||
function waitUntilDominatorTreeState(store, expected) {
|
||||
let predicate = () => {
|
||||
let snapshots = store.getState().snapshots;
|
||||
return snapshots.length === expected.length &&
|
||||
expected.every((state, i) => {
|
||||
return snapshots[i].dominatorTree &&
|
||||
snapshots[i].dominatorTree.state === state;
|
||||
});
|
||||
};
|
||||
info(`Waiting for dominator trees to be of state: ${expected}`);
|
||||
return waitUntilState(store, predicate);
|
||||
}
|
||||
|
||||
function takeSnapshot (window) {
|
||||
let { gStore, document } = window;
|
||||
let snapshotCount = gStore.getState().snapshots.length;
|
||||
|
|
Загрузка…
Ссылка в новой задаче