2010-08-26 15:49:51 -07:00
|
|
|
/*
|
|
|
|
* Bug 436069 - Fennec browser-chrome tests to verify correct navigation into the
|
|
|
|
* differents part of the awesome panel
|
|
|
|
*/
|
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
let testURL_01 = chromeRoot + "browser_blank_01.html";
|
|
|
|
|
2010-08-26 15:49:51 -07:00
|
|
|
let gTests = [];
|
|
|
|
let gCurrentTest = null;
|
2010-10-14 06:15:29 -07:00
|
|
|
let Panels = [AllPagesList, HistoryList, BookmarkList];
|
2010-08-26 15:49:51 -07:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
// The "runNextTest" approach is async, so we need to call "waitForExplicitFinish()"
|
|
|
|
// We call "finish()" when the tests are finished
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
// Start the tests
|
|
|
|
setTimeout(runNextTest, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Iterating tests by shifting test out one by one as runNextTest is called.
|
|
|
|
function runNextTest() {
|
|
|
|
// Run the next test until all tests completed
|
|
|
|
if (gTests.length > 0) {
|
|
|
|
gCurrentTest = gTests.shift();
|
|
|
|
info(gCurrentTest.desc);
|
2011-10-06 07:48:31 -07:00
|
|
|
|
|
|
|
// Ensure all tests start with hidden awesome screen
|
|
|
|
AwesomeScreen.activePanel = null;
|
|
|
|
|
2010-08-26 15:49:51 -07:00
|
|
|
gCurrentTest.run();
|
|
|
|
}
|
|
|
|
else {
|
2010-11-05 10:49:35 -07:00
|
|
|
// Close the awesome panel just in case
|
2011-09-01 10:04:29 -07:00
|
|
|
AwesomeScreen.activePanel = null;
|
2010-08-26 15:49:51 -07:00
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-07 07:24:41 -08:00
|
|
|
function waitForNavigationPanel(aCallback, aWaitForHide) {
|
|
|
|
let evt = aWaitForHide ? "NavigationPanelHidden" : "NavigationPanelShown";
|
|
|
|
info("waitFor " + evt + "(" + Components.stack.caller + ")");
|
|
|
|
window.addEventListener(evt, function(aEvent) {
|
|
|
|
info("receive " + evt);
|
|
|
|
window.removeEventListener(aEvent.type, arguments.callee, false);
|
|
|
|
setTimeout(aCallback, 0);
|
|
|
|
}, false);
|
|
|
|
}
|
|
|
|
|
2010-10-14 10:19:04 -07:00
|
|
|
//------------------------------------------------------------------------------
|
2010-11-05 10:49:35 -07:00
|
|
|
// Case: Test awesome bar collapsed state
|
2010-10-14 10:19:04 -07:00
|
|
|
gTests.push({
|
2010-11-05 10:49:35 -07:00
|
|
|
desc: "Test awesome bar collapsed state",
|
2010-10-14 10:19:04 -07:00
|
|
|
|
|
|
|
run: function() {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupShown);
|
2010-10-14 10:19:04 -07:00
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupShown: function() {
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel, AllPagesList, "AllPagesList should be visible");
|
2010-11-02 12:20:11 -07:00
|
|
|
ok(!BrowserUI._edit.collapsed, "The urlbar edit element is visible");
|
|
|
|
ok(BrowserUI._title.collapsed, "The urlbar title element is not visible");
|
2010-10-14 10:19:04 -07:00
|
|
|
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupHidden, true);
|
2011-09-30 21:30:36 -07:00
|
|
|
|
2011-10-03 12:52:21 -07:00
|
|
|
EventUtils.synthesizeKey("VK_ESCAPE", {type: "keypress"}, window);
|
2010-10-14 10:19:04 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
onPopupHidden: function() {
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel, null, "AllPagesList should be dismissed");
|
2010-11-02 12:20:11 -07:00
|
|
|
ok(BrowserUI._edit.collapsed, "The urlbar edit element is not visible");
|
|
|
|
ok(!BrowserUI._title.collapsed, "The urlbar title element is visible");
|
2010-10-14 10:19:04 -07:00
|
|
|
|
|
|
|
runNextTest();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Case: Test typing a character should dismiss the awesome header
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test typing a character should dismiss the awesome header",
|
|
|
|
|
|
|
|
run: function() {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
2010-10-14 06:15:29 -07:00
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel == AllPagesList, true, "AllPagesList should be visible");
|
2010-10-14 06:15:29 -07:00
|
|
|
|
|
|
|
let awesomeHeader = document.getElementById("awesome-header");
|
|
|
|
is(awesomeHeader.hidden, false, "Awesome header should be visible");
|
|
|
|
|
|
|
|
BrowserUI._edit.addEventListener("onsearchbegin", function(aEvent) {
|
2010-11-05 10:49:35 -07:00
|
|
|
if (BrowserUI._edit.value == "")
|
|
|
|
return;
|
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
BrowserUI._edit.removeEventListener(aEvent.type, arguments.callee, true);
|
|
|
|
let awesomeHeader = document.getElementById("awesome-header");
|
|
|
|
is(awesomeHeader.hidden, true, "Awesome header should be hidden");
|
|
|
|
gCurrentTest.onKeyPress();
|
|
|
|
}, true);
|
|
|
|
EventUtils.synthesizeKey("A", {}, window);
|
|
|
|
},
|
|
|
|
|
|
|
|
onKeyPress: function(aKey, aHidden) {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(function() {
|
2010-10-14 06:15:29 -07:00
|
|
|
let awesomeHeader = document.getElementById("awesome-header");
|
|
|
|
is(awesomeHeader.hidden, false, "Awesome header should be visible");
|
|
|
|
runNextTest();
|
2010-12-07 07:24:41 -08:00
|
|
|
}, true);
|
2010-10-14 06:15:29 -07:00
|
|
|
|
2011-10-03 12:52:21 -07:00
|
|
|
EventUtils.synthesizeKey("VK_ESCAPE", {type: "keypress"}, window);
|
2010-10-14 06:15:29 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Case: Test typing a character should open the awesome bar
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test typing a character should open the All Pages List",
|
|
|
|
|
|
|
|
run: function() {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
2010-10-14 06:15:29 -07:00
|
|
|
BookmarkList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
BrowserUI._edit.addEventListener("onsearchbegin", function(aEvent) {
|
|
|
|
BrowserUI._edit.removeEventListener(aEvent.type, arguments.callee, false);
|
|
|
|
gCurrentTest.onSearchBegin();
|
|
|
|
}, false);
|
|
|
|
EventUtils.synthesizeKey("I", {}, window);
|
|
|
|
},
|
|
|
|
|
|
|
|
onSearchBegin: function() {
|
|
|
|
let awesomeHeader = document.getElementById("awesome-header");
|
|
|
|
is(awesomeHeader.hidden, true, "Awesome header should be hidden");
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel == AllPagesList, true, "AllPagesList should be opened on a keydown");
|
2010-10-14 06:15:29 -07:00
|
|
|
is(BrowserUI._edit.readOnly, false, "urlbar should not be readonly after an input");
|
|
|
|
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupHidden, true);
|
2011-10-03 12:52:21 -07:00
|
|
|
EventUtils.synthesizeKey("VK_ESCAPE", {type: "keypress"}, window);
|
2010-10-14 06:15:29 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
onPopupHidden: function() {
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel == null, true, "VK_ESCAPE should have dismissed the awesome panel");
|
2010-10-14 06:15:29 -07:00
|
|
|
runNextTest();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-08-26 15:49:51 -07:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Case: Test opening the awesome panel and checking the urlbar readonly state
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test opening the awesome panel and checking the urlbar readonly state",
|
|
|
|
|
|
|
|
run: function() {
|
|
|
|
is(BrowserUI._edit.readOnly, true, "urlbar input textbox should be readonly");
|
|
|
|
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
2010-10-14 06:15:29 -07:00
|
|
|
AllPagesList.doCommand();
|
2010-08-26 15:49:51 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
is(Elements.urlbarState.getAttribute("mode"), "edit", "bcast_urlbarState mode attribute should be equal to 'edit'");
|
2010-10-10 14:23:28 -07:00
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
let edit = BrowserUI._edit;
|
2011-06-02 17:41:00 -07:00
|
|
|
is(edit.readOnly, BrowserUI._isKeyboardFullscreen(), "urlbar input textbox is readonly if keyboard is fullscreen, editable otherwise");
|
2010-08-26 15:49:51 -07:00
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
let urlString = BrowserUI.getDisplayURI(Browser.selectedBrowser);
|
|
|
|
if (Util.isURLEmpty(urlString))
|
|
|
|
urlString = "";
|
|
|
|
|
2011-03-15 07:30:56 -07:00
|
|
|
let firstPanel = true;
|
2010-10-14 06:15:29 -07:00
|
|
|
Panels.forEach(function(aPanel) {
|
|
|
|
aPanel.doCommand();
|
2011-09-01 10:04:29 -07:00
|
|
|
is(AwesomeScreen.activePanel, aPanel, "The panel " + aPanel.panel.id + " should be selected");
|
2011-03-15 07:30:56 -07:00
|
|
|
if (firstPanel) {
|
|
|
|
// First panel will have selected text, if we are in portrait
|
2011-06-02 17:41:00 -07:00
|
|
|
is(edit.readOnly, BrowserUI._isKeyboardFullscreen(), "urlbar input textbox is readonly if keyboard is fullscreen, editable otherwise");
|
2011-03-15 07:30:56 -07:00
|
|
|
} else {
|
|
|
|
is(edit.readOnly, true, "urlbar input textbox be readonly if not the first panel");
|
|
|
|
}
|
2010-10-14 06:15:29 -07:00
|
|
|
edit.click();
|
2011-03-15 07:30:56 -07:00
|
|
|
is(edit.readOnly, false, "urlbar input textbox should not be readonly after a click, in both landscape and portrait");
|
2010-10-14 06:15:29 -07:00
|
|
|
is(edit.value, urlString, "urlbar value should be equal to the page uri");
|
2011-03-15 07:30:56 -07:00
|
|
|
|
|
|
|
firstPanel = false;
|
2010-10-14 06:15:29 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
runNextTest();
|
|
|
|
}, 0);
|
2010-08-26 15:49:51 -07:00
|
|
|
}
|
|
|
|
});
|
2010-10-14 06:15:29 -07:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Case: Test opening the awesome panel and checking the urlbar selection
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test opening the awesome panel and checking the urlbar selection",
|
|
|
|
|
|
|
|
run: function() {
|
2010-11-17 13:29:05 -08:00
|
|
|
BrowserUI.closeAutoComplete(true);
|
2011-04-19 05:14:00 -07:00
|
|
|
this.currentTab = BrowserUI.newTab(testURL_01);
|
2010-10-14 06:15:29 -07:00
|
|
|
|
|
|
|
// Need to wait until the page is loaded
|
|
|
|
messageManager.addMessageListener("pageshow",
|
|
|
|
function(aMessage) {
|
2011-04-19 05:14:00 -07:00
|
|
|
if (gCurrentTest.currentTab.browser.currentURI.spec != "about:blank") {
|
2010-10-14 06:15:29 -07:00
|
|
|
messageManager.removeMessageListener(aMessage.name, arguments.callee);
|
2010-12-07 07:24:41 -08:00
|
|
|
setTimeout(gCurrentTest.onPageReady, 0);
|
2010-10-14 06:15:29 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onPageReady: function() {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
2010-10-14 06:15:29 -07:00
|
|
|
|
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
let edit = BrowserUI._edit;
|
|
|
|
|
2011-03-15 07:30:56 -07:00
|
|
|
let firstPanel = true;
|
2010-10-14 06:15:29 -07:00
|
|
|
Panels.forEach(function(aPanel) {
|
|
|
|
aPanel.doCommand();
|
2011-06-02 17:41:00 -07:00
|
|
|
if (firstPanel && !BrowserUI._isKeyboardFullscreen()) {
|
2011-03-15 07:30:56 -07:00
|
|
|
// First panel will have selected text, if we are in portrait
|
|
|
|
ok(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, "[case 1] urlbar text should be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
// The click is not sync enough for this to work
|
|
|
|
todo(edit.selectionStart == edit.selectionEnd, "[case 1] urlbar text should not be selected on a click");
|
|
|
|
} else {
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "[case 2] urlbar text should not be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
ok(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, "[case 2] urlbar text should be selected on a click");
|
|
|
|
}
|
|
|
|
firstPanel = false;
|
2010-10-14 06:15:29 -07:00
|
|
|
});
|
|
|
|
|
2010-12-27 09:18:11 -08:00
|
|
|
// We are disabling it early, otherwise calling edit.click(); quickly made input.js though this is a double click (sigh)
|
|
|
|
let oldDoubleClickSelectsAll = Services.prefs.getBoolPref("browser.urlbar.doubleClickSelectsAll");
|
|
|
|
Services.prefs.setBoolPref("browser.urlbar.doubleClickSelectsAll", false);
|
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
let oldClickSelectsAll = edit.clickSelectsAll;
|
|
|
|
edit.clickSelectsAll = false;
|
2011-03-15 07:30:56 -07:00
|
|
|
firstPanel = true;
|
2010-10-14 06:15:29 -07:00
|
|
|
Panels.forEach(function(aPanel) {
|
|
|
|
aPanel.doCommand();
|
2011-06-02 17:41:00 -07:00
|
|
|
if (firstPanel && !BrowserUI._isKeyboardFullscreen()) {
|
2011-03-15 07:30:56 -07:00
|
|
|
// First panel will have selected text, if we are in portrait
|
|
|
|
ok(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, "[case 1] urlbar text should be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
// The click is not sync enough for this to work
|
|
|
|
todo(edit.selectionStart == edit.selectionEnd, "[case 1] urlbar text should not be selected on a click");
|
|
|
|
} else {
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "[case 2] urlbar text should not be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "[case 2] urlbar text should not be selected on a click");
|
|
|
|
}
|
|
|
|
|
|
|
|
firstPanel = false;
|
2010-10-14 06:15:29 -07:00
|
|
|
});
|
2010-12-27 09:18:11 -08:00
|
|
|
|
|
|
|
Panels.forEach(function(aPanel) {
|
|
|
|
aPanel.doCommand();
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "urlbar text should not be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
edit.click();
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "urlbar text should not be selected on a double click");
|
|
|
|
});
|
|
|
|
|
|
|
|
Services.prefs.setBoolPref("browser.urlbar.doubleClickSelectsAll", oldDoubleClickSelectsAll);
|
|
|
|
|
|
|
|
Panels.forEach(function(aPanel) {
|
|
|
|
aPanel.doCommand();
|
|
|
|
ok(edit.selectionStart == edit.selectionEnd, "urlbar text should not be selected on a simple show");
|
|
|
|
edit.click();
|
|
|
|
edit.click();
|
|
|
|
ok(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, "urlbar text should be selected on a double click");
|
|
|
|
});
|
|
|
|
|
2010-10-14 06:15:29 -07:00
|
|
|
edit.clickSelectsAll = oldClickSelectsAll;
|
|
|
|
|
2011-03-24 16:35:21 -07:00
|
|
|
// Ensure the tab is well closed before doing the rest of the code, otherwise
|
|
|
|
// this cause some bugs with the composition events
|
2011-06-02 17:41:00 -07:00
|
|
|
let tabCount = Browser.tabs.length;
|
|
|
|
Browser.closeTab(gCurrentTest.currentTab, { forceClose: true });
|
|
|
|
waitFor(runNextTest, function() Browser.tabs.length == tabCount - 1);
|
2010-10-14 06:15:29 -07:00
|
|
|
}
|
2010-12-27 09:18:11 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Case: Test context clicks on awesome panel
|
2010-11-03 06:49:51 -07:00
|
|
|
gTests.push({
|
|
|
|
desc: "Test context clicks on awesome panel",
|
|
|
|
|
|
|
|
_panelIndex : 0,
|
|
|
|
_contextOpts : [
|
|
|
|
["link-openable", "link-shareable"],
|
|
|
|
["link-openable", "link-shareable"],
|
|
|
|
["edit-bookmark", "link-shareable", "link-openable"],
|
|
|
|
],
|
|
|
|
|
|
|
|
clearContextTypes: function clearContextTypes() {
|
|
|
|
if (ContextHelper.popupState)
|
|
|
|
ContextHelper.hide();
|
|
|
|
},
|
|
|
|
|
|
|
|
checkContextTypes: function checkContextTypes(aTypes) {
|
|
|
|
let commandlist = document.getElementById("context-commands");
|
|
|
|
|
|
|
|
for (let i=0; i<commandlist.childNodes.length; i++) {
|
|
|
|
let command = commandlist.childNodes[i];
|
|
|
|
if (aTypes.indexOf(command.getAttribute("type")) > -1) {
|
|
|
|
// command should be visible
|
|
|
|
if(command.hidden == true)
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if(command.hidden == false)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
run: function() {
|
2010-12-07 07:24:41 -08:00
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
2010-11-03 06:49:51 -07:00
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
let self = this;
|
|
|
|
if(self._panelIndex < Panels.length) {
|
|
|
|
let panel = Panels[self._panelIndex];
|
|
|
|
panel.doCommand();
|
|
|
|
|
|
|
|
self.clearContextTypes();
|
|
|
|
|
|
|
|
EventUtils.synthesizeMouse(panel.panel, panel.panel.width / 2, panel.panel.height / 2, { type: "mousedown" });
|
|
|
|
setTimeout(function() {
|
|
|
|
EventUtils.synthesizeMouse(panel.panel, panel.panel.width / 2, panel.panel.height / 2, { type: "mouseup" });
|
|
|
|
ok(self.checkContextTypes(self._contextOpts[self._panelIndex]), "Correct context menu shown for panel");
|
|
|
|
self.clearContextTypes();
|
|
|
|
|
|
|
|
self._panelIndex++;
|
|
|
|
self.onPopupReady();
|
|
|
|
}, 500);
|
|
|
|
} else {
|
|
|
|
runNextTest();
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 06:15:29 -07:00
|
|
|
});
|
|
|
|
|
2010-11-03 06:49:51 -07:00
|
|
|
|
2011-01-28 13:28:11 -08:00
|
|
|
// Case: Test compositionevent
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test sending composition events",
|
|
|
|
_textValue: null,
|
|
|
|
get popup() {
|
|
|
|
delete this.popup;
|
|
|
|
return this.popup = document.getElementById("popup_autocomplete");
|
|
|
|
},
|
|
|
|
|
|
|
|
get popupHeader() {
|
|
|
|
delete this.popupHeader;
|
|
|
|
return this.popupHeader = document.getElementById("awesome-header");
|
|
|
|
},
|
|
|
|
|
|
|
|
get inputField() {
|
|
|
|
delete this.inputField;
|
|
|
|
return this.inputField = document.getElementById("urlbar-edit");
|
|
|
|
},
|
|
|
|
|
|
|
|
run: function() {
|
|
|
|
// Saving value to compare the result before and after the composition event
|
|
|
|
gCurrentTest._textValue = gCurrentTest.inputField.value;
|
|
|
|
|
|
|
|
window.addEventListener("popupshown", function() {
|
|
|
|
window.removeEventListener("popupshown", arguments.callee, false);
|
2011-06-02 17:41:00 -07:00
|
|
|
if (BrowserUI._isKeyboardFullscreen())
|
2011-03-15 07:30:56 -07:00
|
|
|
gCurrentTest.inputField.readOnly = false;
|
2011-01-28 13:28:11 -08:00
|
|
|
setTimeout(gCurrentTest.onPopupReady, 0);
|
|
|
|
}, false);
|
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
_checkState: function() {
|
|
|
|
ok(gCurrentTest.popup._popupOpen, "AutoComplete popup should be opened");
|
|
|
|
is(gCurrentTest.popupHeader.hidden, false, "AutoComplete popup header should be visible");
|
|
|
|
is(gCurrentTest.inputField.value, gCurrentTest._textValue, "Value should not have changed");
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
gCurrentTest._checkState();
|
|
|
|
|
|
|
|
window.addEventListener("compositionstart", function() {
|
|
|
|
window.removeEventListener("compositionstart", arguments.callee, false);
|
|
|
|
setTimeout(gCurrentTest.onCompositionStart, 0)
|
|
|
|
}, false);
|
2011-09-22 02:17:41 -07:00
|
|
|
Browser.windowUtils.sendCompositionEvent("compositionstart", "", "");
|
2011-01-28 13:28:11 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
onCompositionStart: function() {
|
|
|
|
gCurrentTest._checkState();
|
|
|
|
|
|
|
|
window.addEventListener("compositionend", function() {
|
|
|
|
window.removeEventListener("compositionend", arguments.callee, false);
|
|
|
|
setTimeout(gCurrentTest.onCompositionEnd, 0)
|
|
|
|
}, false);
|
2011-09-22 02:17:41 -07:00
|
|
|
Browser.windowUtils.sendCompositionEvent("compositionend", "", "");
|
2011-01-28 13:28:11 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
onCompositionEnd: function() {
|
2011-06-09 09:14:25 -07:00
|
|
|
/* TODO: This is currently failing (bug 642771)
|
2011-01-28 13:28:11 -08:00
|
|
|
gCurrentTest._checkState();
|
|
|
|
|
|
|
|
let isHiddenHeader = function() {
|
|
|
|
return gCurrentTest.popupHeader.hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wait to be sure there the header won't dissapear
|
|
|
|
// XXX this sucks because it means we'll be stuck 500ms if the test succeed
|
|
|
|
// but I don't have a better idea about how to do it for now since we don't
|
|
|
|
// that to happen!
|
2011-06-02 17:41:00 -07:00
|
|
|
|
2011-01-28 13:28:11 -08:00
|
|
|
waitForAndContinue(function() {
|
2011-03-24 16:35:21 -07:00
|
|
|
gCurrentTest._checkState();
|
2011-01-28 13:28:11 -08:00
|
|
|
runNextTest();
|
|
|
|
}, isHiddenHeader, Date.now() + 500);
|
2011-06-02 17:41:00 -07:00
|
|
|
*/
|
|
|
|
runNextTest();
|
2011-01-28 13:28:11 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-10-06 07:48:31 -07:00
|
|
|
// Case: Test context popup dismiss on top of awesome panel
|
|
|
|
gTests.push({
|
|
|
|
desc: "Case: Test context popup dismiss on top of awesome panel",
|
|
|
|
|
|
|
|
run: function() {
|
|
|
|
waitForNavigationPanel(gCurrentTest.onPopupReady);
|
|
|
|
AllPagesList.doCommand();
|
|
|
|
},
|
|
|
|
|
|
|
|
onPopupReady: function() {
|
|
|
|
EventUtils.synthesizeMouse(AllPagesList.panel, AllPagesList.panel.width / 2,
|
|
|
|
AllPagesList.panel.height / 2, { type: "mousedown" });
|
|
|
|
|
|
|
|
// Simulate a long tap
|
|
|
|
setTimeout(function(self) {
|
|
|
|
EventUtils.synthesizeMouse(AllPagesList.panel, AllPagesList.panel.width / 2,
|
|
|
|
AllPagesList.panel.height / 2, { type: "mouseup" });
|
|
|
|
|
|
|
|
let contextContainer = document.getElementById("context-container");
|
|
|
|
|
|
|
|
ok(!AllPagesList.panel.hidden, "The context popup is still visible after long tap");
|
|
|
|
ok(!contextContainer.hidden, "The context popup is visible after long tap");
|
|
|
|
|
|
|
|
EventUtils.synthesizeMouse(AllPagesList.panel, 0, 0, {});
|
|
|
|
|
|
|
|
ok(contextContainer.hidden, "The context popup is not visible after tap");
|
|
|
|
ok(!AllPagesList.panel.hidden, "The awesome panel is still visible after popup is dismissed");
|
|
|
|
|
|
|
|
AwesomeScreen.activePanel = null;
|
|
|
|
runNextTest();
|
|
|
|
}, 500, this);
|
|
|
|
}
|
|
|
|
});
|