OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
10 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 10 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
11 #include "chrome/test/base/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace policy { | 14 namespace policy { |
15 namespace { | 15 namespace { |
16 | 16 |
17 // A test fixture simulating a browser that is already managed. | 17 // A test fixture simulating a browser that is already managed. |
18 class DeviceCloudPolicyManagedBrowserTest : public DevicePolicyCrosBrowserTest { | 18 class DeviceCloudPolicyManagedBrowserTest : public DevicePolicyCrosBrowserTest { |
19 protected: | 19 protected: |
20 DeviceCloudPolicyManagedBrowserTest() {} | 20 DeviceCloudPolicyManagedBrowserTest() {} |
21 | 21 |
22 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 22 virtual void SetUpInProcessBrowserTestFixture() override { |
23 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 23 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
24 InstallOwnerKey(); | 24 InstallOwnerKey(); |
25 MarkAsEnterpriseOwned(); | 25 MarkAsEnterpriseOwned(); |
26 RefreshDevicePolicy(); | 26 RefreshDevicePolicy(); |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagedBrowserTest); | 30 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagedBrowserTest); |
31 }; | 31 }; |
32 | 32 |
33 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyManagedBrowserTest, NoInitializer) { | 33 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyManagedBrowserTest, NoInitializer) { |
34 BrowserPolicyConnectorChromeOS* connector = | 34 BrowserPolicyConnectorChromeOS* connector = |
35 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 35 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
36 EXPECT_FALSE(connector->GetDeviceCloudPolicyInitializer()); | 36 EXPECT_FALSE(connector->GetDeviceCloudPolicyInitializer()); |
37 } | 37 } |
38 | 38 |
39 // A test fixture simulating a browser that is still unmanaged. | 39 // A test fixture simulating a browser that is still unmanaged. |
40 class DeviceCloudPolicyUnmanagedBrowserTest | 40 class DeviceCloudPolicyUnmanagedBrowserTest |
41 : public DevicePolicyCrosBrowserTest { | 41 : public DevicePolicyCrosBrowserTest { |
42 protected: | 42 protected: |
43 DeviceCloudPolicyUnmanagedBrowserTest() {} | 43 DeviceCloudPolicyUnmanagedBrowserTest() {} |
44 | 44 |
45 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 45 virtual void SetUpInProcessBrowserTestFixture() override { |
46 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 46 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyUnmanagedBrowserTest); | 50 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyUnmanagedBrowserTest); |
51 }; | 51 }; |
52 | 52 |
53 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyUnmanagedBrowserTest, | 53 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyUnmanagedBrowserTest, |
54 StillHasInitializer) { | 54 StillHasInitializer) { |
55 BrowserPolicyConnectorChromeOS* connector = | 55 BrowserPolicyConnectorChromeOS* connector = |
56 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 56 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
57 EXPECT_TRUE(connector->GetDeviceCloudPolicyInitializer()); | 57 EXPECT_TRUE(connector->GetDeviceCloudPolicyInitializer()); |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 } // namespace policy | 61 } // namespace policy |
OLD | NEW |