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