1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/inputmethod/mochitest/test_bug953044.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=953044 1.8 +--> 1.9 +<head> 1.10 + <title>Basic test for InputMethod API.</title> 1.11 + <script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="application/javascript;version=1.7" src="inputmethod_common.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=953044">Mozilla Bug 953044</a> 1.17 +<p id="display"></p> 1.18 +<pre id="test"> 1.19 +<script class="testbody" type="application/javascript;version=1.7"> 1.20 + 1.21 +inputmethod_setup(function() { 1.22 + runTest(); 1.23 +}); 1.24 + 1.25 +function runTest() { 1.26 + // Create an app frame to recieve keyboard inputs. 1.27 + let app = document.createElement('iframe'); 1.28 + app.src = 'file_test_app.html'; 1.29 + app.setAttribute('mozbrowser', true); 1.30 + document.body.appendChild(app); 1.31 + 1.32 + // Create a browser frame to load the input method app. 1.33 + let keyboard = document.createElement('iframe'); 1.34 + keyboard.setAttribute('mozbrowser', true); 1.35 + document.body.appendChild(keyboard); 1.36 + 1.37 + // Bug 953044 setInputMethodActive(false) before input method app loads should 1.38 + // always succeed. 1.39 + let req = keyboard.setInputMethodActive(false); 1.40 + req.onsuccess = function() { 1.41 + ok(true, 'setInputMethodActive before loading succeeded.'); 1.42 + inputmethod_cleanup(); 1.43 + }; 1.44 + 1.45 + req.onerror = function() { 1.46 + ok(false, 'setInputMethodActive before loading failed: ' + this.error.name); 1.47 + inputmethod_cleanup(); 1.48 + }; 1.49 +} 1.50 + 1.51 +</script> 1.52 +</pre> 1.53 +</body> 1.54 +</html> 1.55 +