Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / device_policy_cros_browser_test.h
blobe6e90a9eedc2346dcb235823783ecd5c9f87b00d
1 // Copyright (c) 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
14 namespace chromeos {
15 class FakeSessionManagerClient;
18 namespace policy {
20 class DevicePolicyCrosTestHelper {
21 public:
22 DevicePolicyCrosTestHelper();
23 ~DevicePolicyCrosTestHelper();
25 // Marks the device as enterprise-owned. Must be called to make device
26 // policies apply Chrome-wide. If this is not called, device policies will
27 // affect CrosSettings only.
28 void MarkAsEnterpriseOwned();
30 // Writes the owner key to disk. To be called before installing a policy.
31 void InstallOwnerKey();
33 DevicePolicyBuilder* device_policy() { return &device_policy_; }
35 private:
36 void OverridePaths();
38 // Carries Chrome OS device policies for tests.
39 DevicePolicyBuilder device_policy_;
41 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosTestHelper);
44 // Used to test Device policy changes in Chrome OS.
45 class DevicePolicyCrosBrowserTest : public InProcessBrowserTest {
46 protected:
47 DevicePolicyCrosBrowserTest();
48 ~DevicePolicyCrosBrowserTest() override;
50 void SetUpInProcessBrowserTestFixture() override;
51 void TearDownInProcessBrowserTestFixture() override;
53 // Marks the device as enterprise-owned. Must be called to make device
54 // policies apply Chrome-wide. If this is not called, device policies will
55 // affect CrosSettings only.
56 void MarkAsEnterpriseOwned();
58 // Writes the owner key to disk. To be called before installing a policy.
59 void InstallOwnerKey();
61 // Reinstalls |device_policy_| as the policy (to be used when it was
62 // recently changed).
63 void RefreshDevicePolicy();
65 chromeos::DBusThreadManagerSetter* dbus_setter() {
66 return dbus_setter_.get();
69 chromeos::FakeSessionManagerClient* session_manager_client() {
70 return fake_session_manager_client_;
73 DevicePolicyBuilder* device_policy() { return test_helper_.device_policy(); }
75 private:
76 DevicePolicyCrosTestHelper test_helper_;
78 // FakeDBusThreadManager uses FakeSessionManagerClient.
79 scoped_ptr<chromeos::DBusThreadManagerSetter> dbus_setter_;
80 chromeos::FakeSessionManagerClient* fake_session_manager_client_;
82 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest);
85 } // namespace policy
87 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_