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

Unified Diff: chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc

Issue 2382963002: Views: Add two disabled tests for invoking the CC unmask prompt dialog. (Closed)
Patch Set: Switch to CreditCardExpiry to enum class : uint8_t. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dad2c88da275738acefc4bcc29d449f86bd13496 100644
--- a/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc
+++ b/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc
@@ -22,11 +22,14 @@
#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 {
namespace {
+enum class CreditCardExpiry : uint8_t { EXPIRED, VALID };
Ilya Sherman 2016/10/20 07:38:08 Optional nit: Probably no need to specify uint8_t
+
class TestCardUnmaskDelegate : public CardUnmaskDelegate {
public:
TestCardUnmaskDelegate() : weak_factory_(this) {}
@@ -95,6 +98,16 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest {
delegate_.reset(new TestCardUnmaskDelegate());
}
+ void ShowUI(CreditCardExpiry expired) {
+ CardUnmaskPromptView* dialog =
+ CreateCardUnmaskPromptView(controller(), contents());
+ CreditCard card = (expired == CreditCardExpiry::EXPIRED)
+ ? test::GetMaskedServerCard()
+ : test::GetMaskedServerCardAmex();
+ controller()->ShowPrompt(dialog, card, AutofillClient::UNMASK_FOR_AUTOFILL,
+ delegate()->GetWeakPtr());
+ }
+
void FreeDelegate() { delegate_.reset(); }
content::WebContents* contents() { return contents_; }
@@ -113,11 +126,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(CreditCardExpiry::EXPIRED);
+ ::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(CreditCardExpiry::VALID);
+ ::test::RunTestInteractively();
+}
+
IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DisplayUI) {
- controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()),
- test::GetMaskedServerCard(),
- AutofillClient::UNMASK_FOR_AUTOFILL,
- delegate()->GetWeakPtr());
+ ShowUI(CreditCardExpiry::EXPIRED);
}
// TODO(bondd): bring up on Mac.
@@ -126,10 +151,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(CreditCardExpiry::EXPIRED);
controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"),
base::ASCIIToUTF16("10"),
base::ASCIIToUTF16("19"), false);
@@ -151,10 +173,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(CreditCardExpiry::EXPIRED);
// Simulate AutofillManager (the delegate in production code) being destroyed
// before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called.
FreeDelegate();
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698