summaryrefslogtreecommitdiffstats
path: root/dom/inputmethod/mochitest/inputmethod_common.js
blob: ad8103c9f2da31cfb185918587f9d1c3b464ffc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function inputmethod_setup(callback) {
  SimpleTest.waitForExplicitFinish();
  SimpleTest.requestCompleteLog();
  let appInfo = SpecialPowers.Cc['@mozilla.org/xre/app-info;1']
                .getService(SpecialPowers.Ci.nsIXULAppInfo);
  if (appInfo.name != 'B2G') {
    SpecialPowers.Cu.import("resource://gre/modules/Keyboard.jsm", this);
  }

  let prefs = [
    ['dom.mozBrowserFramesEnabled', true],
    ['network.disable.ipc.security', true],
    // Enable navigator.mozInputMethod.
    ['dom.mozInputMethod.enabled', true]
  ];
  SpecialPowers.pushPrefEnv({set: prefs}, function() {
    SimpleTest.waitForFocus(callback);
  });
}

function inputmethod_cleanup() {
  SpecialPowers.wrap(navigator.mozInputMethod).setActive(false);
  SimpleTest.finish();
}