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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTabTest.java

Issue 2320063003: [Payments] PaymentRequestUI should be dismissed on tab changes (Closed)
Patch Set: Nits Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.payments;
6
7 import android.test.suitebuilder.annotation.MediumTest;
8
9 import org.chromium.base.ThreadUtils;
10 import org.chromium.base.test.util.Feature;
11 import org.chromium.chrome.R;
12 import org.chromium.chrome.browser.autofill.AutofillTestHelper;
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
15 import org.chromium.chrome.browser.tabmodel.TabModel;
16 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
17 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
18 import org.chromium.content_public.browser.LoadUrlParams;
19
20 import java.util.concurrent.ExecutionException;
21 import java.util.concurrent.TimeoutException;
22
23 /**
24 * A payment integration test for dismissing the dialog when the user switches t abs or navigates
25 * elsewhere.
26 */
27 public class PaymentRequestTabTest extends PaymentRequestTestBase {
28 public PaymentRequestTabTest() {
29 super("payment_request_dynamic_shipping_test.html");
30 }
31
32 @Override
33 public void onMainActivityStarted()
34 throws InterruptedException, ExecutionException, TimeoutException {
35 AutofillTestHelper helper = new AutofillTestHelper();
36 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt ps://example.com",
37 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "",
38 "US", "555-555-5555", "jon.doe@google.com", "en-US"));
39 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru e, "Jon Doe",
40 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_ visa,
41 billingAddressId, "" /* serverId */));
42 }
43
44 /** If the user switches tabs somehow, the dialog is dismissed. */
45 @MediumTest
46 @Feature({"Payments"})
47 public void testDismissOnTabSwitch() throws InterruptedException, ExecutionE xception,
48 TimeoutException {
49 triggerUIAndWait(mReadyForInput);
50 assertEquals(0, mDismissed.getCallCount());
51 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
52 @Override
53 public void run() {
54 getActivity().getTabCreator(false).createNewTab(
55 new LoadUrlParams("about:blank"), TabLaunchType.FROM_CHR OME_UI, null);
56 }
57 });
58 mDismissed.waitForCallback(0);
59 }
60
61 /** If the user closes the tab, the dialog is dismissed. */
62 @MediumTest
63 @Feature({"Payments"})
64 public void testDismissOnTabClose() throws InterruptedException, ExecutionEx ception,
65 TimeoutException {
66 triggerUIAndWait(mReadyForInput);
67 assertEquals(0, mDismissed.getCallCount());
68 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
69 @Override
70 public void run() {
71 TabModel currentModel = getActivity().getCurrentTabModel();
72 TabModelUtils.closeCurrentTab(currentModel);
73 }
74 });
75 mDismissed.waitForCallback(0);
76 }
77
78 /** If the user navigates anywhere, the dialog is dismissed. */
79 @MediumTest
80 @Feature({"Payments"})
81 public void testDismissOnTabNavigate() throws InterruptedException, Executio nException,
82 TimeoutException {
83 triggerUIAndWait(mReadyForInput);
84 assertEquals(0, mDismissed.getCallCount());
85 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
86 @Override
87 public void run() {
88 TabModel currentModel = getActivity().getCurrentTabModel();
89 TabModelUtils.getCurrentTab(currentModel).loadUrl(new LoadUrlPar ams("about:blank"));
90 }
91 });
92 mDismissed.waitForCallback(0);
93 }
94 }
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698