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

Side by Side Diff: chrome/browser/ui/autofill/account_chooser_model_unittest.cc

Issue 23495006: rAc: better Wallet error messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/ui/autofill/account_chooser_model.h" 7 #include "chrome/browser/ui/autofill/account_chooser_model.h"
8 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "components/autofill/core/browser/autofill_metrics.h" 10 #include "components/autofill/core/browser/autofill_metrics.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 TEST_F(AccountChooserModelTest, HandlesError) { 95 TEST_F(AccountChooserModelTest, HandlesError) {
96 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(1); 96 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(1);
97 EXPECT_CALL(*delegate(), UpdateAccountChooserView()).Times(1); 97 EXPECT_CALL(*delegate(), UpdateAccountChooserView()).Times(1);
98 98
99 ASSERT_TRUE(model()->WalletIsSelected()); 99 ASSERT_TRUE(model()->WalletIsSelected());
100 ASSERT_TRUE(model()->IsCommandIdEnabled( 100 ASSERT_TRUE(model()->IsCommandIdEnabled(
101 TestAccountChooserModel::kActiveWalletItemId)); 101 TestAccountChooserModel::kActiveWalletItemId));
102 102
103 model()->SetHadWalletError(ASCIIToUTF16("Error")); 103 model()->SetHadWalletError();
104 EXPECT_FALSE(model()->WalletIsSelected()); 104 EXPECT_FALSE(model()->WalletIsSelected());
105 EXPECT_FALSE(model()->IsCommandIdEnabled( 105 EXPECT_FALSE(model()->IsCommandIdEnabled(
106 TestAccountChooserModel::kActiveWalletItemId)); 106 TestAccountChooserModel::kActiveWalletItemId));
107 } 107 }
108 108
109 TEST_F(AccountChooserModelTest, HandlesSigninError) { 109 TEST_F(AccountChooserModelTest, HandlesSigninError) {
110 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(1); 110 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(1);
111 EXPECT_CALL(*delegate(), UpdateAccountChooserView()).Times(2); 111 EXPECT_CALL(*delegate(), UpdateAccountChooserView()).Times(2);
112 112
113 // 0. "Unknown" wallet account, we don't know if the user is signed-in yet. 113 // 0. "Unknown" wallet account, we don't know if the user is signed-in yet.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2); 149 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2);
150 150
151 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0); 151 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0);
152 EXPECT_FALSE(model()->WalletIsSelected()); 152 EXPECT_FALSE(model()->WalletIsSelected());
153 153
154 model()->ExecuteCommand(TestAccountChooserModel::kActiveWalletItemId, 0); 154 model()->ExecuteCommand(TestAccountChooserModel::kActiveWalletItemId, 0);
155 EXPECT_TRUE(model()->WalletIsSelected()); 155 EXPECT_TRUE(model()->WalletIsSelected());
156 } 156 }
157 157
158 } // namespace autofill 158 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/account_chooser_model.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698