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

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

Issue 2803443003: [Payments] Added region load failure tolerance and tests to PR editor. (Closed)
Patch Set: Removed unneeded include. Created 3 years, 8 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_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "chrome/browser/payments/chrome_payment_request_delegate.h" 11 #include "chrome/browser/payments/chrome_payment_request_delegate.h"
10 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 12 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
11 13
12 namespace content { 14 namespace content {
13 class WebContents; 15 class WebContents;
14 } 16 }
15 17
16 namespace views { 18 namespace views {
17 class WidgetObserver; 19 class WidgetObserver;
18 } 20 }
19 21
20 namespace payments { 22 namespace payments {
21 23
22 class PaymentRequest; 24 class PaymentRequest;
23 25
24 // Implementation of the Payment Request delegate used in tests. 26 // Implementation of the Payment Request delegate used in tests.
25 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate { 27 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate {
26 public: 28 public:
27 TestChromePaymentRequestDelegate( 29 TestChromePaymentRequestDelegate(
28 content::WebContents* web_contents, 30 content::WebContents* web_contents,
29 PaymentRequestDialogView::ObserverForTest* observer, 31 PaymentRequestDialogView::ObserverForTest* observer,
30 views::WidgetObserver* widget_observer, 32 views::WidgetObserver* widget_observer,
31 bool is_incognito); 33 bool is_incognito);
32 34
35 // This class allows tests to provide their own AddressInput data.
36 class AddressInputProvider {
37 public:
38 virtual std::unique_ptr<const ::i18n::addressinput::Source>
39 GetAddressInputSource() = 0;
40 virtual std::unique_ptr<::i18n::addressinput::Storage>
41 GetAddressInputStorage() = 0;
42 };
43
44 void SetAddressInputOverride(AddressInputProvider* address_input_provider) {
45 address_input_provider_ = address_input_provider;
46 }
47
48 // ChromePaymentRequestDelegate.
33 void ShowDialog(PaymentRequest* request) override; 49 void ShowDialog(PaymentRequest* request) override;
34 bool IsIncognito() const override; 50 bool IsIncognito() const override;
51 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource()
52 override;
53 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage()
54 override;
35 55
36 PaymentRequestDialogView* dialog_view() { 56 PaymentRequestDialogView* dialog_view() {
37 return static_cast<PaymentRequestDialogView*>(dialog_); 57 return static_cast<PaymentRequestDialogView*>(dialog_);
38 } 58 }
39 59
40 private: 60 private:
61 // Not owned so must outlive the PaymentRequest object;
62 AddressInputProvider* address_input_provider_;
63
41 PaymentRequestDialogView::ObserverForTest* observer_; 64 PaymentRequestDialogView::ObserverForTest* observer_;
42 views::WidgetObserver* widget_observer_; 65 views::WidgetObserver* widget_observer_;
43 bool is_incognito_for_testing_; 66 bool is_incognito_for_testing_;
44 67
45 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate); 68 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate);
46 }; 69 };
47 70
48 } // namespace payments 71 } // namespace payments
49 72
50 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE _H_ 73 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698