Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3470)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java

Issue 2066483010: Phone and email selection UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix integration test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4c899435f7f40e0f1332f72f0b06f1cdb05ae281
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Unit tests for the AutofillContact class.
+ */
+@RunWith(Parameterized.class)
+public class AutofillContactTest {
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][] {
+ {"j@d.co", "555-5555", "555-5555", "j@d.co", "j@d.co", "555-5555"},
+ {"j@d.co", null, "j@d.co", null, "j@d.co", null},
+ {null, "555-5555", "555-5555", null, null, "555-5555"},
+ });
+ }
+
+ private final String mPayerEmail;
+ private final String mPayerPhone;
+ private final String mExpectedLabel;
+ private final String mExpectedSublabel;
+ private final String mExpectedPayerEmail;
+ private final String mExpectedPayerPhone;
+
+ public AutofillContactTest(String payerEmail, String payerPhone, String expectedLabel,
+ String expectedSublabel, String expectedPayerEmail, String expectedPayerPhone) {
+ mPayerEmail = payerEmail;
+ mPayerPhone = payerPhone;
+ mExpectedLabel = expectedLabel;
+ mExpectedSublabel = expectedSublabel;
+ mExpectedPayerEmail = expectedPayerEmail;
+ mExpectedPayerPhone = expectedPayerPhone;
+ }
+
+ @Test
+ public void test() {
+ AutofillContact contact = new AutofillContact(mPayerEmail, mPayerPhone);
+
+ Assert.assertEquals("Label should be " + mExpectedLabel,
+ mExpectedLabel, contact.getLabel());
+ Assert.assertEquals("Sublabel should be " + mExpectedSublabel,
+ mExpectedSublabel, contact.getSublabel());
+ Assert.assertEquals("Email should be " + mExpectedPayerEmail,
+ mExpectedPayerEmail, contact.getPayerEmail());
+ Assert.assertEquals("Phone should be " + mExpectedPayerPhone,
+ mExpectedPayerPhone, contact.getPayerPhone());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698