mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1025183
P5 Add tests for ScalarValueString. r=bz
This commit is contained in:
parent
d24aeaacd8
commit
8d3963af12
@ -466,6 +466,7 @@ public:
|
||||
void PassOptionalNullableString(const Optional<nsAString>&);
|
||||
void PassOptionalNullableStringWithDefaultValue(const nsAString&);
|
||||
void PassVariadicString(const Sequence<nsString>&);
|
||||
void ReceiveString(DOMString&);
|
||||
|
||||
// ByteString types
|
||||
void PassByteString(const nsCString&);
|
||||
@ -474,6 +475,16 @@ public:
|
||||
void PassOptionalNullableByteString(const Optional<nsCString>&);
|
||||
void PassVariadicByteString(const Sequence<nsCString>&);
|
||||
|
||||
// ScalarValueString types
|
||||
void PassSVS(const nsAString&);
|
||||
void PassNullableSVS(const nsAString&);
|
||||
void PassOptionalSVS(const Optional<nsAString>&);
|
||||
void PassOptionalSVSWithDefaultValue(const nsAString&);
|
||||
void PassOptionalNullableSVS(const Optional<nsAString>&);
|
||||
void PassOptionalNullableSVSWithDefaultValue(const nsAString&);
|
||||
void PassVariadicSVS(const Sequence<nsString>&);
|
||||
void ReceiveSVS(DOMString&);
|
||||
|
||||
// Enumerated types
|
||||
void PassEnum(TestEnum);
|
||||
void PassNullableEnum(const Nullable<TestEnum>&);
|
||||
@ -591,6 +602,7 @@ public:
|
||||
void PassUnionWithMozMap(const StringMozMapOrString&);
|
||||
void PassUnionWithMozMapAndSequence(const StringMozMapOrStringSequence&);
|
||||
void PassUnionWithSequenceAndMozMap(const StringSequenceOrStringMozMap&);
|
||||
void PassUnionWithSVS(const ScalarValueStringOrLong&);
|
||||
#endif
|
||||
void PassNullableUnion(JSContext*, const Nullable<ObjectOrLong>&);
|
||||
void PassOptionalUnion(JSContext*, const Optional<ObjectOrLong>&);
|
||||
|
@ -423,6 +423,7 @@ interface TestInterface {
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
DOMString receiveString();
|
||||
|
||||
// ByteString types
|
||||
void passByteString(ByteString arg);
|
||||
@ -431,6 +432,16 @@ interface TestInterface {
|
||||
void passOptionalNullableByteString(optional ByteString? arg);
|
||||
void passVariadicByteString(ByteString... arg);
|
||||
|
||||
// ScalarValueString types
|
||||
void passSVS(ScalarValueString arg);
|
||||
void passNullableSVS(ScalarValueString? arg);
|
||||
void passOptionalSVS(optional ScalarValueString arg);
|
||||
void passOptionalSVSWithDefaultValue(optional ScalarValueString arg = "abc");
|
||||
void passOptionalNullableSVS(optional ScalarValueString? arg);
|
||||
void passOptionalNullableSVSWithDefaultValue(optional ScalarValueString? arg = null);
|
||||
void passVariadicSVS(ScalarValueString... arg);
|
||||
ScalarValueString receiveSVS();
|
||||
|
||||
// Enumerated types
|
||||
void passEnum(TestEnum arg);
|
||||
void passNullableEnum(TestEnum? arg);
|
||||
@ -533,6 +544,7 @@ interface TestInterface {
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
void passUnionWithMozMapAndSequence((MozMap<DOMString> or sequence<DOMString>) arg);
|
||||
void passUnionWithSequenceAndMozMap((sequence<DOMString> or MozMap<DOMString>) arg);
|
||||
void passUnionWithSVS((ScalarValueString or long) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
void passNullableUnion((object or long)? arg);
|
||||
|
@ -325,6 +325,16 @@ interface TestExampleInterface {
|
||||
void passVariadicByteString(ByteString... arg);
|
||||
void passUnionByteString((ByteString or long) arg);
|
||||
|
||||
// ScalarValueString types
|
||||
void passSVS(ScalarValueString arg);
|
||||
void passNullableSVS(ScalarValueString? arg);
|
||||
void passOptionalSVS(optional ScalarValueString arg);
|
||||
void passOptionalSVSWithDefaultValue(optional ScalarValueString arg = "abc");
|
||||
void passOptionalNullableSVS(optional ScalarValueString? arg);
|
||||
void passOptionalNullableSVSWithDefaultValue(optional ScalarValueString? arg = null);
|
||||
void passVariadicSVS(ScalarValueString... arg);
|
||||
ScalarValueString receiveSVS();
|
||||
|
||||
// Enumerated types
|
||||
void passEnum(TestEnum arg);
|
||||
void passNullableEnum(TestEnum? arg);
|
||||
@ -421,9 +431,11 @@ interface TestExampleInterface {
|
||||
void passUnion21((MozMap<long> or long) arg);
|
||||
void passUnion22((MozMap<object> or long) arg);
|
||||
void passUnionWithCallback((EventHandler or long) arg);
|
||||
void passUnionWithByteString((ByteString or long) arg);
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
void passUnionWithMozMapAndSequence((MozMap<DOMString> or sequence<DOMString>) arg);
|
||||
void passUnionWithSequenceAndMozMap((sequence<DOMString> or MozMap<DOMString>) arg);
|
||||
void passUnionWithSVS((ScalarValueString or long) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
void passNullableUnion((object or long)? arg);
|
||||
|
@ -45,7 +45,9 @@ TestInterfaceJS.prototype = {
|
||||
pingPongAny: function(any) { checkGlobal(any); return any; },
|
||||
pingPongObject: function(obj) { checkGlobal(obj); return obj; },
|
||||
|
||||
getCallerPrincipal: function() { return Cu.getWebIDLCallerPrincipal().origin; }
|
||||
getCallerPrincipal: function() { return Cu.getWebIDLCallerPrincipal().origin; },
|
||||
|
||||
convertSVS: function(svs) { return svs; }
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestInterfaceJS])
|
||||
|
@ -348,6 +348,16 @@ interface TestJSImplInterface {
|
||||
void passVariadicByteString(ByteString... arg);
|
||||
void PassUnionByteString((ByteString or long) arg);
|
||||
|
||||
// ScalarValueString types
|
||||
void passSVS(ScalarValueString arg);
|
||||
void passNullableSVS(ScalarValueString? arg);
|
||||
void passOptionalSVS(optional ScalarValueString arg);
|
||||
void passOptionalSVSWithDefaultValue(optional ScalarValueString arg = "abc");
|
||||
void passOptionalNullableSVS(optional ScalarValueString? arg);
|
||||
void passOptionalNullableSVSWithDefaultValue(optional ScalarValueString? arg = null);
|
||||
void passVariadicSVS(ScalarValueString... arg);
|
||||
ScalarValueString receiveSVS();
|
||||
|
||||
// Enumerated types
|
||||
void passEnum(MyTestEnum arg);
|
||||
void passNullableEnum(MyTestEnum? arg);
|
||||
@ -445,9 +455,11 @@ interface TestJSImplInterface {
|
||||
void passUnion21((MozMap<long> or long) arg);
|
||||
void passUnion22((MozMap<object> or long) arg);
|
||||
void passUnionWithCallback((EventHandler or long) arg);
|
||||
void passUnionWithByteString((ByteString or long) arg);
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
void passUnionWithMozMapAndSequence((MozMap<DOMString> or sequence<DOMString>) arg);
|
||||
void passUnionWithSequenceAndMozMap((sequence<DOMString> or MozMap<DOMString>) arg);
|
||||
void passUnionWithSVS((ScalarValueString or long) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
void passNullableUnion((object or long)? arg);
|
||||
|
@ -40,6 +40,8 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only failure; bug 926547
|
||||
[test_named_getter_enumerability.html]
|
||||
[test_Object.prototype_props.html]
|
||||
[test_queryInterface.html]
|
||||
[test_scalarvaluestring.html]
|
||||
skip-if = debug == false
|
||||
[test_sequence_wrapping.html]
|
||||
[test_throwing_method_noDCE.html]
|
||||
[test_treat_non_object_as_null.html]
|
||||
|
41
dom/bindings/test/test_scalarvaluestring.html
Normal file
41
dom/bindings/test/test_scalarvaluestring.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test ScalarValueString</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
|
||||
var testInterfaceJS = new TestInterfaceJS();
|
||||
ok(testInterfaceJS, "got a TestInterfaceJS object");
|
||||
// For expected values, see algorithm definition here:
|
||||
// http://heycam.github.io/webidl/#dfn-obtain-unicode
|
||||
var testList = [
|
||||
{ string: "foo",
|
||||
expected: "foo" },
|
||||
{ string: "This is U+2070E: \ud841\udf0e",
|
||||
expected: "This is U+2070E: \ud841\udf0e" },
|
||||
{ string: "Missing low surrogate: \ud841",
|
||||
expected: "Missing low surrogate: \ufffd" },
|
||||
{ string: "Missing low surrogate with trailer: \ud841!!",
|
||||
expected: "Missing low surrogate with trailer: \ufffd!!" },
|
||||
{ string: "Missing high surrogate: \udf0e",
|
||||
expected: "Missing high surrogate: \ufffd" },
|
||||
{ string: "Missing high surrogate with trailer: \udf0e!!",
|
||||
expected: "Missing high surrogate with trailer: \ufffd!!" },
|
||||
{ string: "U+2070E after malformed: \udf0e\ud841\udf0e",
|
||||
expected: "U+2070E after malformed: \ufffd\ud841\udf0e" }
|
||||
];
|
||||
testList.forEach(function(test) {
|
||||
is(testInterfaceJS.convertSVS(test.string), test.expected, "Convert '" + test.string + "'");
|
||||
});
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -17,4 +17,6 @@ interface TestInterfaceJS {
|
||||
|
||||
// For testing bug 968335.
|
||||
DOMString getCallerPrincipal();
|
||||
|
||||
DOMString convertSVS(ScalarValueString svs);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user