diff options
Diffstat (limited to 'toolkit/components/ctypes/tests/chrome/test_ctypes.xul')
-rw-r--r-- | toolkit/components/ctypes/tests/chrome/test_ctypes.xul | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/toolkit/components/ctypes/tests/chrome/test_ctypes.xul b/toolkit/components/ctypes/tests/chrome/test_ctypes.xul deleted file mode 100644 index bbe7fb0c9..000000000 --- a/toolkit/components/ctypes/tests/chrome/test_ctypes.xul +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<!-- 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/. --> - -<window title="DOM Worker Threads Test" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="test();"> - - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> - <script type="application/javascript" - src="chrome://mochikit/content/chrome-harness.js"/> - - <script type="application/javascript"> - <![CDATA[ - Components.utils.import("resource://gre/modules/ctypes.jsm"); - - CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test"); - CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt"); - - /* - * input: string of the url where we are running from - * return: nsILocalFile - */ - function getCurrentDir(path) { - var rootDir = getRootDirectory(window.location.href); - var jar = getJar(rootDir); - - if (jar) { - return extractJarToTmp(jar); - } else { - return getLocalDir(path); - } - } - - function getLocalDir(path) { - let dir = Components.classes["@mozilla.org/file/directory_service;1"] - .getService(Components.interfaces.nsIProperties) - .get("CurWorkD", Components.interfaces.nsILocalFile); - path = location.pathname; - path = path.slice("content/".length, - -1 * "/test_ctypes.xul".length); - let components = path.split("/"); - for (let part in components) { - dir.append(components[part]); - } - return dir; - } - - function setupLibs(path) { - let libFile = path.clone(); - libFile.append(CTYPES_TEST_LIB); - ok(libFile.exists(), "ctypes test library doesn't exist!?"); - - libFile.copyTo(null, CTYPES_UNICODE_LIB); - } - - function cleanupLibs(path) { - let unicodeFile = path.clone(); - unicodeFile.append(CTYPES_UNICODE_LIB); - ok(unicodeFile.exists(), "ctypes unicode test library doesn't exist!?"); - unicodeFile.remove(false); - } - - function test() - { - SimpleTest.waitForExplicitFinish(); - - var dir = getCurrentDir(location.path); - ok(dir.exists() && dir.isDirectory(), "Chrome test dir doesn't exist?!"); - setupLibs(dir); - - var worker = new ChromeWorker("ctypes_worker.js"); - worker.onmessage = function(event) { - is(event.data, "Done!", "Wrong message!"); - cleanupLibs(dir); - SimpleTest.finish(); - } - worker.onerror = function(event) { - if (event.message == "uncaught exception: 7.5 million years for that?" || - event.message == "uncaught exception: Just following orders, sir!") { - // We throw those on purpose in the worker, so ignore them. - return true; - } - ok(false, "Worker had an error: " + event.message); - worker.terminate(); - cleanupLibs(dir); - SimpleTest.finish(); - } - - worker.postMessage({dir: dir.path, os: Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS}); - } - - ]]> - </script> - - <body xmlns="http://www.w3.org/1999/xhtml"> - <p id="display"></p> - <div id="content" style="display:none;"></div> - <pre id="test"></pre> - </body> - <label id="test-result"/> -</window> |