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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc

Issue 2676663002: [Payments] Implements the credit card editor for Desktop UI (Closed)
Patch Set: formatting Created 3 years, 10 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "base/macros.h"
7 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 10 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
10 #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_ba se.h" 11 #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_ba se.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "components/payments/payment_request.h" 13 #include "components/payments/payment_request.h"
13 #include "components/payments/payment_request_web_contents_manager.h" 14 #include "components/payments/payment_request_web_contents_manager.h"
14 #include "components/web_modal/web_contents_modal_dialog_manager.h" 15 #include "components/web_modal/web_contents_modal_dialog_manager.h"
15 #include "content/public/test/browser_test_utils.h" 16 #include "content/public/test/browser_test_utils.h"
16 17
17 namespace payments { 18 namespace payments {
18 19
19 class PaymentRequestWebContentsManagerTest 20 class PaymentRequestWebContentsManagerTest
20 : public PaymentRequestInteractiveTestBase { 21 : public PaymentRequestInteractiveTestBase {
21 protected: 22 protected:
22 PaymentRequestWebContentsManagerTest() 23 PaymentRequestWebContentsManagerTest()
23 : PaymentRequestInteractiveTestBase( 24 : PaymentRequestInteractiveTestBase(
24 "/payment_request_multiple_requests.html") {} 25 "/payment_request_multiple_requests.html") {}
26
27 private:
28 DISALLOW_COPY_AND_ASSIGN(PaymentRequestWebContentsManagerTest);
25 }; 29 };
26 30
27 // If the page creates multiple PaymentRequest objects, it should not crash. 31 // If the page creates multiple PaymentRequest objects, it should not crash.
28 IN_PROC_BROWSER_TEST_F(PaymentRequestWebContentsManagerTest, MultipleRequests) { 32 IN_PROC_BROWSER_TEST_F(PaymentRequestWebContentsManagerTest, MultipleRequests) {
29 const std::vector<PaymentRequest*> payment_requests = 33 const std::vector<PaymentRequest*> payment_requests =
30 GetPaymentRequests(GetActiveWebContents()); 34 GetPaymentRequests(GetActiveWebContents());
31 EXPECT_EQ(5U, payment_requests.size()); 35 EXPECT_EQ(5U, payment_requests.size());
32 } 36 }
33 37
34 class PaymentRequestNoShippingTest : public PaymentRequestInteractiveTestBase { 38 class PaymentRequestNoShippingTest : public PaymentRequestInteractiveTestBase {
35 protected: 39 protected:
36 PaymentRequestNoShippingTest() 40 PaymentRequestNoShippingTest()
37 : PaymentRequestInteractiveTestBase( 41 : PaymentRequestInteractiveTestBase(
38 "/payment_request_no_shipping_test.html") {} 42 "/payment_request_no_shipping_test.html") {}
43
44 private:
45 DISALLOW_COPY_AND_ASSIGN(PaymentRequestNoShippingTest);
39 }; 46 };
40 47
41 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, 48 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest,
42 OpenAndNavigateToOrderSummary) { 49 OpenAndNavigateToOrderSummary) {
43 InvokePaymentRequestUI(); 50 InvokePaymentRequestUI();
44 51
45 OpenOrderSummaryScreen(); 52 OpenOrderSummaryScreen();
46 53
47 // Verify the expected amounts are shown. 54 // Verify the expected amounts are shown.
48 EXPECT_EQ(base::ASCIIToUTF16("USD $5.00"), 55 EXPECT_EQ(base::ASCIIToUTF16("USD $5.00"),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 90
84 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); 91 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
85 92
86 WaitForObservedEvent(); 93 WaitForObservedEvent();
87 } 94 }
88 95
89 class PaymentRequestAbortTest : public PaymentRequestInteractiveTestBase { 96 class PaymentRequestAbortTest : public PaymentRequestInteractiveTestBase {
90 protected: 97 protected:
91 PaymentRequestAbortTest() 98 PaymentRequestAbortTest()
92 : PaymentRequestInteractiveTestBase("/payment_request_abort_test.html") {} 99 : PaymentRequestInteractiveTestBase("/payment_request_abort_test.html") {}
100
101 private:
102 DISALLOW_COPY_AND_ASSIGN(PaymentRequestAbortTest);
93 }; 103 };
94 104
95 // Testing the use of the abort() JS API. 105 // Testing the use of the abort() JS API.
96 IN_PROC_BROWSER_TEST_F(PaymentRequestAbortTest, OpenThenAbort) { 106 IN_PROC_BROWSER_TEST_F(PaymentRequestAbortTest, OpenThenAbort) {
97 InvokePaymentRequestUI(); 107 InvokePaymentRequestUI();
98 108
99 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 109 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
100 110
101 content::WebContents* web_contents = GetActiveWebContents(); 111 content::WebContents* web_contents = GetActiveWebContents();
102 const std::string click_buy_button_js = 112 const std::string click_buy_button_js =
103 "(function() { document.getElementById('abort').click(); })();"; 113 "(function() { document.getElementById('abort').click(); })();";
104 ASSERT_TRUE(content::ExecuteScript(web_contents, click_buy_button_js)); 114 ASSERT_TRUE(content::ExecuteScript(web_contents, click_buy_button_js));
105 115
106 WaitForObservedEvent(); 116 WaitForObservedEvent();
107 117
108 // The web-modal dialog should now be closed. 118 // The web-modal dialog should now be closed.
109 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = 119 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager =
110 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); 120 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
111 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); 121 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
112 } 122 }
113 123
114 } // namespace payments 124 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698