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

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

Issue 2532793002: Add a TestBrowserDialog helper class for testing browser dialogs in a consistent way. (Closed)
Patch Set: Add kEnablePixelOutputInTests Created 4 years 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
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 dad2c88da275738acefc4bcc29d449f86bd13496..331d786a05300e90d69087b2500fad60a079b658 100644
--- a/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc
+++ b/chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/card_unmask_delegate.h"
@@ -22,13 +23,16 @@
#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 };
+// Forms of the dialog that can be invoked.
+enum class CreditCardExpiry {
+ EXPIRED, // Shows additional month/year controls.
+ VALID, // Shows only the CCV Textfield.
+};
class TestCardUnmaskDelegate : public CardUnmaskDelegate {
public:
@@ -85,12 +89,13 @@ class TestCardUnmaskPromptController : public CardUnmaskPromptControllerImpl {
DISALLOW_COPY_AND_ASSIGN(TestCardUnmaskPromptController);
};
-class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest {
+class CardUnmaskPromptViewBrowserTest : public DialogBrowserTest {
public:
- CardUnmaskPromptViewBrowserTest() : InProcessBrowserTest() {}
+ CardUnmaskPromptViewBrowserTest() {}
~CardUnmaskPromptViewBrowserTest() override {}
+ // InProcessBrowserTest:
Peter Kasting 2016/12/15 00:28:54 Nit: You don't directly subclass InProcessBrowserT
tapted 2016/12/15 06:08:21 Done.
void SetUpOnMainThread() override {
runner_ = new content::MessageLoopRunner;
contents_ = browser()->tab_strip_model()->GetActiveWebContents();
@@ -98,6 +103,15 @@ class CardUnmaskPromptViewBrowserTest : public InProcessBrowserTest {
delegate_.reset(new TestCardUnmaskDelegate());
}
+ // TestDialogInterface:
+ void ShowDialog(int index) override {
+ ShowUI(static_cast<CreditCardExpiry>(index));
Peter Kasting 2016/12/15 00:28:54 I've been trying to think of ways to simplify the
tapted 2016/12/15 06:08:22 I agree that the mapping in ShowDialog feels a bit
+ }
+
+ static std::vector<std::string> NameProvider() {
+ return {"Expired", "Valid"};
+ }
+
void ShowUI(CreditCardExpiry expired) {
CardUnmaskPromptView* dialog =
CreateCardUnmaskPromptView(controller(), contents());
@@ -126,20 +140,7 @@ 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();
-}
+TEST_BROWSER_DIALOG(CardUnmaskPromptViewBrowserTest);
IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, DisplayUI) {
ShowUI(CreditCardExpiry::EXPIRED);
« no previous file with comments | « no previous file | chrome/browser/ui/test/test_browser_dialog.h » ('j') | chrome/browser/ui/test/test_browser_dialog.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698