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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc

Issue 2230533002: Delete dead consumer enrollment code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/settings/device_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, 403 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId,
404 policy::PolicyBuilder::kFakeUsername); 404 policy::PolicyBuilder::kFakeUsername);
405 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, 405 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType,
406 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); 406 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION);
407 expected_accounts.Append(entry_dict.release()); 407 expected_accounts.Append(entry_dict.release());
408 const base::Value* actual_accounts = 408 const base::Value* actual_accounts =
409 provider_->Get(kAccountsPrefDeviceLocalAccounts); 409 provider_->Get(kAccountsPrefDeviceLocalAccounts);
410 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); 410 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts));
411 } 411 }
412 412
413 TEST_F(DeviceSettingsProviderTest, OwnerIsStillSetWhenDeviceIsConsumerManaged) {
414 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey());
415 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()),
416 true);
417 device_policy_.policy_data().set_management_mode(
418 em::PolicyData::CONSUMER_MANAGED);
419 device_policy_.policy_data().set_request_token("test request token");
420 device_policy_.Build();
421 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
422 FlushDeviceSettings();
423
424 // Expect that kDeviceOwner is not empty.
425 const base::Value* value = provider_->Get(kDeviceOwner);
426 ASSERT_TRUE(value);
427 std::string string_value;
428 EXPECT_TRUE(value->GetAsString(&string_value));
429 EXPECT_FALSE(string_value.empty());
430 }
431
432 TEST_F(DeviceSettingsProviderTest, DecodeDeviceState) { 413 TEST_F(DeviceSettingsProviderTest, DecodeDeviceState) {
433 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); 414 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
434 device_policy_.policy_data().mutable_device_state()->set_device_mode( 415 device_policy_.policy_data().mutable_device_state()->set_device_mode(
435 em::DeviceState::DEVICE_MODE_DISABLED); 416 em::DeviceState::DEVICE_MODE_DISABLED);
436 device_policy_.policy_data().mutable_device_state()-> 417 device_policy_.policy_data().mutable_device_state()->
437 mutable_disabled_state()->set_message(kDisabledMessage); 418 mutable_disabled_state()->set_message(kDisabledMessage);
438 device_policy_.Build(); 419 device_policy_.Build();
439 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); 420 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
440 ReloadDeviceSettings(); 421 ReloadDeviceSettings();
441 Mock::VerifyAndClearExpectations(this); 422 Mock::VerifyAndClearExpectations(this);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 483 }
503 484
504 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { 485 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) {
505 SetLogUploadSettings(true); 486 SetLogUploadSettings(true);
506 VerifyLogUploadSettings(true); 487 VerifyLogUploadSettings(true);
507 488
508 SetLogUploadSettings(false); 489 SetLogUploadSettings(false);
509 VerifyLogUploadSettings(false); 490 VerifyLogUploadSettings(false);
510 } 491 }
511 } // namespace chromeos 492 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_provider.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698