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" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using base::ASCIIToUTF16; | 14 using base::ASCIIToUTF16; |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class TestAccountChooserModel : public AccountChooserModel { | 20 class TestAccountChooserModel : public AccountChooserModel { |
21 public: | 21 public: |
22 TestAccountChooserModel(AccountChooserModelDelegate* delegate, | 22 TestAccountChooserModel(AccountChooserModelDelegate* delegate, |
23 Profile* profile, | 23 Profile* profile, |
24 bool disable_wallet, | 24 bool disable_wallet, |
25 const AutofillMetrics& metric_logger) | 25 const AutofillMetrics& metric_logger) |
26 : AccountChooserModel(delegate, profile, disable_wallet, metric_logger) {} | 26 : AccountChooserModel(delegate, profile, disable_wallet, metric_logger) {} |
27 virtual ~TestAccountChooserModel() {} | 27 ~TestAccountChooserModel() override {} |
28 | 28 |
29 using AccountChooserModel::kWalletAccountsStartId; | 29 using AccountChooserModel::kWalletAccountsStartId; |
30 using AccountChooserModel::kWalletAddAccountId; | 30 using AccountChooserModel::kWalletAddAccountId; |
31 using AccountChooserModel::kAutofillItemId; | 31 using AccountChooserModel::kAutofillItemId; |
32 | 32 |
33 private: | 33 private: |
34 DISALLOW_COPY_AND_ASSIGN(TestAccountChooserModel); | 34 DISALLOW_COPY_AND_ASSIGN(TestAccountChooserModel); |
35 }; | 35 }; |
36 | 36 |
37 class MockAccountChooserModelDelegate : public AccountChooserModelDelegate { | 37 class MockAccountChooserModelDelegate : public AccountChooserModelDelegate { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 EXPECT_EQ(ASCIIToUTF16(accounts[1]), model()->GetActiveWalletAccountName()); | 213 EXPECT_EQ(ASCIIToUTF16(accounts[1]), model()->GetActiveWalletAccountName()); |
214 | 214 |
215 // Setting the wallet accounts forces the switch to wallet. | 215 // Setting the wallet accounts forces the switch to wallet. |
216 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0); | 216 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0); |
217 EXPECT_FALSE(model()->WalletIsSelected()); | 217 EXPECT_FALSE(model()->WalletIsSelected()); |
218 model()->SetWalletAccounts(accounts, 1U); | 218 model()->SetWalletAccounts(accounts, 1U); |
219 EXPECT_TRUE(model()->WalletIsSelected()); | 219 EXPECT_TRUE(model()->WalletIsSelected()); |
220 } | 220 } |
221 | 221 |
222 } // namespace autofill | 222 } // namespace autofill |
OLD | NEW |