Chromium Code Reviews| Index: chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| diff --git a/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc b/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| index deb01c867569f3050df80917e8a555dadf902b28..85a6ac28fa6bce4ff316e0e1f21f53820d886393 100644 |
| --- a/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| +++ b/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "base/bind.h" |
| +#include "base/command_line.h" |
| #include "base/guid.h" |
| #include "base/location.h" |
| #include "base/macros.h" |
| @@ -15,6 +16,7 @@ |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| +#include "chrome/test/base/use_interactive_test_case.h" |
| #include "components/autofill/core/browser/autofill_test_utils.h" |
| #include "components/autofill/core/browser/card_unmask_delegate.h" |
| #include "components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.h" |
| @@ -95,6 +97,18 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest { |
| delegate_.reset(new TestCardUnmaskDelegate()); |
| } |
| + void ShowUI(bool expired) { |
| + CardUnmaskPromptView* dialog = |
| + CreateCardUnmaskPromptView(controller(), contents()); |
| + CreditCard cc; |
|
tapted
2016/10/16 23:48:01
nit:
CreditCard cc = expired
? test::GetMaske
Patti Lor
2016/10/17 23:26:09
Done.
|
| + if (expired) |
| + cc = test::GetMaskedServerCard(); |
| + else |
| + cc = test::GetMaskedServerCardAmex(); |
| + controller()->ShowPrompt(dialog, cc, AutofillClient::UNMASK_FOR_AUTOFILL, |
| + delegate()->GetWeakPtr()); |
| + } |
| + |
| void FreeDelegate() { delegate_.reset(); } |
| content::WebContents* contents() { return contents_; } |
| @@ -113,11 +127,19 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest { |
| DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViewBrowserTest); |
| }; |
| +IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
|
tapted
2016/10/16 23:48:01
nit: these need a comment
Patti Lor
2016/10/17 23:26:09
Done.
|
| + DISABLED_InvokeExpired) { |
| + ShowUI(true); |
| + RunTestInteractively(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DISABLED_InvokeValid) { |
| + ShowUI(false); |
| + RunTestInteractively(); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DisplayUI) { |
| - controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()), |
| - test::GetMaskedServerCard(), |
| - AutofillClient::UNMASK_FOR_AUTOFILL, |
| - delegate()->GetWeakPtr()); |
| + ShowUI(true); |
| } |
| // TODO(bondd): bring up on Mac. |
|
tapted
2016/10/16 23:48:01
hrmh - we need to do something about this. I don't
Patti Lor
2016/10/17 23:26:08
I don't think there's any ongoing work - the most
|
| @@ -126,10 +148,7 @@ IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DisplayUI) { |
| // message is showing. |
| IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
| EarlyCloseAfterSuccess) { |
| - controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()), |
| - test::GetMaskedServerCard(), |
| - AutofillClient::UNMASK_FOR_AUTOFILL, |
| - delegate()->GetWeakPtr()); |
| + ShowUI(true); |
| controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"), |
| base::ASCIIToUTF16("10"), |
| base::ASCIIToUTF16("19"), false); |
| @@ -151,10 +170,7 @@ IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
| // https://crbug.com/484376 |
| IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
| CloseTabWhileDialogShowing) { |
| - controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()), |
| - test::GetMaskedServerCard(), |
| - AutofillClient::UNMASK_FOR_AUTOFILL, |
| - delegate()->GetWeakPtr()); |
| + ShowUI(true); |
| // Simulate AutofillManager (the delegate in production code) being destroyed |
| // before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called. |
| FreeDelegate(); |