OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
10 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 12 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 class FakeSessionManagerClient; | 17 class FakeSessionManagerClient; |
16 } | 18 } |
17 | 19 |
18 namespace policy { | 20 namespace policy { |
19 | 21 |
20 class DevicePolicyCrosTestHelper { | 22 class DevicePolicyCrosTestHelper { |
21 public: | 23 public: |
22 DevicePolicyCrosTestHelper(); | 24 DevicePolicyCrosTestHelper(); |
23 ~DevicePolicyCrosTestHelper(); | 25 ~DevicePolicyCrosTestHelper(); |
24 | 26 |
25 // Marks the device as enterprise-owned. Must be called to make device | 27 // 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 | 28 // policies apply Chrome-wide. If this is not called, device policies will |
27 // affect CrosSettings only. | 29 // affect CrosSettings only. |
| 30 static void MarkAsEnterpriseOwnedBy(const std::string& user_name); |
28 void MarkAsEnterpriseOwned(); | 31 void MarkAsEnterpriseOwned(); |
29 | 32 |
30 // Writes the owner key to disk. To be called before installing a policy. | 33 // Writes the owner key to disk. To be called before installing a policy. |
31 void InstallOwnerKey(); | 34 void InstallOwnerKey(); |
32 | 35 |
33 DevicePolicyBuilder* device_policy() { return &device_policy_; } | 36 DevicePolicyBuilder* device_policy() { return &device_policy_; } |
34 | 37 |
35 private: | 38 private: |
36 void OverridePaths(); | 39 static void OverridePaths(); |
37 | 40 |
38 // Carries Chrome OS device policies for tests. | 41 // Carries Chrome OS device policies for tests. |
39 DevicePolicyBuilder device_policy_; | 42 DevicePolicyBuilder device_policy_; |
40 | 43 |
41 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosTestHelper); | 44 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosTestHelper); |
42 }; | 45 }; |
43 | 46 |
44 // Used to test Device policy changes in Chrome OS. | 47 // Used to test Device policy changes in Chrome OS. |
45 class DevicePolicyCrosBrowserTest : public InProcessBrowserTest { | 48 class DevicePolicyCrosBrowserTest : public InProcessBrowserTest { |
46 protected: | 49 protected: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // FakeDBusThreadManager uses FakeSessionManagerClient. | 81 // FakeDBusThreadManager uses FakeSessionManagerClient. |
79 scoped_ptr<chromeos::DBusThreadManagerSetter> dbus_setter_; | 82 scoped_ptr<chromeos::DBusThreadManagerSetter> dbus_setter_; |
80 chromeos::FakeSessionManagerClient* fake_session_manager_client_; | 83 chromeos::FakeSessionManagerClient* fake_session_manager_client_; |
81 | 84 |
82 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest); | 85 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest); |
83 }; | 86 }; |
84 | 87 |
85 } // namespace policy | 88 } // namespace policy |
86 | 89 |
87 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
OLD | NEW |