Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h |
| diff --git a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h |
| index 0e2fe7bf36a1d815d2eb6e8410dc53fddcd6263e..79b0786bd71cd8339fc9072f930fe45eb98875fe 100644 |
| --- a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h |
| +++ b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h |
| @@ -10,15 +10,20 @@ |
| #include "base/command_line.h" |
| #include "base/macros.h" |
| #include "base/run_loop.h" |
| -#include "chrome/browser/ui/views/payments/payment_request_dialog.h" |
| +#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| #include "components/payments/payment_request.mojom.h" |
| #include "net/test/embedded_test_server/embedded_test_server.h" |
| +#include "ui/views/widget/widget_observer.h" |
| namespace content { |
| class WebContents; |
| } // namespace content |
| +namespace views { |
| +class Widget; |
| +} |
| + |
| namespace payments { |
| class PaymentRequest; |
| @@ -27,7 +32,8 @@ class PaymentRequest; |
| // the UI and interact with it. |
| class PaymentRequestInteractiveTestBase |
| : public InProcessBrowserTest, |
| - public PaymentRequestDialog::ObserverForTest { |
| + public PaymentRequestDialogView::ObserverForTest, |
| + public views::WidgetObserver { |
| protected: |
| // Test will open a browser window to |test_file_path| (relative to |
| // chrome/test/data/payments). |
| @@ -37,9 +43,13 @@ class PaymentRequestInteractiveTestBase |
| void SetUpCommandLine(base::CommandLine* command_line) override; |
| void SetUpOnMainThread() override; |
| - // PaymentRequestDialog::ObserverForTest |
| + // PaymentRequestDialogView::ObserverForTest |
| void OnDialogOpened() override; |
| + // views::WidgetObserver |
| + // Effective way to be warned of all dialog closures. |
| + void OnWidgetDestroyed(views::Widget* widget) override; |
| + |
| // Will call JavaScript to invoke the PaymentRequest dialog and verify that |
| // it's open. |
| void InvokePaymentRequestUI(); |
| @@ -57,10 +67,10 @@ class PaymentRequestInteractiveTestBase |
| net::EmbeddedTestServer* https_server() { return https_server_.get(); } |
| - private: |
| // Various events that can be waited on by the DialogEventObserver. |
| enum DialogEvent { |
| DIALOG_OPENED, |
| + DIALOG_CLOSED, |
| }; |
| // DialogEventObserver is used to wait on specific events that may have |
| @@ -94,9 +104,11 @@ class PaymentRequestInteractiveTestBase |
| DISALLOW_COPY_AND_ASSIGN(DialogEventObserver); |
| }; |
| + std::unique_ptr<DialogEventObserver> event_observer_; |
|
sky
2017/01/24 00:45:02
Style guide says members should be private.
Mathieu
2017/01/24 01:11:39
Done. Added ResetEventObserver and WaitForObserved
|
| + |
| + private: |
| const std::string test_file_path_; |
| std::unique_ptr<net::EmbeddedTestServer> https_server_; |
| - std::unique_ptr<DialogEventObserver> event_observer_; |
| DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase); |
| }; |