OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 class PasswordManagerTest : public testing::Test { | 89 class PasswordManagerTest : public testing::Test { |
90 protected: | 90 protected: |
91 virtual void SetUp() { | 91 virtual void SetUp() { |
92 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerSavingEnabled, | 92 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerSavingEnabled, |
93 true); | 93 true); |
94 | 94 |
95 store_ = new MockPasswordStore; | 95 store_ = new MockPasswordStore; |
96 EXPECT_CALL(*store_, ReportMetrics(_)).Times(AnyNumber()); | 96 EXPECT_CALL(*store_.get(), ReportMetrics(_)).Times(AnyNumber()); |
97 CHECK(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); | 97 CHECK(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); |
98 | 98 |
99 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) | 99 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) |
100 .WillRepeatedly(Return(true)); | 100 .WillRepeatedly(Return(true)); |
101 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) | 101 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) |
102 .WillRepeatedly(Return(false)); | 102 .WillRepeatedly(Return(false)); |
103 EXPECT_CALL(client_, GetPasswordStore()).WillRepeatedly(Return(store_)); | 103 EXPECT_CALL(client_, GetPasswordStore()).WillRepeatedly(Return(store_)); |
104 EXPECT_CALL(client_, GetPrefs()).WillRepeatedly(Return(&prefs_)); | 104 EXPECT_CALL(client_, GetPrefs()).WillRepeatedly(Return(&prefs_)); |
105 EXPECT_CALL(client_, GetDriver()).WillRepeatedly(Return(&driver_)); | 105 EXPECT_CALL(client_, GetDriver()).WillRepeatedly(Return(&driver_)); |
106 | 106 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); | 752 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); |
753 | 753 |
754 // Submit form and finish navigation. | 754 // Submit form and finish navigation. |
755 manager()->ProvisionallySavePassword(form); | 755 manager()->ProvisionallySavePassword(form); |
756 observed.clear(); | 756 observed.clear(); |
757 manager()->OnPasswordFormsParsed(observed); | 757 manager()->OnPasswordFormsParsed(observed); |
758 manager()->OnPasswordFormsRendered(observed, true); | 758 manager()->OnPasswordFormsRendered(observed, true); |
759 } | 759 } |
760 | 760 |
761 } // namespace password_manager | 761 } // namespace password_manager |
OLD | NEW |