| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |