Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / chromeos / login / login_screen_policy_browsertest.cc
blob2afb4b3cde396b3af26406f87fd259f91e31f228
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/memory/ref_counted.h"
7 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
8 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
9 #include "chrome/browser/chromeos/settings/cros_settings.h"
10 #include "chromeos/chromeos_switches.h"
11 #include "chromeos/settings/cros_settings_names.h"
12 #include "components/user_manager/user_manager.h"
13 #include "content/public/test/test_utils.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h"
17 namespace em = enterprise_management;
19 namespace chromeos {
21 class LoginScreenPolicyTest : public policy::DevicePolicyCrosBrowserTest {
22 void SetUpCommandLine(base::CommandLine* command_line) override {
23 command_line->AppendSwitch(switches::kLoginManager);
26 void SetUpInProcessBrowserTestFixture() override {
27 InstallOwnerKey();
28 MarkAsEnterpriseOwned();
29 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
33 IN_PROC_BROWSER_TEST_F(LoginScreenPolicyTest, DisableSupervisedUsers) {
34 EXPECT_FALSE(user_manager::UserManager::Get()->AreSupervisedUsersAllowed());
36 scoped_refptr<content::MessageLoopRunner> runner(
37 new content::MessageLoopRunner);
38 scoped_ptr<CrosSettings::ObserverSubscription> subscription(
39 chromeos::CrosSettings::Get()->AddSettingsObserver(
40 chromeos::kAccountsPrefSupervisedUsersEnabled,
41 runner->QuitClosure()));
43 em::ChromeDeviceSettingsProto& proto(device_policy()->payload());
44 proto.mutable_supervised_users_settings()->set_supervised_users_enabled(true);
45 RefreshDevicePolicy();
47 runner->Run();
49 EXPECT_TRUE(user_manager::UserManager::Get()->AreSupervisedUsersAllowed());
52 } // namespace chromeos