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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_policy_service_unittest.cc

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 unified diff | Download patch | Annotate | Revision Log
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/policy/device_local_account_policy_service.h" 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" 10 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Value::CreateBooleanValue(true)); 75 Value::CreateBooleanValue(true));
76 76
77 device_local_account_policy_.payload().mutable_disablespdy()->set_value( 77 device_local_account_policy_.payload().mutable_disablespdy()->set_value(
78 true); 78 true);
79 device_local_account_policy_.policy_data().set_policy_type( 79 device_local_account_policy_.policy_data().set_policy_type(
80 dm_protocol::kChromePublicAccountPolicyType); 80 dm_protocol::kChromePublicAccountPolicyType);
81 device_local_account_policy_.policy_data().set_settings_entity_id( 81 device_local_account_policy_.policy_data().set_settings_entity_id(
82 PolicyBuilder::kFakeUsername); 82 PolicyBuilder::kFakeUsername);
83 device_local_account_policy_.Build(); 83 device_local_account_policy_.Build();
84 84
85 device_policy_.payload().mutable_device_local_accounts()->add_account()-> 85 em::DeviceLocalAccountInfoProto* account =
86 set_id(PolicyBuilder::kFakeUsername); 86 device_policy_.payload().mutable_device_local_accounts()->add_account();
87 account->set_account_id(PolicyBuilder::kFakeUsername);
88 account->set_type(
89 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_PUBLIC_SESSION);
87 device_policy_.Build(); 90 device_policy_.Build();
88 91
89 service_.AddObserver(&service_observer_); 92 service_.AddObserver(&service_observer_);
90 } 93 }
91 94
92 virtual void TearDown() OVERRIDE { 95 virtual void TearDown() OVERRIDE {
93 service_.RemoveObserver(&service_observer_); 96 service_.RemoveObserver(&service_observer_);
94 97
95 DeviceSettingsTestBase::TearDown(); 98 DeviceSettingsTestBase::TearDown();
96 } 99 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 Mock::VerifyAndClearExpectations(&service_observer_); 257 Mock::VerifyAndClearExpectations(&service_observer_);
255 } 258 }
256 259
257 TEST_F(DeviceLocalAccountPolicyServiceTest, DuplicateAccounts) { 260 TEST_F(DeviceLocalAccountPolicyServiceTest, DuplicateAccounts) {
258 InstallDevicePolicy(); 261 InstallDevicePolicy();
259 DeviceLocalAccountPolicyBroker* broker = 262 DeviceLocalAccountPolicyBroker* broker =
260 service_.GetBrokerForAccount(PolicyBuilder::kFakeUsername); 263 service_.GetBrokerForAccount(PolicyBuilder::kFakeUsername);
261 ASSERT_TRUE(broker); 264 ASSERT_TRUE(broker);
262 265
263 // Add a second entry with a duplicate account name to device policy. 266 // Add a second entry with a duplicate account name to device policy.
264 device_policy_.payload().mutable_device_local_accounts()->add_account()-> 267 em::DeviceLocalAccountInfoProto* account =
265 set_id(PolicyBuilder::kFakeUsername); 268 device_policy_.payload().mutable_device_local_accounts()->add_account();
269 account->set_account_id(PolicyBuilder::kFakeUsername);
270 account->set_type(
271 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_PUBLIC_SESSION);
266 device_policy_.Build(); 272 device_policy_.Build();
267 device_settings_test_helper_.set_device_local_account_policy_blob( 273 device_settings_test_helper_.set_device_local_account_policy_blob(
268 PolicyBuilder::kFakeUsername, device_local_account_policy_.GetBlob()); 274 PolicyBuilder::kFakeUsername, device_local_account_policy_.GetBlob());
269 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); 275 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
270 276
271 EXPECT_CALL(service_observer_, OnDeviceLocalAccountsChanged()); 277 EXPECT_CALL(service_observer_, OnDeviceLocalAccountsChanged());
272 EXPECT_CALL(service_observer_, OnPolicyUpdated(PolicyBuilder::kFakeUsername)); 278 EXPECT_CALL(service_observer_, OnPolicyUpdated(PolicyBuilder::kFakeUsername));
273 device_settings_service_.PropertyChangeComplete(true); 279 device_settings_service_.PropertyChangeComplete(true);
274 FlushDeviceSettings(); 280 FlushDeviceSettings();
275 Mock::VerifyAndClearExpectations(&service_observer_); 281 Mock::VerifyAndClearExpectations(&service_observer_);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 ASSERT_TRUE(request_job); 554 ASSERT_TRUE(request_job);
549 em::DeviceManagementResponse response; 555 em::DeviceManagementResponse response;
550 response.mutable_policy_response()->add_response()->CopyFrom( 556 response.mutable_policy_response()->add_response()->CopyFrom(
551 device_local_account_policy_.policy()); 557 device_local_account_policy_.policy());
552 request_job->SendResponse(DM_STATUS_SUCCESS, response); 558 request_job->SendResponse(DM_STATUS_SUCCESS, response);
553 FlushDeviceSettings(); 559 FlushDeviceSettings();
554 Mock::VerifyAndClearExpectations(&provider_observer_); 560 Mock::VerifyAndClearExpectations(&provider_observer_);
555 } 561 }
556 562
557 } // namespace policy 563 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698