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..b8d5fe65816ffb924a543ecd70b86718a18f1c84 100644 |
| --- a/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| +++ b/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc |
| @@ -22,6 +22,7 @@ |
| #include "content/public/browser/browser_context.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/test/test_utils.h" |
| +#include "ui/base/test/user_interactive_test_case.h" |
| namespace autofill { |
| @@ -95,6 +96,15 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest { |
| delegate_.reset(new TestCardUnmaskDelegate()); |
| } |
| + void ShowUI(bool expired) { |
|
Ilya Sherman
2016/10/18 23:59:58
nit: Please define an enum with values EXPIRED and
Patti Lor
2016/10/20 00:58:06
Done, thanks!
|
| + CardUnmaskPromptView* dialog = |
| + CreateCardUnmaskPromptView(controller(), contents()); |
| + CreditCard cc = |
|
Ilya Sherman
2016/10/18 23:59:58
nit: s/cc/card
Patti Lor
2016/10/20 00:58:06
Done.
|
| + expired ? test::GetMaskedServerCard() : test::GetMaskedServerCardAmex(); |
| + controller()->ShowPrompt(dialog, cc, AutofillClient::UNMASK_FOR_AUTOFILL, |
| + delegate()->GetWeakPtr()); |
| + } |
| + |
| void FreeDelegate() { delegate_.reset(); } |
| content::WebContents* contents() { return contents_; } |
| @@ -113,11 +123,23 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest { |
| DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViewBrowserTest); |
| }; |
| +// Permanently disabled test used to invoke the UI for the card unmask prompt |
| +// with an expired credit card, which shows additional month/year controls. |
| +IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
| + DISABLED_InvokeExpired) { |
| + ShowUI(true); |
| + ::test::RunTestInteractively(); |
| +} |
| + |
| +// Permanently disabled test used to invoke the UI for the card unmask prompt |
| +// with a valid credit card, which only shows the CCV Textfield. |
| +IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DISABLED_InvokeValid) { |
| + ShowUI(false); |
| + ::test::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. |
| @@ -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(); |