Backed out changesets ab5feb665350 and d29a46b5d058 (bug 932145) for B2G mochitest-4 orange.

This commit is contained in:
Ryan VanderMeulen 2013-12-17 13:04:13 -05:00
parent 4545c60428
commit 5504c8968f
9 changed files with 7 additions and 200 deletions

View File

@ -180,9 +180,11 @@ this.Keyboard = {
handleFocusChange: function keyboardHandleFocusChange(msg) {
this.forwardEvent('Keyboard:FocusChange', msg);
let browser = Services.wm.getMostRecentWindow("navigator:browser");
// Chrome event, used also to render value selectors; that's why we need
// the info about choices / min / max here as well...
this.sendChromeEvent({
browser.shell.sendChromeEvent({
type: 'inputmethod-contextchange',
inputType: msg.data.type,
value: msg.data.value,
@ -217,13 +219,15 @@ this.Keyboard = {
},
showInputMethodPicker: function keyboardShowInputMethodPicker() {
this.sendChromeEvent({
let browser = Services.wm.getMostRecentWindow("navigator:browser");
browser.shell.sendChromeEvent({
type: "inputmethod-showall"
});
},
switchToNextInputMethod: function keyboardSwitchToNextInputMethod() {
this.sendChromeEvent({
let browser = Services.wm.getMostRecentWindow("navigator:browser");
browser.shell.sendChromeEvent({
type: "inputmethod-next"
});
},
@ -263,13 +267,6 @@ this.Keyboard = {
this._layouts = layouts;
ppmm.broadcastAsyncMessage('Keyboard:LayoutsChange', layouts);
},
sendChromeEvent: function(event) {
let browser = Services.wm.getMostRecentWindow("navigator:browser");
if (browser && browser.shell) {
browser.shell.sendChromeEvent(event);;
}
}
};

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<html>
<body>
<input id="test-input" type="text" value="Yuan" x-inputmode="verbatim" lang="zh"/>
<script type="application/javascript;version=1.7">
let input = document.getElementById('test-input');
input.focus();
</script>
</body>
</html>

View File

@ -1,28 +0,0 @@
function inputmethod_setup(callback) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.Cu.import("resource://gre/modules/Keyboard.jsm", this);
let permissions = [];
['input-manage', 'browser'].forEach(function(name) {
permissions.push({
type: name,
allow: true,
context: document
});
});
SpecialPowers.pushPermissions(permissions, function() {
let prefs = [
['dom.mozBrowserFramesEnabled', true],
// Enable navigator.mozInputMethod.
['dom.mozInputMethod.enabled', true],
// Bypass the permission check for mozInputMethod API.
['dom.mozInputMethod.testing', true]
];
SpecialPowers.pushPrefEnv({set: prefs}, callback);
});
}
function inputmethod_cleanup() {
SimpleTest.finish();
}

View File

@ -1,6 +0,0 @@
[DEFAULT]
support-files =
inputmethod_common.js
file_test_app.html
[test_basic.html]

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_MANIFESTS += ['mochitest.ini']

View File

@ -1,134 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=932145
-->
<head>
<title>Basic test for InputMethod API.</title>
<script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript;version=1.7" src="inputmethod_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=932145">Mozilla Bug 932145</a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="application/javascript;version=1.7">
// The input context.
var gContext = null;
inputmethod_setup(function() {
runTest();
});
function runTest() {
let im = navigator.mozInputMethod;
im.oninputcontextchange = function() {
ok(true, 'inputcontextchange event was fired.');
im.oninputcontextchange = null;
gContext = im.inputcontext;
if (!gContext) {
ok(false, 'Should have a non-null inputcontext.');
inputmethod_cleanup();
return;
}
todo_is(gContext.type, 'input', 'The input context type should match.');
is(gContext.inputType, 'text', 'The inputType should match.');
is(gContext.inputMode, 'verbatim', 'The input mode should match.');
is(gContext.lang, 'zh', 'The language should match.');
is(gContext.textBeforeCursor + gContext.textAfterCursor, 'Yuan',
'Should get the text around the cursor.');
test_setSelectionRange();
};
// Set current page as an input method.
SpecialPowers.wrap(im).setActive(true);
let iframe = document.createElement('iframe');
iframe.src = 'file_test_app.html';
iframe.setAttribute('mozbrowser', true);
document.body.appendChild(iframe);
}
function test_setSelectionRange() {
// Move cursor position to 2.
gContext.setSelectionRange(2, 0).then(function() {
is(gContext.selectionStart, 2, 'selectionStart was set successfully.');
is(gContext.selectionEnd, 2, 'selectionEnd was set successfully.');
test_sendKey();
}, function(e) {
ok(false, 'setSelectionRange failed:' + e.name);
inputmethod_cleanup();
});
}
function test_sendKey() {
// Add '-' to current cursor posistion and move the cursor position to 3.
gContext.sendKey(0, '-'.charCodeAt(0), 0).then(function() {
is(gContext.textBeforeCursor + gContext.textAfterCursor, 'Yu-an',
'sendKey should changed the input field correctly.');
test_deleteSurroundingText();
}, function(e) {
ok(false, 'sendKey failed:' + e.name);
inputmethod_cleanup();
});
}
function test_deleteSurroundingText() {
// Remove one character before current cursor position and move the cursor
// position back to 2.
gContext.deleteSurroundingText(1, 0).then(function() {
ok(true, 'deleteSurroundingText finished');
is(gContext.textBeforeCursor + gContext.textAfterCursor, 'Yuan',
'deleteSurroundingText should changed the input field correctly.');
test_replaceSurroundingText();
}, function(e) {
ok(false, 'deleteSurroundingText failed:' + e.name);
inputmethod_cleanup();
});
}
function test_replaceSurroundingText() {
// Replace 'Yuan' with 'Xulei'.
gContext.replaceSurroundingText('Xulei', 2, 2).then(function() {
ok(true, 'replaceSurroundingText finished');
is(gContext.textBeforeCursor + gContext.textAfterCursor, 'Xulei',
'replaceSurroundingText changed the input field correctly.');
test_setComposition();
}, function(e) {
ok(false, 'replaceSurroundingText failed: ' + e.name);
inputmethod_cleanup();
});
}
function test_setComposition() {
gContext.setComposition('XXX').then(function() {
ok(true, 'setComposition finished');
test_endComposition();
}, function(e) {
ok(false, 'setComposition failed: ' + e.name);
inputmethod_cleanup();
});
}
function test_endComposition() {
gContext.endComposition('2013').then(function() {
is(gContext.textBeforeCursor + gContext.textAfterCursor, 'Xulei2013',
'endComposition changed the input field correctly.');
inputmethod_cleanup();
}, function (e) {
ok(false, 'endComposition failed: ' + e.name);
inputmethod_cleanup();
});
}
</script>
</pre>
</body>
</html>

View File

@ -4,8 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['mochitest']
XPIDL_SOURCES += [
'nsIB2GKeyboard.idl',
]

View File

@ -138,7 +138,6 @@
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_inproc.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_oop.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_oop_inproc.html": "No test app installed",
"dom/inputmethod": "not supported on Android",
"dom/network/tests/test_network_basics.html": "",
"dom/permission/tests/test_permission_basics.html": "",
"dom/mobilemessage/tests/test_sms_basics.html": "Bug 909036",

View File

@ -215,7 +215,6 @@
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_inproc.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_oop.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_oop_inproc.html": "No test app installed",
"dom/inputmethod": "not supported on Android",
"dom/media/tests/ipc/test_ipc.html": "x86 only bug 936226",
"dom/network/tests/test_network_basics.html": "",
"dom/permission/tests/test_permission_basics.html": "",