| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 TEST_F(ChromePasswordManagerClientTest, | 213 TEST_F(ChromePasswordManagerClientTest, |
| 214 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { | 214 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { |
| 215 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); | 215 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 TEST_F(ChromePasswordManagerClientTest, | 218 TEST_F(ChromePasswordManagerClientTest, |
| 219 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) { | 219 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) { |
| 220 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 220 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 221 password_manager::switches::kEnableAutomaticPasswordSaving); | 221 password_manager::switches::kEnableAutomaticPasswordSaving); |
| 222 if (chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_UNKNOWN) | 222 if (chrome::VersionInfo::GetChannel() == version_info::Channel::UNKNOWN) |
| 223 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled()); | 223 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 224 else | 224 else |
| 225 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); | 225 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 TEST_F(ChromePasswordManagerClientTest, LogToAReceiver) { | 228 TEST_F(ChromePasswordManagerClientTest, LogToAReceiver) { |
| 229 ChromePasswordManagerClient* client = GetClient(); | 229 ChromePasswordManagerClient* client = GetClient(); |
| 230 service_->RegisterReceiver(&receiver_); | 230 service_->RegisterReceiver(&receiver_); |
| 231 EXPECT_TRUE(client->IsLoggingActive()); | 231 EXPECT_TRUE(client->IsLoggingActive()); |
| 232 | 232 |
| (...skipping 227 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 |