mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
Bug 795544 - Test updates. r=bz
--HG-- rename : dom/encoding/test/test-big5.js => dom/encoding/test/unit/test_big5.js rename : dom/encoding/test/test-euc-jp.js => dom/encoding/test/unit/test_euc-jp.js rename : dom/encoding/test/test-euc-kr.js => dom/encoding/test/unit/test_euc-kr.js rename : dom/encoding/test/test-gbk.js => dom/encoding/test/unit/test_gbk.js rename : dom/encoding/test/test-hz-gb-2312.js => dom/encoding/test/unit/test_hz-gb-2312.js rename : dom/encoding/test/test-iso-2022-jp.js => dom/encoding/test/unit/test_iso-2022-jp.js rename : dom/encoding/test/test-iso-2022-kr.js => dom/encoding/test/unit/test_iso-2022-kr.js rename : dom/encoding/test/test-shift_jis.js => dom/encoding/test/unit/test_shift_jis.js rename : dom/encoding/test/tests.js => dom/encoding/test/unit/test_singlebytes.js
This commit is contained in:
parent
4cf6f1fa5f
commit
a31808914d
@ -10,22 +10,22 @@ relativesrcdir = @relativesrcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
TEST_DIRS = unit
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
test_BOMEncoding.js \
|
||||
test_TextDecoder.html \
|
||||
test_TextDecoder.js \
|
||||
test_TextEncoder.html \
|
||||
test_TextEncoder.js \
|
||||
test-big5.js \
|
||||
test-euc-jp.js \
|
||||
test-euc-kr.js \
|
||||
test-gbk.js \
|
||||
test-hz-gb-2312.js \
|
||||
test-iso-2022-jp.js \
|
||||
test-iso-2022-kr.js \
|
||||
test-shift_jis.js \
|
||||
test_stringencoding.html \
|
||||
tests.js \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
file_stringencoding.jsm \
|
||||
test_stringencoding.xul \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
6
dom/encoding/test/file_stringencoding.jsm
Normal file
6
dom/encoding/test/file_stringencoding.jsm
Normal file
@ -0,0 +1,6 @@
|
||||
var EXPORTED_SYMBOLS = ['checkFromJSM'];
|
||||
|
||||
function checkFromJSM(is_op) {
|
||||
is_op(new TextDecoder().encoding, "utf-8", "JSM should have TextDecoder");
|
||||
is_op(new TextEncoder().encoding, "utf-8", "JSM should have TextEncoder");
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
The following files are licensed under Apache License 2.0 <https://www.apache.org/licenses/LICENSE-2.0
|
||||
>:
|
||||
test-big5.js
|
||||
test-euc-jp.js
|
||||
test-euc-kr.js
|
||||
test-gbk.js
|
||||
test-hz-gb-2312.js
|
||||
test-iso-2022-jp.js
|
||||
test-iso-2022-kr.js
|
||||
test-shift_jis.js
|
||||
test_stringencoding.html
|
||||
tests.js
|
||||
unit/test_big5.js
|
||||
unit/test_euc-jp.js
|
||||
unit/test_euc-kr.js
|
||||
unit/test_gbk.js
|
||||
unit/test_hz-gb-2312.js
|
||||
unit/test_iso-2022-jp.js
|
||||
unit/test_iso-2022-kr.js
|
||||
unit/test_shift_jis.js
|
||||
unit/test_singlebytes.js
|
||||
|
@ -13,18 +13,18 @@ expect = function() {};
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="text/javascript" src="tests.js"></script>
|
||||
<script type="text/javascript" src="unit/test_singlebytes.js"></script>
|
||||
<!-- TODO: test for all single-byte encoding indexes -->
|
||||
|
||||
<script type="text/javascript" src="test-gbk.js"></script>
|
||||
<script type="text/javascript" src="unit/test_gbk.js"></script>
|
||||
<!-- TODO: gb18030 -->
|
||||
<script type="text/javascript" src="test-hz-gb-2312.js"></script>
|
||||
<script type="text/javascript" src="unit/test_hz-gb-2312.js"></script>
|
||||
|
||||
<script type="text/javascript" src="test-big5.js"></script>
|
||||
<script type="text/javascript" src="unit/test_big5.js"></script>
|
||||
|
||||
<script type="text/javascript" src="test-euc-jp.js"></script>
|
||||
<script type="text/javascript" src="test-iso-2022-jp.js"></script>
|
||||
<script type="text/javascript" src="test-shift_jis.js"></script>
|
||||
<script type="text/javascript" src="unit/test_euc-jp.js"></script>
|
||||
<script type="text/javascript" src="unit/test_iso-2022-jp.js"></script>
|
||||
<script type="text/javascript" src="unit/test_shift_jis.js"></script>
|
||||
|
||||
<script type="text/javascript" src="test-euc-kr.js"></script>
|
||||
<script type="text/javascript" src="test-iso-2022-kr.js"></script>
|
||||
<script type="text/javascript" src="unit/test_euc-kr.js"></script>
|
||||
<script type="text/javascript" src="unit/test_iso-2022-kr.js"></script>
|
||||
|
26
dom/encoding/test/test_stringencoding.xul
Normal file
26
dom/encoding/test/test_stringencoding.xul
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<window title="Test for StringEncoding API"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
/** Test for StringEncoding API. **/
|
||||
const Cu = Components.utils;
|
||||
|
||||
// Import our test JSM. We first strip the filename off
|
||||
// the chrome url, then append the jsm filename.
|
||||
var base = /.*\//.exec(window.location.href)[0];
|
||||
Cu.import(base + "file_stringencoding.jsm");
|
||||
|
||||
checkFromJSM(is);
|
||||
|
||||
]]></script>
|
||||
</window>
|
26
dom/encoding/test/unit/Makefile.in
Normal file
26
dom/encoding/test/unit/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = @relativesrcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
test_big5.js \
|
||||
test_euc-jp.js \
|
||||
test_euc-kr.js \
|
||||
test_gbk.js \
|
||||
test_hz-gb-2312.js \
|
||||
test_iso-2022-jp.js \
|
||||
test_iso-2022-kr.js \
|
||||
test_shift_jis.js \
|
||||
test_singlebytes.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
43
dom/encoding/test/unit/head.js
Normal file
43
dom/encoding/test/unit/head.js
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const { 'classes': Cc, 'interfaces': Ci } = Components;
|
||||
|
||||
function equal(a, b, msg) {
|
||||
dump("equal(" + a + ", " + b + ", \"" + msg + "\")");
|
||||
do_check_eq(a, b, Components.stack.caller);
|
||||
}
|
||||
|
||||
function ok(cond, msg) {
|
||||
dump("ok(" + cond + ", \"" + msg + "\")");
|
||||
do_check_true(!!cond, Components.stack.caller);
|
||||
}
|
||||
|
||||
function raises(func) {
|
||||
dump("raises(" + func + ")");
|
||||
try {
|
||||
func();
|
||||
do_check_true(false, Components.stack.caller);
|
||||
} catch (e) {
|
||||
do_check_true(true, Components.stack.caller);
|
||||
}
|
||||
}
|
||||
|
||||
var tests = [];
|
||||
|
||||
function test(msg, no, func) {
|
||||
tests.push({msg: msg, func: func || no});
|
||||
}
|
||||
|
||||
function expect(count) {
|
||||
dump("expect(", count, ")");
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
tests.forEach(function(t) {
|
||||
dump("test(\"" + t.msg + "\")");
|
||||
t.func();
|
||||
});
|
||||
};
|
13
dom/encoding/test/unit/xpcshell.ini
Normal file
13
dom/encoding/test/unit/xpcshell.ini
Normal file
@ -0,0 +1,13 @@
|
||||
[DEFAULT]
|
||||
head = head.js
|
||||
tail =
|
||||
|
||||
[test_big5.js]
|
||||
[test_euc-jp.js]
|
||||
[test_euc-kr.js]
|
||||
[test_gbk.js]
|
||||
[test_hz-gb-2312.js]
|
||||
[test_iso-2022-jp.js]
|
||||
[test_iso-2022-kr.js]
|
||||
[test_shift_jis.js]
|
||||
[test_singlebytes.js]
|
@ -9,6 +9,7 @@
|
||||
[include:uriloader/exthandler/tests/unit/xpcshell.ini]
|
||||
[include:parser/xml/test/unit/xpcshell.ini]
|
||||
[include:image/test/unit/xpcshell.ini]
|
||||
[include:dom/encoding/test/unit/xpcshell.ini]
|
||||
[include:dom/plugins/test/unit/xpcshell.ini]
|
||||
[include:dom/sms/tests/xpcshell.ini]
|
||||
[include:dom/mms/tests/xpcshell.ini]
|
||||
|
Loading…
x
Reference in New Issue
Block a user