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

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: addressed comments 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 // NOTE: If no use_count is specified on the models and multiple items are
106 // inserted, the order in which they are returned is undefined, since they
107 // are added close to each other.
108 void AddAutofillProfile(const autofill::AutofillProfile& profile);
109 void AddCreditCard(const autofill::CreditCard& card);
98 110
99 void CreatePaymentRequestForTest( 111 void CreatePaymentRequestForTest(
100 content::WebContents* web_contents, 112 content::WebContents* web_contents,
101 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); 113 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request);
102 114
103 // Click on a view from within the dialog and waits for an observed event 115 // Click on a view from within the dialog and waits for an observed event
104 // to be observed. 116 // to be observed.
105 void ClickOnDialogViewAndWait(DialogViewID view_id); 117 void ClickOnDialogViewAndWait(DialogViewID view_id);
106 void ClickOnDialogViewAndWait(views::View* view); 118 void ClickOnDialogViewAndWait(views::View* view);
107 119
108 // Setting the |value| in the textfield of a given |type|. 120 // Setting the |value| in the textfield of a given |type|.
109 void SetEditorTextfieldValue(const base::string16& value, 121 void SetEditorTextfieldValue(const base::string16& value,
110 autofill::ServerFieldType type); 122 autofill::ServerFieldType type);
111 // Setting the |value| in the combobox of a given |type|. 123 // Setting the |value| in the combobox of a given |type|.
112 void SetComboboxValue(const base::string16& value, 124 void SetComboboxValue(const base::string16& value,
113 autofill::ServerFieldType type); 125 autofill::ServerFieldType type);
114 126
115 // Whether the editor textfield/combobox for the given |type| is currently in 127 // Whether the editor textfield/combobox for the given |type| is currently in
116 // an invalid state. 128 // an invalid state.
117 bool IsEditorTextfieldInvalid(autofill::ServerFieldType type); 129 bool IsEditorTextfieldInvalid(autofill::ServerFieldType type);
118 bool IsEditorComboboxInvalid(autofill::ServerFieldType type); 130 bool IsEditorComboboxInvalid(autofill::ServerFieldType type);
119 131
132 bool IsPayButtonEnabled();
133
120 // Sets proper animation delegates and waits for animation to finish. 134 // Sets proper animation delegates and waits for animation to finish.
121 void WaitForAnimation(); 135 void WaitForAnimation();
122 136
123 // Returns the text of the StyledLabel with the specific |view_id| that is a 137 // Returns the text of the StyledLabel with the specific |view_id| that is a
124 // child of the Payment Request dialog view. 138 // child of the Payment Request dialog view.
125 const base::string16& GetStyledLabelText(DialogViewID view_id); 139 const base::string16& GetStyledLabelText(DialogViewID view_id);
126 // Returns the error label text associated with a given field |type|. 140 // Returns the error label text associated with a given field |type|.
127 const base::string16& GetErrorLabelForType(autofill::ServerFieldType type); 141 const base::string16& GetErrorLabelForType(autofill::ServerFieldType type);
128 142
129 net::EmbeddedTestServer* https_server() { return https_server_.get(); } 143 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_; 196 std::unique_ptr<net::EmbeddedTestServer> https_server_;
183 // Weak, owned by the PaymentRequest object. 197 // Weak, owned by the PaymentRequest object.
184 TestChromePaymentRequestDelegate* delegate_; 198 TestChromePaymentRequestDelegate* delegate_;
185 199
186 DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase); 200 DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase);
187 }; 201 };
188 202
189 } // namespace payments 203 } // namespace payments
190 204
191 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_B ASE_H_ 205 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_B ASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698