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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h

Issue 2715213005: [Payments] Add the pay button, and control its enabled state (Closed)
Patch Set: tweak Created 3 years, 9 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE _H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE _H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE _H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE _H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
15 #include "chrome/browser/ui/views/payments/test_chrome_payment_request_delegate. h" 15 #include "chrome/browser/ui/views/payments/test_chrome_payment_request_delegate. h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "components/autofill/core/browser/field_types.h" 17 #include "components/autofill/core/browser/field_types.h"
18 #include "components/autofill/core/browser/personal_data_manager_observer.h" 18 #include "components/autofill/core/browser/personal_data_manager_observer.h"
19 #include "components/payments/content/payment_request.mojom.h" 19 #include "components/payments/content/payment_request.mojom.h"
20 #include "net/test/embedded_test_server/embedded_test_server.h" 20 #include "net/test/embedded_test_server/embedded_test_server.h"
21 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "ui/views/widget/widget_observer.h" 22 #include "ui/views/widget/widget_observer.h"
23 23
24 namespace autofill {
25 class AutofillProfile;
26 class CreditCard;
27 }
28
24 namespace content { 29 namespace content {
25 class WebContents; 30 class WebContents;
26 } // namespace content 31 } // namespace content
27 32
28 namespace views { 33 namespace views {
29 class Widget; 34 class Widget;
30 } 35 }
31 36
32 namespace payments { 37 namespace payments {
33 38
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void OpenCreditCardEditorScreen(); 93 void OpenCreditCardEditorScreen();
89 94
90 content::WebContents* GetActiveWebContents(); 95 content::WebContents* GetActiveWebContents();
91 96
92 // Convenience method to get a list of PaymentRequest associated with 97 // Convenience method to get a list of PaymentRequest associated with
93 // |web_contents|. 98 // |web_contents|.
94 const std::vector<PaymentRequest*> GetPaymentRequests( 99 const std::vector<PaymentRequest*> GetPaymentRequests(
95 content::WebContents* web_contents); 100 content::WebContents* web_contents);
96 101
97 autofill::PersonalDataManager* GetDataManager(); 102 autofill::PersonalDataManager* GetDataManager();
103 // Adds the various models to the database, waiting until the personal data
104 // manager notifies that they are added.
105 void AddAutofillProfile(const autofill::AutofillProfile& profile);
106 void AddCreditCard(const autofill::CreditCard& card);
98 107
99 void CreatePaymentRequestForTest( 108 void CreatePaymentRequestForTest(
100 content::WebContents* web_contents, 109 content::WebContents* web_contents,
101 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); 110 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request);
102 111
103 // Click on a view from within the dialog and waits for an observed event 112 // Click on a view from within the dialog and waits for an observed event
104 // to be observed. 113 // to be observed.
105 void ClickOnDialogViewAndWait(DialogViewID view_id); 114 void ClickOnDialogViewAndWait(DialogViewID view_id);
106 void ClickOnDialogViewAndWait(views::View* view); 115 void ClickOnDialogViewAndWait(views::View* view);
107 116
108 // Setting the |value| in the textfield of a given |type|. 117 // Setting the |value| in the textfield of a given |type|.
109 void SetEditorTextfieldValue(const base::string16& value, 118 void SetEditorTextfieldValue(const base::string16& value,
110 autofill::ServerFieldType type); 119 autofill::ServerFieldType type);
111 // Setting the |value| in the combobox of a given |type|. 120 // Setting the |value| in the combobox of a given |type|.
112 void SetComboboxValue(const base::string16& value, 121 void SetComboboxValue(const base::string16& value,
113 autofill::ServerFieldType type); 122 autofill::ServerFieldType type);
114 123
115 // Whether the editor textfield/combobox for the given |type| is currently in 124 // Whether the editor textfield/combobox for the given |type| is currently in
116 // an invalid state. 125 // an invalid state.
117 bool IsEditorTextfieldInvalid(autofill::ServerFieldType type); 126 bool IsEditorTextfieldInvalid(autofill::ServerFieldType type);
118 bool IsEditorComboboxInvalid(autofill::ServerFieldType type); 127 bool IsEditorComboboxInvalid(autofill::ServerFieldType type);
119 128
129 bool IsPayButtonEnabled();
130
120 // Sets proper animation delegates and waits for animation to finish. 131 // Sets proper animation delegates and waits for animation to finish.
121 void WaitForAnimation(); 132 void WaitForAnimation();
122 133
123 // Returns the text of the StyledLabel with the specific |view_id| that is a 134 // Returns the text of the StyledLabel with the specific |view_id| that is a
124 // child of the Payment Request dialog view. 135 // child of the Payment Request dialog view.
125 const base::string16& GetStyledLabelText(DialogViewID view_id); 136 const base::string16& GetStyledLabelText(DialogViewID view_id);
126 // Returns the error label text associated with a given field |type|. 137 // Returns the error label text associated with a given field |type|.
127 const base::string16& GetErrorLabelForType(autofill::ServerFieldType type); 138 const base::string16& GetErrorLabelForType(autofill::ServerFieldType type);
128 139
129 net::EmbeddedTestServer* https_server() { return https_server_.get(); } 140 net::EmbeddedTestServer* https_server() { return https_server_.get(); }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 std::unique_ptr<net::EmbeddedTestServer> https_server_; 193 std::unique_ptr<net::EmbeddedTestServer> https_server_;
183 // Weak, owned by the PaymentRequest object. 194 // Weak, owned by the PaymentRequest object.
184 TestChromePaymentRequestDelegate* delegate_; 195 TestChromePaymentRequestDelegate* delegate_;
185 196
186 DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase); 197 DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase);
187 }; 198 };
188 199
189 } // namespace payments 200 } // namespace payments
190 201
191 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_B ASE_H_ 202 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_B ASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698