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

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

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix handing of guest user ID. Created 7 years, 2 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/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/policy/device_local_account.h" 10 #include "chrome/browser/chromeos/policy/device_local_account.h"
12 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" 11 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h"
13 #include "chrome/browser/chromeos/settings/cros_settings.h" 12 #include "chrome/browser/chromeos/settings/cros_settings.h"
14 #include "chrome/browser/chromeos/settings/device_settings_service.h" 13 #include "chrome/browser/chromeos/settings/device_settings_service.h"
15 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 14 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
16 #include "chrome/browser/policy/cloud/cloud_policy_client.h" 15 #include "chrome/browser/policy/cloud/cloud_policy_client.h"
17 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
18 #include "chrome/browser/policy/cloud/cloud_policy_service.h" 17 #include "chrome/browser/policy/cloud/cloud_policy_service.h"
19 #include "chrome/browser/policy/cloud/mock_device_management_service.h" 18 #include "chrome/browser/policy/cloud/mock_device_management_service.h"
20 #include "chrome/browser/policy/cloud/policy_builder.h" 19 #include "chrome/browser/policy/cloud/policy_builder.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 expected_policy_map_.Set(key::kShowLogoutButtonInTray, 72 expected_policy_map_.Set(key::kShowLogoutButtonInTray,
74 POLICY_LEVEL_MANDATORY, 73 POLICY_LEVEL_MANDATORY,
75 POLICY_SCOPE_USER, 74 POLICY_SCOPE_USER,
76 Value::CreateBooleanValue(true), 75 Value::CreateBooleanValue(true),
77 NULL); 76 NULL);
78 expected_policy_map_.Set(key::kFullscreenAllowed, 77 expected_policy_map_.Set(key::kFullscreenAllowed,
79 POLICY_LEVEL_MANDATORY, 78 POLICY_LEVEL_MANDATORY,
80 POLICY_SCOPE_USER, 79 POLICY_SCOPE_USER,
81 Value::CreateBooleanValue(false), 80 Value::CreateBooleanValue(false),
82 NULL); 81 NULL);
83 scoped_ptr<base::ListValue> allowed_extension_types(new base::ListValue());
84 allowed_extension_types->AppendString("hosted_app");
85 expected_policy_map_.Set(key::kExtensionAllowedTypes,
86 POLICY_LEVEL_MANDATORY,
87 POLICY_SCOPE_USER,
88 allowed_extension_types.release(),
89 NULL);
90 82
91 // Explicitly set value. 83 // Explicitly set value.
92 expected_policy_map_.Set(key::kDisableSpdy, 84 expected_policy_map_.Set(key::kDisableSpdy,
93 POLICY_LEVEL_MANDATORY, 85 POLICY_LEVEL_MANDATORY,
94 POLICY_SCOPE_USER, 86 POLICY_SCOPE_USER,
95 Value::CreateBooleanValue(true), 87 Value::CreateBooleanValue(true),
96 NULL); 88 NULL);
97 89
98 device_local_account_policy_.payload().mutable_disablespdy()->set_value( 90 device_local_account_policy_.payload().mutable_disablespdy()->set_value(
99 true); 91 true);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 NULL); 487 NULL);
496 EXPECT_TRUE(expected_policy_bundle.Equals(provider_.policies())); 488 EXPECT_TRUE(expected_policy_bundle.Equals(provider_.policies()));
497 489
498 // Any values set for the |ShelfAutoHideBehavior|, |ShowLogoutButtonInTray| 490 // Any values set for the |ShelfAutoHideBehavior|, |ShowLogoutButtonInTray|
499 // and |ExtensionAllowedTypes| policies should be overridden. 491 // and |ExtensionAllowedTypes| policies should be overridden.
500 EXPECT_CALL(provider_observer_, OnUpdatePolicy(&provider_)).Times(AtLeast(1)); 492 EXPECT_CALL(provider_observer_, OnUpdatePolicy(&provider_)).Times(AtLeast(1));
501 device_local_account_policy_.payload().mutable_shelfautohidebehavior()-> 493 device_local_account_policy_.payload().mutable_shelfautohidebehavior()->
502 set_value("Always"); 494 set_value("Always");
503 device_local_account_policy_.payload().mutable_showlogoutbuttonintray()-> 495 device_local_account_policy_.payload().mutable_showlogoutbuttonintray()->
504 set_value(false); 496 set_value(false);
505 device_local_account_policy_.payload().mutable_extensionallowedtypes()->
506 mutable_value()->mutable_entries()->Clear();
507 device_local_account_policy_.Build(); 497 device_local_account_policy_.Build();
508 device_settings_test_helper_.set_device_local_account_policy_blob( 498 device_settings_test_helper_.set_device_local_account_policy_blob(
509 PolicyBuilder::kFakeUsername, device_local_account_policy_.GetBlob()); 499 PolicyBuilder::kFakeUsername, device_local_account_policy_.GetBlob());
510 broker->core()->store()->Load(); 500 broker->core()->store()->Load();
511 FlushDeviceSettings(); 501 FlushDeviceSettings();
512 Mock::VerifyAndClearExpectations(&provider_observer_); 502 Mock::VerifyAndClearExpectations(&provider_observer_);
513 EXPECT_TRUE(expected_policy_bundle.Equals(provider_.policies())); 503 EXPECT_TRUE(expected_policy_bundle.Equals(provider_.policies()));
514 504
515 // Account disappears, policy should stay in effect. 505 // Account disappears, policy should stay in effect.
516 EXPECT_CALL(provider_observer_, OnUpdatePolicy(&provider_)) 506 EXPECT_CALL(provider_observer_, OnUpdatePolicy(&provider_))
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 ASSERT_TRUE(request_job); 566 ASSERT_TRUE(request_job);
577 em::DeviceManagementResponse response; 567 em::DeviceManagementResponse response;
578 response.mutable_policy_response()->add_response()->CopyFrom( 568 response.mutable_policy_response()->add_response()->CopyFrom(
579 device_local_account_policy_.policy()); 569 device_local_account_policy_.policy());
580 request_job->SendResponse(DM_STATUS_SUCCESS, response); 570 request_job->SendResponse(DM_STATUS_SUCCESS, response);
581 FlushDeviceSettings(); 571 FlushDeviceSettings();
582 Mock::VerifyAndClearExpectations(&provider_observer_); 572 Mock::VerifyAndClearExpectations(&provider_observer_);
583 } 573 }
584 574
585 } // namespace policy 575 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698