Bug 1441752 - mochitest for PaymentAddress.regionCode. r=baku
authorEden Chuang <echuang@mozilla.com>
Thu, 04 Oct 2018 11:35:03 +0200
changeset 495647 db490391893fe385398cae8e82de0cae55e916b6
parent 495646 c29045d2314381fe6fd9e95c4635e5e0e02595ee
child 495648 9e198f95db78f6a9dcff58b04968531dea091ae4
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1441752
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441752 - mochitest for PaymentAddress.regionCode. r=baku
dom/payments/test/BasicCardErrorsChromeScript.js
dom/payments/test/BasiccardChromeScript.js
dom/payments/test/Bug1490698ChromeScript.js
dom/payments/test/RequestShippingChromeScript.js
dom/payments/test/RetryPaymentChromeScript.js
dom/payments/test/ShowPaymentChromeScript.js
dom/payments/test/UpdateErrorsChromeScript.js
dom/payments/test/test_basiccard.html
testing/web-platform/meta/payment-request/idlharness.https.window.js.ini
testing/web-platform/meta/payment-request/interfaces.https.html.ini
--- a/dom/payments/test/BasicCardErrorsChromeScript.js
+++ b/dom/payments/test/BasicCardErrorsChromeScript.js
@@ -29,16 +29,17 @@ function makeBillingAddress() {
     Ci.nsISupportsString
   );
   address.data = "Easton Ave";
   addressLine.appendElement(address);
   const addressArgs = [
     "USA", // country
     addressLine, // address line
     "CA", // region
+    "CA", // regionCode
     "San Bruno", // city
     "", // dependent locality
     "94066", // postal code
     "123456", // sorting code
     "", // organization
     "Bill A. Pacheco", // recipient
     "+14344413879", // phone
   ];
--- a/dom/payments/test/BasiccardChromeScript.js
+++ b/dom/payments/test/BasiccardChromeScript.js
@@ -12,19 +12,20 @@ function emitTestFail(message) {
 }
 
 const billingAddress = Cc["@mozilla.org/dom/payments/payment-address;1"].
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
-billingAddress.init("USA",              // country
+billingAddress.init("USA",               // country
                      addressLine,        // address line
                      "CA",               // region
+                     "CA",               // region code
                      "San Bruno",        // city
                      "",                 // dependent locality
                      "94066",            // postal code
                      "123456",           // sorting code
                      "",                 // organization
                      "Bill A. Pacheco",  // recipient
                      "+14344413879"); // phone
 
--- a/dom/payments/test/Bug1490698ChromeScript.js
+++ b/dom/payments/test/Bug1490698ChromeScript.js
@@ -15,26 +15,27 @@ function emitTestPass(message) {
 }
 
 const billingAddress = Cc["@mozilla.org/dom/payments/payment-address;1"].
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
-billingAddress.init("USA",              // country
+billingAddress.init("USA",               // country
                      addressLine,        // address line
                      "CA",               // region
+                     "CA",               // region code
                      "San Bruno",        // city
                      "",                 // dependent locality
                      "94066",            // postal code
                      "123456",           // sorting code
                      "",                 // organization
                      "Bill A. Pacheco",  // recipient
-                     "+14344413879"); // phone
+                     "+14344413879");    // phone
 
 function acceptPayment(requestId) {
   const basiccardResponseData = Cc["@mozilla.org/dom/payments/basiccard-response-data;1"].
                                    createInstance(Ci.nsIBasicCardResponseData);
   const showResponse = Cc["@mozilla.org/dom/payments/payment-show-action-response;1"].
                           createInstance(Ci.nsIPaymentShowActionResponse);
   basiccardResponseData.initData("Bill A. Pacheco",  // cardholderName
                                  "4916855166538720", // cardNumber
--- a/dom/payments/test/RequestShippingChromeScript.js
+++ b/dom/payments/test/RequestShippingChromeScript.js
@@ -15,16 +15,17 @@ const shippingAddress = Cc["@mozilla.org
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
 shippingAddress.init("",  // country
                      addressLine, // address line
                      "",  // region
+                     "",  // region code
                      "",  // city
                      "",  // dependent locality
                      "",  // postal code
                      "",  // sorting code
                      "",  // organization
                      "",  // recipient
                      ""); // phone
 
--- a/dom/payments/test/RetryPaymentChromeScript.js
+++ b/dom/payments/test/RetryPaymentChromeScript.js
@@ -15,26 +15,27 @@ function emitTestPass(message) {
 }
 
 const billingAddress = Cc["@mozilla.org/dom/payments/payment-address;1"].
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
-billingAddress.init("USA",              // country
+billingAddress.init("USA",               // country
                      addressLine,        // address line
                      "CA",               // region
+                     "CA",               // region code
                      "San Bruno",        // city
                      "",                 // dependent locality
                      "94066",            // postal code
                      "123456",           // sorting code
                      "",                 // organization
                      "Bill A. Pacheco",  // recipient
-                     "+14344413879"); // phone
+                     "+14344413879");    // phone
 
 function acceptPayment(requestId, mode) {
   const basiccardResponseData = Cc["@mozilla.org/dom/payments/basiccard-response-data;1"].
                                    createInstance(Ci.nsIBasicCardResponseData);
   const showResponse = Cc["@mozilla.org/dom/payments/payment-show-action-response;1"].
                           createInstance(Ci.nsIPaymentShowActionResponse);
   basiccardResponseData.initData("Bill A. Pacheco",  // cardholderName
                                  "4916855166538720", // cardNumber
--- a/dom/payments/test/ShowPaymentChromeScript.js
+++ b/dom/payments/test/ShowPaymentChromeScript.js
@@ -21,16 +21,17 @@ const shippingAddress = Cc["@mozilla.org
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
 shippingAddress.init("USA",              // country
                      addressLine,        // address line
                      "CA",               // region
+                     "CA",               // region code
                      "San Bruno",        // city
                      "Test locality",    // dependent locality
                      "94066",            // postal code
                      "123456",           // sorting code
                      "Testing Org",      // organization
                      "Bill A. Pacheco",  // recipient
                      "+1-434-441-3879"); // phone
 
--- a/dom/payments/test/UpdateErrorsChromeScript.js
+++ b/dom/payments/test/UpdateErrorsChromeScript.js
@@ -18,16 +18,17 @@ const shippingAddress = Cc["@mozilla.org
                            createInstance(Ci.nsIPaymentAddress);
 const addressLine = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
 const address = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 address.data = "Easton Ave";
 addressLine.appendElement(address);
 shippingAddress.init("USA",              // country
                      addressLine,        // address line
                      "CA",               // region
+                     "CA",               // region code
                      "San Bruno",        // city
                      "Test locality",    // dependent locality
                      "94066",            // postal code
                      "123456",           // sorting code
                      "Testing Org",      // organization
                      "Bill A. Pacheco",  // recipient
                      "+1-434-441-3879"); // phone
 
@@ -117,16 +118,20 @@ function checkAddressErrors(errors) {
   if (errors.recipient != "recipient error") {
     emitTestFail("Expect shippingAddressErrors.recipient as 'recipient error', but got" +
                   errors.recipient);
   }
   if (errors.region != "region error") {
     emitTestFail("Expect shippingAddressErrors.region as 'region error', but got" +
                   errors.region);
   }
+  if (errors.regionCode != "regionCode error") {
+    emitTestFail("Expect shippingAddressErrors.regionCode as 'regionCode error', but got" +
+                  errors.region);
+  }
   if (errors.sortingCode != "sortingCode error") {
     emitTestFail("Expect shippingAddressErrors.sortingCode as 'sortingCode error', but got" +
                   errors.sortingCode);
   }
 }
 
 function updateRequest(requestId) {
   let request = paymentSrv.getPaymentRequestById(requestId);
--- a/dom/payments/test/test_basiccard.html
+++ b/dom/payments/test/test_basiccard.html
@@ -215,16 +215,17 @@ https://bugzilla.mozilla.org/show_bug.cg
         is(response.details.expiryMonth, "01", "response.details.expiryMonth should be '01'.");
         is(response.details.expiryYear, "2024", "response.details.expiryYear should be '2024'.");
         is(response.details.cardSecurityCode, "180", "response.details.cardSecurityCode should be '180'.");
         const billingAddress = response.details.billingAddress;
         is(billingAddress.country, "USA", "country should be 'USA'.");
         is(billingAddress.addressLine.length, 1, "addressLine.length should be 1.");
         is(billingAddress.addressLine[0], "Easton Ave", "addressLine[0] should be 'Easton Ave'.");
         is(billingAddress.region, "CA", "region should be 'CA'.");
+        is(billingAddress.regionCode, "CA", "regionCode should be 'CA'.");
         is(billingAddress.city, "San Bruno", "city should be 'San Bruno'.");
         is(billingAddress.dependentLocality, "", "dependentLocality should be empty.");
         is(billingAddress.postalCode, "94066", "postalCode should be '94066'.");
         is(billingAddress.sortingCode, "123456", "sortingCode should be '123456'.");
         is(billingAddress.organization, "", "organization should be empty." );
         is(billingAddress.recipient, "Bill A. Pacheco", "recipient should be 'Bill A. Pacheco'.");
         is(billingAddress.phone, "+14344413879", "phone should be '+14344413879'.");
         response.complete("success").then(() =>{
--- a/testing/web-platform/meta/payment-request/idlharness.https.window.js.ini
+++ b/testing/web-platform/meta/payment-request/idlharness.https.window.js.ini
@@ -174,17 +174,18 @@
     expected:
       if not e10s: FAIL
 
   [PaymentAddress interface: attribute region]
     expected:
       if not e10s: FAIL
 
   [PaymentAddress interface: attribute regionCode]
-    expected: FAIL
+    expected:
+      if not e10s: FAIL
 
   [PaymentAddress interface: attribute sortingCode]
     expected:
       if not e10s: FAIL
 
   [PaymentAddress interface: attribute addressLine]
     expected:
       if not e10s: FAIL
--- a/testing/web-platform/meta/payment-request/interfaces.https.html.ini
+++ b/testing/web-platform/meta/payment-request/interfaces.https.html.ini
@@ -435,17 +435,18 @@
     expected: 
       if not e10s: FAIL
 
   [EventTarget interface: calling dispatchEvent(Event) on new PaymentRequest([{supportedMethods: 'foo'}\], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) with too few arguments must throw TypeError]
     expected: 
       if not e10s: FAIL
 
   [PaymentAddress interface: attribute regionCode]
-    expected: FAIL
+    expected:
+      if not e10s: FAIL
 
   [PaymentRequest interface: operation show([object Object\])]
     expected: 
       if not e10s: FAIL
 
   [PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}\], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "show([object Object\])" with the proper type]
     expected: 
       if not e10s: FAIL