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

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

Issue 13331007: Multi-account AccountChooser for interactive autocomplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indent fix. Created 7 years, 9 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
Index: chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc
index f361db1208e5ee88e758b269ae7d03ea54de034a..99ef33fca718ba5c8e28fe61770367649923724b 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc
@@ -11,81 +11,4 @@
namespace autofill {
-namespace {
-
-class MockAccountChooserModelDelegate : public AccountChooserModelDelegate {
- public:
- MockAccountChooserModelDelegate() {}
- virtual ~MockAccountChooserModelDelegate() {}
-
- MOCK_METHOD0(AccountChoiceChanged, void());
-};
-
-class AccountChooserModelTest : public testing::Test {
- public:
- AccountChooserModelTest() : model_(&delegate_, profile_.GetPrefs()) {}
- virtual ~AccountChooserModelTest() {}
-
- Profile* profile() { return &profile_; }
- MockAccountChooserModelDelegate* delegate() { return &delegate_; }
- AccountChooserModel* model() { return &model_; }
-
- private:
- TestingProfile profile_;
- MockAccountChooserModelDelegate delegate_;
- AccountChooserModel model_;
-};
-
-} // namespace
-
-TEST_F(AccountChooserModelTest, ObeysPref) {
- EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2);
-
- profile()->GetPrefs()->SetBoolean(
- prefs::kAutofillDialogPayWithoutWallet, false);
- EXPECT_TRUE(model()->WalletIsSelected());
-
- profile()->GetPrefs()->SetBoolean(
- prefs::kAutofillDialogPayWithoutWallet, true);
- EXPECT_FALSE(model()->WalletIsSelected());
-}
-
-TEST_F(AccountChooserModelTest, HandlesError) {
- EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2);
-
- profile()->GetPrefs()->SetBoolean(
- prefs::kAutofillDialogPayWithoutWallet, false);
- EXPECT_TRUE(model()->WalletIsSelected());
-
- model()->SetHadWalletError();
- EXPECT_FALSE(model()->WalletIsSelected());
- EXPECT_FALSE(model()->IsCommandIdEnabled(0));
-}
-
-TEST_F(AccountChooserModelTest, HandlesSigninError) {
- EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2);
-
- profile()->GetPrefs()->SetBoolean(
- prefs::kAutofillDialogPayWithoutWallet, false);
- EXPECT_TRUE(model()->WalletIsSelected());
-
- model()->SetHadWalletSigninError();
- EXPECT_FALSE(model()->WalletIsSelected());
- EXPECT_TRUE(model()->IsCommandIdEnabled(0));
-}
-
-TEST_F(AccountChooserModelTest, RespectsUserChoice) {
- EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(3);
-
- profile()->GetPrefs()->SetBoolean(
- prefs::kAutofillDialogPayWithoutWallet, false);
- EXPECT_TRUE(model()->WalletIsSelected());
-
- model()->ExecuteCommand(1, 0);
- EXPECT_FALSE(model()->WalletIsSelected());
-
- model()->ExecuteCommand(0, 0);
- EXPECT_TRUE(model()->WalletIsSelected());
-}
-
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698