OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 12 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 13 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 14 #include "chromeos/dbus/fake_session_manager_client.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 |
| 17 namespace chromeos { |
| 18 class MockDBusThreadManager; |
| 19 } |
| 20 |
| 21 namespace policy { |
| 22 |
| 23 // Used to test Device policy changes in Chrome OS. |
| 24 class DevicePolicyCrosBrowserTest : |
| 25 public chromeos::CrosInProcessBrowserTest { |
| 26 protected: |
| 27 DevicePolicyCrosBrowserTest(); |
| 28 virtual ~DevicePolicyCrosBrowserTest(); |
| 29 |
| 30 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 31 |
| 32 // Writes the owner key to disk. To be called before installing a policy. |
| 33 void InstallOwnerKey(); |
| 34 |
| 35 // Reinstalls |device_policy_| as the policy (to be used when it was |
| 36 // recently changed). |
| 37 void RefreshDevicePolicy(); |
| 38 |
| 39 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
| 40 |
| 41 chromeos::MockDBusThreadManager* mock_dbus_thread_manager() { |
| 42 return mock_dbus_thread_manager_; |
| 43 } |
| 44 |
| 45 chromeos::FakeSessionManagerClient* session_manager_client() { |
| 46 return &session_manager_client_; |
| 47 } |
| 48 |
| 49 DevicePolicyBuilder* device_policy() { return &device_policy_; } |
| 50 |
| 51 private: |
| 52 // Set additional expectations on |mock_dbus_thread_manager_| to suppress |
| 53 // gmock warnings. |
| 54 void SetMockDBusThreadManagerExpectations(); |
| 55 |
| 56 chromeos::MockDBusThreadManager* mock_dbus_thread_manager_; |
| 57 |
| 58 // Mock out policy loads/stores from/to the device. |
| 59 chromeos::FakeSessionManagerClient session_manager_client_; |
| 60 |
| 61 // Carries Chrome OS device policies for tests. |
| 62 DevicePolicyBuilder device_policy_; |
| 63 |
| 64 // Stores the device owner key. |
| 65 base::ScopedTempDir temp_dir_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest); |
| 68 }; |
| 69 |
| 70 } // namespace policy |
| 71 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ |
OLD | NEW |