Chromium Code Reviews| Index: chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc |
| diff --git a/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc |
| index c3dcd6efa41dae8ac656587166be77daf17e635f..85ea44536ca2d409cb5ac7f4a7c98a8eb4e36832 100644 |
| --- a/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc |
| +++ b/chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc |
| @@ -22,7 +22,7 @@ |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| -#include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
|
bartfab (slow)
2015/03/31 14:12:39
Nit: Still used in line 440.
|
| +#include "chrome/browser/chromeos/settings/settings_provider_test_base.h" |
| #include "chrome/test/base/testing_browser_process.h" |
| #include "chrome/test/base/testing_profile.h" |
| #include "chrome/test/base/testing_profile_manager.h" |
| @@ -127,10 +127,12 @@ scoped_ptr<crypto::RSAPrivateKey> CreateOwnerKeyInSlot(PK11SlotInfo* slot) { |
| } // namespace |
| -class CryptohomeAuthenticatorTest : public testing::Test { |
| +class CryptohomeAuthenticatorTest : public testing::Test, |
| + public chromeos::SettingsProviderTestBase { |
|
bartfab (slow)
2015/03/31 14:12:39
Nit: s/chromeos:://
|
| public: |
| CryptohomeAuthenticatorTest() |
| - : user_context_("me@nowhere.org"), |
| + : chromeos::SettingsProviderTestBase(false), |
|
bartfab (slow)
2015/03/31 14:12:40
Nit: s/chromeos:://
|
| + user_context_("me@nowhere.org"), |
| user_manager_(new user_manager::FakeUserManager()), |
| user_manager_enabler_(user_manager_), |
| mock_caller_(NULL), |
| @@ -434,15 +436,8 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededFailedMount) { |
| // and succeeded but we are in safe mode and the current user is not owner. |
| state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| SetOwnerState(false, false); |
| - // Remove the real DeviceSettingsProvider and replace it with a stub. |
| - CrosSettingsProvider* device_settings_provider = |
| - CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); |
| - EXPECT_TRUE(device_settings_provider != NULL); |
| - EXPECT_TRUE( |
| - CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); |
| - StubCrosSettingsProvider stub_settings_provider; |
| - CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); |
| - CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); |
| + ReplaceProvider(kPolicyMissingMitigationMode); |
| + stub_settings_provider_.SetBoolean(kPolicyMissingMitigationMode, true); |
| // Initialize login state for this test to verify the login state is changed |
| // to SAFE_MODE. |
| @@ -468,9 +463,7 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededFailedMount) { |
| // Unset global objects used by this test. |
| fake_cryptohome_client_->set_unmount_result(true); |
| LoginState::Shutdown(); |
| - EXPECT_TRUE( |
| - CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); |
| - CrosSettings::Get()->AddSettingsProvider(device_settings_provider); |
| + RestoreProvider(); |
| } |
| // Test the case that login switches to SafeMode and the Owner logs in, which |
| @@ -493,15 +486,8 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededSuccess) { |
| // and succeeded but we are in safe mode and the current user is not owner. |
| state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| SetOwnerState(false, false); |
| - // Remove the real DeviceSettingsProvider and replace it with a stub. |
| - CrosSettingsProvider* device_settings_provider = |
| - CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); |
| - EXPECT_TRUE(device_settings_provider != NULL); |
| - EXPECT_TRUE( |
| - CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); |
| - StubCrosSettingsProvider stub_settings_provider; |
| - CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); |
| - CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); |
| + ReplaceProvider(kPolicyMissingMitigationMode); |
| + stub_settings_provider_.SetBoolean(kPolicyMissingMitigationMode, true); |
| // Initialize login state for this test to verify the login state is changed |
| // to SAFE_MODE. |
| @@ -526,9 +512,7 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededSuccess) { |
| // Unset global objects used by this test. |
| fake_cryptohome_client_->set_unmount_result(true); |
| LoginState::Shutdown(); |
| - EXPECT_TRUE( |
| - CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); |
| - CrosSettings::Get()->AddSettingsProvider(device_settings_provider); |
| + RestoreProvider(); |
| } |
| TEST_F(CryptohomeAuthenticatorTest, DriveFailedMount) { |