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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 using testing::InvokeWithoutArgs; | 45 using testing::InvokeWithoutArgs; |
46 using testing::Mock; | 46 using testing::Mock; |
47 using testing::Return; | 47 using testing::Return; |
48 using testing::_; | 48 using testing::_; |
49 | 49 |
50 namespace em = enterprise_management; | 50 namespace em = enterprise_management; |
51 | 51 |
52 namespace policy { | 52 namespace policy { |
53 | 53 |
54 namespace { | |
55 | |
56 const char kDMToken[] = "dmtoken"; | 54 const char kDMToken[] = "dmtoken"; |
57 const char kDeviceID[] = "deviceid"; | 55 const char kDeviceID[] = "deviceid"; |
58 | 56 |
59 const char kTestExtension[] = "kjmkgkdkpedkejedfhmfcenooemhbpbo"; | 57 const char kTestExtension[] = "kjmkgkdkpedkejedfhmfcenooemhbpbo"; |
60 const char kTestExtension2[] = "behllobkkfkfnphdnhnkndlbkcpglgmj"; | |
61 | 58 |
62 const base::FilePath::CharType kTestExtensionPath[] = | 59 const base::FilePath::CharType kTestExtensionPath[] = |
63 FILE_PATH_LITERAL("extensions/managed_extension"); | 60 FILE_PATH_LITERAL("extensions/managed_extension"); |
64 const base::FilePath::CharType kTestExtension2Path[] = | |
65 FILE_PATH_LITERAL("extensions/managed_extension2"); | |
66 | 61 |
67 const char kTestPolicy[] = | 62 const char kTestPolicy[] = |
68 "{" | 63 "{" |
69 " \"Name\": {" | 64 " \"Name\": {" |
70 " \"Value\": \"disable_all_the_things\"" | 65 " \"Value\": \"disable_all_the_things\"" |
71 " }" | 66 " }" |
72 "}"; | 67 "}"; |
73 | 68 |
| 69 #if defined(OS_CHROMEOS) |
| 70 const char kTestExtension2[] = "behllobkkfkfnphdnhnkndlbkcpglgmj"; |
| 71 const base::FilePath::CharType kTestExtension2Path[] = |
| 72 FILE_PATH_LITERAL("extensions/managed_extension2"); |
| 73 |
74 const char kTestPolicyJSON[] = "{\"Name\":\"disable_all_the_things\"}"; | 74 const char kTestPolicyJSON[] = "{\"Name\":\"disable_all_the_things\"}"; |
75 | 75 |
76 const char kTestPolicy2[] = | 76 const char kTestPolicy2[] = |
77 "{" | 77 "{" |
78 " \"Another\": {" | 78 " \"Another\": {" |
79 " \"Value\": \"turn_it_off\"" | 79 " \"Value\": \"turn_it_off\"" |
80 " }" | 80 " }" |
81 "}"; | 81 "}"; |
82 | 82 |
83 const char kTestPolicy2JSON[] = "{\"Another\":\"turn_it_off\"}"; | 83 const char kTestPolicy2JSON[] = "{\"Another\":\"turn_it_off\"}"; |
84 | 84 #endif // defined(OS_CHROMEOS) |
85 } // namespace | |
86 | 85 |
87 class ComponentCloudPolicyTest : public ExtensionBrowserTest { | 86 class ComponentCloudPolicyTest : public ExtensionBrowserTest { |
88 protected: | 87 protected: |
89 ComponentCloudPolicyTest() {} | 88 ComponentCloudPolicyTest() {} |
90 virtual ~ComponentCloudPolicyTest() {} | 89 virtual ~ComponentCloudPolicyTest() {} |
91 | 90 |
92 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 91 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
93 ExtensionBrowserTest::SetUpCommandLine(command_line); | 92 ExtensionBrowserTest::SetUpCommandLine(command_line); |
94 #if defined(OS_CHROMEOS) | 93 #if defined(OS_CHROMEOS) |
95 // ExtensionBrowserTest sets the login users to a non-managed value; | 94 // ExtensionBrowserTest sets the login users to a non-managed value; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 ASSERT_EQ(kTestExtension2, extension2->id()); | 248 ASSERT_EQ(kTestExtension2, extension2->id()); |
250 | 249 |
251 // This extension only sends the 'policy' signal once it receives the policy, | 250 // This extension only sends the 'policy' signal once it receives the policy, |
252 // and after verifying it has the expected value. Otherwise it sends 'fail'. | 251 // and after verifying it has the expected value. Otherwise it sends 'fail'. |
253 EXPECT_TRUE(result_listener.WaitUntilSatisfied()); | 252 EXPECT_TRUE(result_listener.WaitUntilSatisfied()); |
254 } | 253 } |
255 | 254 |
256 #endif // OS_CHROMEOS | 255 #endif // OS_CHROMEOS |
257 | 256 |
258 } // namespace policy | 257 } // namespace policy |
OLD | NEW |