From 8d3963af12dc02a33ac3f001093fc9e02a2d3bab Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Fri, 1 Aug 2014 13:57:00 -0400 Subject: [PATCH] Bug 1025183 P5 Add tests for ScalarValueString. r=bz --- dom/bindings/test/TestBindingHeader.h | 12 ++++++ dom/bindings/test/TestCodeGen.webidl | 12 ++++++ dom/bindings/test/TestExampleGen.webidl | 12 ++++++ dom/bindings/test/TestInterfaceJS.js | 4 +- dom/bindings/test/TestJSImplGen.webidl | 12 ++++++ dom/bindings/test/mochitest.ini | 2 + dom/bindings/test/test_scalarvaluestring.html | 41 +++++++++++++++++++ dom/webidl/TestInterfaceJS.webidl | 2 + 8 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 dom/bindings/test/test_scalarvaluestring.html diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 957da34b093..bebaa6be8b6 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -466,6 +466,7 @@ public: void PassOptionalNullableString(const Optional&); void PassOptionalNullableStringWithDefaultValue(const nsAString&); void PassVariadicString(const Sequence&); + void ReceiveString(DOMString&); // ByteString types void PassByteString(const nsCString&); @@ -474,6 +475,16 @@ public: void PassOptionalNullableByteString(const Optional&); void PassVariadicByteString(const Sequence&); + // ScalarValueString types + void PassSVS(const nsAString&); + void PassNullableSVS(const nsAString&); + void PassOptionalSVS(const Optional&); + void PassOptionalSVSWithDefaultValue(const nsAString&); + void PassOptionalNullableSVS(const Optional&); + void PassOptionalNullableSVSWithDefaultValue(const nsAString&); + void PassVariadicSVS(const Sequence&); + void ReceiveSVS(DOMString&); + // Enumerated types void PassEnum(TestEnum); void PassNullableEnum(const Nullable&); @@ -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&); void PassOptionalUnion(JSContext*, const Optional&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 0297dfb6d21..71f365cc1f6 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -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 or DOMString) arg); void passUnionWithMozMapAndSequence((MozMap or sequence) arg); void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithSVS((ScalarValueString or long) arg); #endif void passUnionWithNullable((object? or long) arg); void passNullableUnion((object or long)? arg); diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 8001d31ab74..f9da13d3588 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -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 or long) arg); void passUnion22((MozMap or long) arg); void passUnionWithCallback((EventHandler or long) arg); + void passUnionWithByteString((ByteString or long) arg); void passUnionWithMozMap((MozMap or DOMString) arg); void passUnionWithMozMapAndSequence((MozMap or sequence) arg); void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithSVS((ScalarValueString or long) arg); #endif void passUnionWithNullable((object? or long) arg); void passNullableUnion((object or long)? arg); diff --git a/dom/bindings/test/TestInterfaceJS.js b/dom/bindings/test/TestInterfaceJS.js index 86c899e24f9..ea12e4a2741 100644 --- a/dom/bindings/test/TestInterfaceJS.js +++ b/dom/bindings/test/TestInterfaceJS.js @@ -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]) diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 97ed0e342b4..f10681a4324 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -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 or long) arg); void passUnion22((MozMap or long) arg); void passUnionWithCallback((EventHandler or long) arg); + void passUnionWithByteString((ByteString or long) arg); void passUnionWithMozMap((MozMap or DOMString) arg); void passUnionWithMozMapAndSequence((MozMap or sequence) arg); void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithSVS((ScalarValueString or long) arg); #endif void passUnionWithNullable((object? or long) arg); void passNullableUnion((object or long)? arg); diff --git a/dom/bindings/test/mochitest.ini b/dom/bindings/test/mochitest.ini index 420035bc139..b406f62c877 100644 --- a/dom/bindings/test/mochitest.ini +++ b/dom/bindings/test/mochitest.ini @@ -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] diff --git a/dom/bindings/test/test_scalarvaluestring.html b/dom/bindings/test/test_scalarvaluestring.html new file mode 100644 index 00000000000..c4afd4fc8d2 --- /dev/null +++ b/dom/bindings/test/test_scalarvaluestring.html @@ -0,0 +1,41 @@ + + + + + Test ScalarValueString + + + + + + + diff --git a/dom/webidl/TestInterfaceJS.webidl b/dom/webidl/TestInterfaceJS.webidl index e9e5e2cb9e5..a791384fea5 100644 --- a/dom/webidl/TestInterfaceJS.webidl +++ b/dom/webidl/TestInterfaceJS.webidl @@ -17,4 +17,6 @@ interface TestInterfaceJS { // For testing bug 968335. DOMString getCallerPrincipal(); + + DOMString convertSVS(ScalarValueString svs); };