mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
parent
f472fe68d0
commit
8c1500707f
163 changed files with 0 additions and 13812 deletions
|
|
@ -1,110 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title></title>
|
||||
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
|
||||
<script type="application/javascript;version=1.8" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script type="application/javascript;version=1.8">
|
||||
window.onload = function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
Task.spawn(function* () {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
let win = yield openWebIDE();
|
||||
let docRuntime = getRuntimeDocument(win);
|
||||
let docProject = getProjectDocument(win);
|
||||
|
||||
let panelNode = docRuntime.querySelector("#runtime-panel");
|
||||
let items = panelNode.querySelectorAll(".runtime-panel-item-other");
|
||||
is(items.length, 2, "Found 2 runtime buttons");
|
||||
|
||||
// Connect to local runtime
|
||||
let connectionsChanged = waitForConnectionChange("opened", 2);
|
||||
items[1].click();
|
||||
|
||||
yield waitForUpdate(win, "runtime-targets");
|
||||
|
||||
yield connectionsChanged;
|
||||
is(Object.keys(DebuggerServer._connections).length, 2, "Locally connected");
|
||||
|
||||
ok(win.AppManager.isMainProcessDebuggable(), "Main process available");
|
||||
|
||||
// Select main process
|
||||
yield win.Cmds.showProjectPanel();
|
||||
yield waitForUpdate(win, "runtime-targets");
|
||||
SimpleTest.executeSoon(() => {
|
||||
docProject.querySelectorAll("#project-panel-runtimeapps .panel-item")[0].click();
|
||||
});
|
||||
|
||||
yield waitForUpdate(win, "project");
|
||||
|
||||
let lastProject = Services.prefs.getCharPref("devtools.webide.lastSelectedProject");
|
||||
is(lastProject, "mainProcess:", "Last project is main process");
|
||||
|
||||
connectionsChanged = waitForConnectionChange("closed", 2);
|
||||
|
||||
yield nextTick();
|
||||
yield closeWebIDE(win);
|
||||
|
||||
yield connectionsChanged;
|
||||
is(Object.keys(DebuggerServer._connections).length, 0, "Disconnected");
|
||||
|
||||
connectionsChanged = waitForConnectionChange("opened", 2);
|
||||
|
||||
// Re-open, should reselect main process after connection
|
||||
win = yield openWebIDE();
|
||||
|
||||
docRuntime = getRuntimeDocument(win);
|
||||
|
||||
panelNode = docRuntime.querySelector("#runtime-panel");
|
||||
items = panelNode.querySelectorAll(".runtime-panel-item-other");
|
||||
is(items.length, 2, "Found 2 runtime buttons");
|
||||
|
||||
// Connect to local runtime
|
||||
items[1].click();
|
||||
|
||||
yield waitForUpdate(win, "runtime-targets");
|
||||
|
||||
yield connectionsChanged;
|
||||
is(Object.keys(DebuggerServer._connections).length, 2, "Locally connected");
|
||||
ok(win.AppManager.isMainProcessDebuggable(), "Main process available");
|
||||
is(win.AppManager.selectedProject.type, "mainProcess", "Main process reselected");
|
||||
|
||||
// Wait for the toolbox to be fully loaded
|
||||
yield win.UI.toolboxPromise;
|
||||
|
||||
// If we happen to pass a project object targeting the same context,
|
||||
// here, the main process, the `selectedProject` attribute shouldn't be updated
|
||||
// so that no `project` event would fire.
|
||||
let oldProject = win.AppManager.selectedProject;
|
||||
win.AppManager.selectedProject = {
|
||||
type: "mainProcess"
|
||||
};
|
||||
is(win.AppManager.selectedProject, oldProject, "AppManager.selectedProject shouldn't be updated if we selected the same project");
|
||||
|
||||
yield win.Cmds.disconnectRuntime();
|
||||
|
||||
yield closeWebIDE(win);
|
||||
|
||||
DebuggerServer.destroy();
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue