blob: f155f6c2f1a232179d2e6f6fc8e2f8d3c75d91be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/user_manager/user_manager.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace em = enterprise_management;
namespace chromeos {
class LoginScreenPolicyTest : public policy::DevicePolicyCrosBrowserTest {
virtual void SetUpCommandLine(CommandLine* command_line) override {
command_line->AppendSwitch(switches::kLoginManager);
}
virtual void SetUpInProcessBrowserTestFixture() override {
InstallOwnerKey();
MarkAsEnterpriseOwned();
DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
}
};
IN_PROC_BROWSER_TEST_F(LoginScreenPolicyTest, DisableSupervisedUsers) {
EXPECT_FALSE(user_manager::UserManager::Get()->AreSupervisedUsersAllowed());
scoped_refptr<content::MessageLoopRunner> runner(
new content::MessageLoopRunner);
scoped_ptr<CrosSettings::ObserverSubscription> subscription(
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kAccountsPrefSupervisedUsersEnabled,
runner->QuitClosure()));
em::ChromeDeviceSettingsProto& proto(device_policy()->payload());
proto.mutable_supervised_users_settings()->set_supervised_users_enabled(true);
RefreshDevicePolicy();
runner->Run();
EXPECT_TRUE(user_manager::UserManager::Get()->AreSupervisedUsersAllowed());
}
} // namespace chromeos
|