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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/password_manager/password_generation_manager.h" | 8 #include "chrome/browser/password_manager/password_generation_manager.h" |
9 #include "chrome/browser/password_manager/password_manager.h" | 9 #include "chrome/browser/password_manager/password_manager.h" |
10 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 10 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // Sync some things, but not passwords. Shouldn't send anything since | 158 // Sync some things, but not passwords. Shouldn't send anything since |
159 // password generation is disabled by default. | 159 // password generation is disabled by default. |
160 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( | 160 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( |
161 profile()); | 161 profile()); |
162 sync_service->SetSyncSetupCompleted(); | 162 sync_service->SetSyncSetupCompleted(); |
163 syncer::ModelTypeSet preferred_set; | 163 syncer::ModelTypeSet preferred_set; |
164 preferred_set.Put(syncer::EXTENSIONS); | 164 preferred_set.Put(syncer::EXTENSIONS); |
165 preferred_set.Put(syncer::PREFERENCES); | 165 preferred_set.Put(syncer::PREFERENCES); |
166 sync_service->ChangePreferredDataTypes(preferred_set); | 166 sync_service->ChangePreferredDataTypes(preferred_set); |
167 syncer::ModelTypeSet new_set = sync_service->GetPreferredDataTypes(); | 167 syncer::ModelTypeSet new_set = sync_service->GetActiveDataTypes(); |
168 UpdateState(false); | 168 UpdateState(false); |
169 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); | 169 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); |
170 | 170 |
171 // Now sync passwords. | 171 // Now sync passwords. |
172 preferred_set.Put(syncer::PASSWORDS); | 172 preferred_set.Put(syncer::PASSWORDS); |
173 sync_service->ChangePreferredDataTypes(preferred_set); | 173 sync_service->ChangePreferredDataTypes(preferred_set); |
174 UpdateState(false); | 174 UpdateState(false); |
175 EXPECT_EQ(1u, password_generation_manager_->GetSentStates().size()); | 175 EXPECT_EQ(1u, password_generation_manager_->GetSentStates().size()); |
176 EXPECT_TRUE(password_generation_manager_->GetSentStates()[0]); | 176 EXPECT_TRUE(password_generation_manager_->GetSentStates()[0]); |
177 password_generation_manager_->ClearSentStates(); | 177 password_generation_manager_->ClearSentStates(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); | 212 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); |
213 // Always set password generation enabled check box so we can test the | 213 // Always set password generation enabled check box so we can test the |
214 // behavior of password sync. | 214 // behavior of password sync. |
215 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); | 215 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); |
216 | 216 |
217 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs()); | 217 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs()); |
218 sync_prefs.SetSyncSetupCompleted(); | 218 sync_prefs.SetSyncSetupCompleted(); |
219 UpdateState(false); | 219 UpdateState(false); |
220 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); | 220 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); |
221 } | 221 } |
OLD | NEW |