| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 ProfileSyncServiceMock* mock_sync_service = | 363 ProfileSyncServiceMock* mock_sync_service = |
| 364 static_cast<ProfileSyncServiceMock*>( | 364 static_cast<ProfileSyncServiceMock*>( |
| 365 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 365 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 366 profile(), ProfileSyncServiceMock::BuildMockProfileSyncService)); | 366 profile(), ProfileSyncServiceMock::BuildMockProfileSyncService)); |
| 367 | 367 |
| 368 syncer::ModelTypeSet active_types; | 368 syncer::ModelTypeSet active_types; |
| 369 active_types.Put(syncer::PASSWORDS); | 369 active_types.Put(syncer::PASSWORDS); |
| 370 EXPECT_CALL(*mock_sync_service, HasSyncSetupCompleted()) | 370 EXPECT_CALL(*mock_sync_service, HasSyncSetupCompleted()) |
| 371 .WillRepeatedly(Return(true)); | 371 .WillRepeatedly(Return(true)); |
| 372 EXPECT_CALL(*mock_sync_service, SyncActive()).WillRepeatedly(Return(true)); | 372 EXPECT_CALL(*mock_sync_service, IsSyncActive()).WillRepeatedly(Return(true)); |
| 373 EXPECT_CALL(*mock_sync_service, GetActiveDataTypes()) | 373 EXPECT_CALL(*mock_sync_service, GetActiveDataTypes()) |
| 374 .WillRepeatedly(Return(active_types)); | 374 .WillRepeatedly(Return(active_types)); |
| 375 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) | 375 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) |
| 376 .WillRepeatedly(Return(false)); | 376 .WillRepeatedly(Return(false)); |
| 377 | 377 |
| 378 // Passwords are syncing and custom passphrase isn't used. | 378 // Passwords are syncing and custom passphrase isn't used. |
| 379 EXPECT_EQ(password_manager::SYNCING_NORMAL_ENCRYPTION, | 379 EXPECT_EQ(password_manager::SYNCING_NORMAL_ENCRYPTION, |
| 380 client->GetPasswordSyncState()); | 380 client->GetPasswordSyncState()); |
| 381 | 381 |
| 382 // Again, using a custom passphrase. | 382 // Again, using a custom passphrase. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 profile()->ForceIncognito(true); | 460 profile()->ForceIncognito(true); |
| 461 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); | 461 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); |
| 462 | 462 |
| 463 // Functionality disabled in Incognito mode also when manager itself is | 463 // Functionality disabled in Incognito mode also when manager itself is |
| 464 // enabled. | 464 // enabled. |
| 465 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, | 465 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, |
| 466 new base::FundamentalValue(true)); | 466 new base::FundamentalValue(true)); |
| 467 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); | 467 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); |
| 468 profile()->ForceIncognito(false); | 468 profile()->ForceIncognito(false); |
| 469 } | 469 } |
| OLD | NEW |