Bug 1146926: Fix SDK remote tests to pass with e10s enabled. r=gabor

By not waiting for the tab to finish loading we end up accidentally killing
the child process somehow and later tests that expect a child process to be
present fail.
This commit is contained in:
Dave Townsend 2015-11-18 15:08:48 -08:00
parent 999aef98b8
commit 5f435fdf37
2 changed files with 14 additions and 0 deletions

View File

@ -46,6 +46,7 @@ exports["test process restart"] = function*(assert) {
let tabs = getTabs(window); let tabs = getTabs(window);
assert.equal(tabs.length, 1, "Should have just the one tab to start with"); assert.equal(tabs.length, 1, "Should have just the one tab to start with");
let tab = tabs[0]; let tab = tabs[0];
let browser = getBrowserForTab(tab);
let loader = new Loader(module); let loader = new Loader(module);
let { processes, frames } = yield waitForProcesses(loader); let { processes, frames } = yield waitForProcesses(loader);
@ -59,6 +60,7 @@ exports["test process restart"] = function*(assert) {
let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach'); let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach');
let frameAttach = promiseTabFrameAttach(frames); let frameAttach = promiseTabFrameAttach(frames);
let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach'); let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach');
let browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, LOCAL_URI); setTabURL(tab, LOCAL_URI);
// The load should kill the remote frame // The load should kill the remote frame
yield frameDetach; yield frameDetach;
@ -67,10 +69,12 @@ exports["test process restart"] = function*(assert) {
assert.equal(newFrame.process, localProcess, "New frame should be in the local process"); assert.equal(newFrame.process, localProcess, "New frame should be in the local process");
// And kill the process // And kill the process
yield processDetach; yield processDetach;
yield browserLoad;
frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach'); frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach');
let processAttach = promiseEvent(processes, 'attach'); let processAttach = promiseEvent(processes, 'attach');
frameAttach = promiseTabFrameAttach(frames); frameAttach = promiseTabFrameAttach(frames);
browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, REMOTE_URI); setTabURL(tab, REMOTE_URI);
// The load should kill the remote frame // The load should kill the remote frame
yield frameDetach; yield frameDetach;
@ -80,8 +84,11 @@ exports["test process restart"] = function*(assert) {
// And create a new frame in the remote process // And create a new frame in the remote process
[newFrame] = yield frameAttach; [newFrame] = yield frameAttach;
assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process"); assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process");
yield browserLoad;
browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, "about:blank"); setTabURL(tab, "about:blank");
yield browserLoad;
loader.unload(); loader.unload();
}; };

View File

@ -46,6 +46,7 @@ exports["test process restart"] = function*(assert) {
let tabs = getTabs(window); let tabs = getTabs(window);
assert.equal(tabs.length, 1, "Should have just the one tab to start with"); assert.equal(tabs.length, 1, "Should have just the one tab to start with");
let tab = tabs[0]; let tab = tabs[0];
let browser = getBrowserForTab(tab);
let loader = new Loader(module); let loader = new Loader(module);
let { processes, frames } = yield waitForProcesses(loader); let { processes, frames } = yield waitForProcesses(loader);
@ -59,6 +60,7 @@ exports["test process restart"] = function*(assert) {
let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach'); let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach');
let frameAttach = promiseTabFrameAttach(frames); let frameAttach = promiseTabFrameAttach(frames);
let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach'); let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach');
let browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, LOCAL_URI); setTabURL(tab, LOCAL_URI);
// The load should kill the remote frame // The load should kill the remote frame
yield frameDetach; yield frameDetach;
@ -67,10 +69,12 @@ exports["test process restart"] = function*(assert) {
assert.equal(newFrame.process, localProcess, "New frame should be in the local process"); assert.equal(newFrame.process, localProcess, "New frame should be in the local process");
// And kill the process // And kill the process
yield processDetach; yield processDetach;
yield browserLoad;
frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach'); frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach');
let processAttach = promiseEvent(processes, 'attach'); let processAttach = promiseEvent(processes, 'attach');
frameAttach = promiseTabFrameAttach(frames); frameAttach = promiseTabFrameAttach(frames);
browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, REMOTE_URI); setTabURL(tab, REMOTE_URI);
// The load should kill the remote frame // The load should kill the remote frame
yield frameDetach; yield frameDetach;
@ -80,8 +84,11 @@ exports["test process restart"] = function*(assert) {
// And create a new frame in the remote process // And create a new frame in the remote process
[newFrame] = yield frameAttach; [newFrame] = yield frameAttach;
assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process"); assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process");
yield browserLoad;
browserLoad = promiseDOMEvent(browser, "load", true);
setTabURL(tab, "about:blank"); setTabURL(tab, "about:blank");
yield browserLoad;
loader.unload(); loader.unload();
}; };