Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc

Issue 14927015: Translate device-local account IDs to user IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed DeviceLocalAccountTest. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index c9eb07b773eaa44060b99968e3d680c3ea01ba48..28b2eefce0a39f188170606172aad6fefd0b1edd 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -13,6 +13,7 @@
#include "base/test/scoped_path_override.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/policy/device_local_account.h"
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
#include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
#include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
@@ -49,7 +50,7 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
new DeviceSettingsProvider(
base::Bind(&DeviceSettingsProviderTest::SettingChanged,
base::Unretained(this)),
- &device_settings_service_));
+ DeviceSettingsService::Get()));
Mock::VerifyAndClearExpectations(this);
}
@@ -141,7 +142,8 @@ TEST_F(DeviceSettingsProviderTest, SetPrefFailed) {
TEST_F(DeviceSettingsProviderTest, SetPrefSucceed) {
owner_key_util_->SetPrivateKey(device_policy_.signing_key());
- device_settings_service_.SetUsername(device_policy_.policy_data().username());
+ DeviceSettingsService::Get()->SetUsername(
+ device_policy_.policy_data().username());
FlushDeviceSettings();
base::FundamentalValue value(true);
@@ -155,8 +157,8 @@ TEST_F(DeviceSettingsProviderTest, SetPrefSucceed) {
FlushDeviceSettings();
// Verify that the device policy has been adjusted.
- ASSERT_TRUE(device_settings_service_.device_settings());
- EXPECT_TRUE(device_settings_service_.device_settings()->
+ ASSERT_TRUE(DeviceSettingsService::Get()->device_settings());
+ EXPECT_TRUE(DeviceSettingsService::Get()->device_settings()->
metrics_enabled().metrics_enabled());
// Verify the change has been applied.
@@ -169,7 +171,8 @@ TEST_F(DeviceSettingsProviderTest, SetPrefSucceed) {
TEST_F(DeviceSettingsProviderTest, SetPrefTwice) {
owner_key_util_->SetPrivateKey(device_policy_.signing_key());
- device_settings_service_.SetUsername(device_policy_.policy_data().username());
+ DeviceSettingsService::Get()->SetUsername(
+ device_policy_.policy_data().username());
FlushDeviceSettings();
EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber());
@@ -198,7 +201,7 @@ TEST_F(DeviceSettingsProviderTest, PolicyRetrievalFailedBadSignature) {
// Verify that the cached settings blob is not "trusted".
EXPECT_EQ(DeviceSettingsService::STORE_VALIDATION_ERROR,
- device_settings_service_.status());
+ DeviceSettingsService::Get()->status());
EXPECT_EQ(CrosSettingsProvider::PERMANENTLY_UNTRUSTED,
provider_->PrepareTrustedValues(base::Closure()));
}
@@ -210,7 +213,7 @@ TEST_F(DeviceSettingsProviderTest, PolicyRetrievalNoPolicy) {
// Verify that the cached settings blob is not "trusted".
EXPECT_EQ(DeviceSettingsService::STORE_NO_POLICY,
- device_settings_service_.status());
+ DeviceSettingsService::Get()->status());
EXPECT_EQ(CrosSettingsProvider::PERMANENTLY_UNTRUSTED,
provider_->PrepareTrustedValues(base::Closure()));
}
@@ -280,7 +283,7 @@ TEST_F(DeviceSettingsProviderTest, LegacyDeviceLocalAccounts) {
entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId,
policy::PolicyBuilder::kFakeUsername);
entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType,
- DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION);
+ policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION);
expected_accounts.Append(entry_dict.release());
const base::Value* actual_accounts =
provider_->Get(kAccountsPrefDeviceLocalAccounts);

Powered by Google App Engine
This is Rietveld 408576698