Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/chromeos/policy/device_policy_cros_browser_test.h

Issue 16658015: Add device policies to control accessibility settings on the login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed leaky tests. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/files/scoped_temp_dir.h"
11 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 11 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
12 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 12 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
13 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 13 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
14 #include "chromeos/dbus/fake_session_manager_client.h" 14 #include "chromeos/dbus/fake_session_manager_client.h"
15 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" 15 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace policy { 18 namespace policy {
19 19
20 // Used to test Device policy changes in Chrome OS. 20 // Used to test Device policy changes in Chrome OS.
21 class DevicePolicyCrosBrowserTest : 21 class DevicePolicyCrosBrowserTest :
22 public chromeos::CrosInProcessBrowserTest { 22 public chromeos::CrosInProcessBrowserTest {
23 public:
24 // Marks the device as enterprise-owned. Must be called to make device
25 // policies apply Chrome-wide. If this is not called, device policies will
26 // affect CrosSettings only.
27 static void MarkAsEnterpriseOwned(base::ScopedTempDir* temp_dir);
28
23 protected: 29 protected:
24 DevicePolicyCrosBrowserTest(); 30 DevicePolicyCrosBrowserTest();
25 virtual ~DevicePolicyCrosBrowserTest(); 31 virtual ~DevicePolicyCrosBrowserTest();
26 32
27 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 33 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
28 34
29 // Writes the owner key to disk. To be called before installing a policy. 35 // Writes the owner key to disk. To be called before installing a policy.
30 void InstallOwnerKey(); 36 void InstallOwnerKey();
31 37
32 // Reinstalls |device_policy_| as the policy (to be used when it was 38 // Reinstalls |device_policy_| as the policy (to be used when it was
33 // recently changed). 39 // recently changed).
34 void RefreshDevicePolicy(); 40 void RefreshDevicePolicy();
35 41
36 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; 42 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE;
37 43
38 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager() { 44 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager() {
39 return mock_dbus_thread_manager_; 45 return mock_dbus_thread_manager_;
40 } 46 }
41 47
42 chromeos::FakeSessionManagerClient* session_manager_client() { 48 chromeos::FakeSessionManagerClient* session_manager_client() {
43 return mock_dbus_thread_manager_->fake_session_manager_client(); 49 return mock_dbus_thread_manager_->fake_session_manager_client();
44 } 50 }
45 51
46 DevicePolicyBuilder* device_policy() { return &device_policy_; } 52 DevicePolicyBuilder* device_policy() { return &device_policy_; }
47 53
54 // Stores the device owner key and the install attributes.
55 base::ScopedTempDir temp_dir_;
56
48 private: 57 private:
49 // MockDBusThreadManagerWithoutGMock uses FakeSessionManagerClient. 58 // MockDBusThreadManagerWithoutGMock uses FakeSessionManagerClient.
50 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager_; 59 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager_;
51 60
52 // Carries Chrome OS device policies for tests. 61 // Carries Chrome OS device policies for tests.
53 DevicePolicyBuilder device_policy_; 62 DevicePolicyBuilder device_policy_;
54 63
55 // Stores the device owner key.
56 base::ScopedTempDir temp_dir_;
57
58 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest); 64 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCrosBrowserTest);
59 }; 65 };
60 66
61 } // namespace policy 67 } // namespace policy
62 68
63 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_POLICY_CROS_BROWSER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698