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

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

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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"
11 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 namespace autofill { 14 namespace autofill {
16 15
17 namespace { 16 namespace {
18 17
19 class TestAccountChooserModel : public AccountChooserModel { 18 class TestAccountChooserModel : public AccountChooserModel {
20 public: 19 public:
21 TestAccountChooserModel(AccountChooserModelDelegate* delegate, 20 TestAccountChooserModel(AccountChooserModelDelegate* delegate,
(...skipping 24 matching lines...) Expand all
46 AccountChooserModelTest() 45 AccountChooserModelTest()
47 : model_(&delegate_, profile_.GetPrefs(), metric_logger_) {} 46 : model_(&delegate_, profile_.GetPrefs(), metric_logger_) {}
48 virtual ~AccountChooserModelTest() {} 47 virtual ~AccountChooserModelTest() {}
49 48
50 Profile* profile() { return &profile_; } 49 Profile* profile() { return &profile_; }
51 MockAccountChooserModelDelegate* delegate() { return &delegate_; } 50 MockAccountChooserModelDelegate* delegate() { return &delegate_; }
52 TestAccountChooserModel* model() { return &model_; } 51 TestAccountChooserModel* model() { return &model_; }
53 const AutofillMetrics& metric_logger() { return metric_logger_; } 52 const AutofillMetrics& metric_logger() { return metric_logger_; }
54 53
55 private: 54 private:
56 content::TestBrowserThreadBundle thread_bundle_;
57 TestingProfile profile_; 55 TestingProfile profile_;
58 MockAccountChooserModelDelegate delegate_; 56 MockAccountChooserModelDelegate delegate_;
59 TestAccountChooserModel model_; 57 TestAccountChooserModel model_;
60 AutofillMetrics metric_logger_; 58 AutofillMetrics metric_logger_;
61 }; 59 };
62 60
63 } // namespace 61 } // namespace
64 62
65 TEST_F(AccountChooserModelTest, ObeysPref) { 63 TEST_F(AccountChooserModelTest, ObeysPref) {
66 // When "Pay without wallet" is false, use Wallet by default. 64 // When "Pay without wallet" is false, use Wallet by default.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2); 149 EXPECT_CALL(*delegate(), AccountChoiceChanged()).Times(2);
152 150
153 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0); 151 model()->ExecuteCommand(TestAccountChooserModel::kAutofillItemId, 0);
154 EXPECT_FALSE(model()->WalletIsSelected()); 152 EXPECT_FALSE(model()->WalletIsSelected());
155 153
156 model()->ExecuteCommand(TestAccountChooserModel::kActiveWalletItemId, 0); 154 model()->ExecuteCommand(TestAccountChooserModel::kActiveWalletItemId, 0);
157 EXPECT_TRUE(model()->WalletIsSelected()); 155 EXPECT_TRUE(model()->WalletIsSelected());
158 } 156 }
159 157
160 } // namespace autofill 158 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698