OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" | 5 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) { | 62 TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) { |
63 DeviceLocalAccountManagementPolicyProvider | 63 DeviceLocalAccountManagementPolicyProvider |
64 provider(policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); | 64 provider(policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); |
65 | 65 |
66 // Verify that if an extension's type has been whitelisted for use in | 66 // Verify that if an extension's type has been whitelisted for use in |
67 // device-local accounts, the extension can be installed. | 67 // device-local accounts, the extension can be installed. |
68 scoped_refptr<const extensions::Extension> extension = CreateHostedApp(); | 68 scoped_refptr<const extensions::Extension> extension = CreateHostedApp(); |
69 ASSERT_TRUE(extension); | 69 ASSERT_TRUE(extension); |
70 string16 error; | 70 base::string16 error; |
71 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); | 71 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); |
72 EXPECT_EQ(string16(), error); | 72 EXPECT_EQ(base::string16(), error); |
73 error.clear(); | 73 error.clear(); |
74 | 74 |
75 // Verify that if an extension's ID has been explicitly whitelisted for use in | 75 // Verify that if an extension's ID has been explicitly whitelisted for use in |
76 // device-local accounts, the extension can be installed. | 76 // device-local accounts, the extension can be installed. |
77 extension = CreateExtension(kWhitelistedId); | 77 extension = CreateExtension(kWhitelistedId); |
78 ASSERT_TRUE(extension); | 78 ASSERT_TRUE(extension); |
79 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); | 79 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); |
80 EXPECT_EQ(string16(), error); | 80 EXPECT_EQ(base::string16(), error); |
81 error.clear(); | 81 error.clear(); |
82 | 82 |
83 // Verify that if neither the type nor the ID of an extension have been | 83 // Verify that if neither the type nor the ID of an extension have been |
84 // whitelisted for use in device-local accounts, the extension cannot be | 84 // whitelisted for use in device-local accounts, the extension cannot be |
85 // installed. | 85 // installed. |
86 extension = CreateExtension(std::string()); | 86 extension = CreateExtension(std::string()); |
87 ASSERT_TRUE(extension); | 87 ASSERT_TRUE(extension); |
88 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 88 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
89 EXPECT_NE(string16(), error); | 89 EXPECT_NE(base::string16(), error); |
90 error.clear(); | 90 error.clear(); |
91 } | 91 } |
92 | 92 |
93 TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) { | 93 TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) { |
94 DeviceLocalAccountManagementPolicyProvider | 94 DeviceLocalAccountManagementPolicyProvider |
95 provider(policy::DeviceLocalAccount::TYPE_KIOSK_APP); | 95 provider(policy::DeviceLocalAccount::TYPE_KIOSK_APP); |
96 | 96 |
97 // Verify that a platform app can be installed. | 97 // Verify that a platform app can be installed. |
98 scoped_refptr<const extensions::Extension> extension = CreatePlatformApp(); | 98 scoped_refptr<const extensions::Extension> extension = CreatePlatformApp(); |
99 ASSERT_TRUE(extension); | 99 ASSERT_TRUE(extension); |
100 string16 error; | 100 base::string16 error; |
101 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); | 101 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); |
102 EXPECT_EQ(string16(), error); | 102 EXPECT_EQ(base::string16(), error); |
103 error.clear(); | 103 error.clear(); |
104 | 104 |
105 // Verify that an extension whose type has been whitelisted for use in other | 105 // Verify that an extension whose type has been whitelisted for use in other |
106 // types of device-local accounts cannot be installed in a single-app kiosk | 106 // types of device-local accounts cannot be installed in a single-app kiosk |
107 // session. | 107 // session. |
108 extension = CreateHostedApp(); | 108 extension = CreateHostedApp(); |
109 ASSERT_TRUE(extension); | 109 ASSERT_TRUE(extension); |
110 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 110 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
111 EXPECT_NE(string16(), error); | 111 EXPECT_NE(base::string16(), error); |
112 error.clear(); | 112 error.clear(); |
113 | 113 |
114 // Verify that an extension whose ID has been whitelisted for use in other | 114 // Verify that an extension whose ID has been whitelisted for use in other |
115 // types of device-local accounts cannot be installed in a single-app kiosk | 115 // types of device-local accounts cannot be installed in a single-app kiosk |
116 // session. | 116 // session. |
117 extension = CreateExtension(kWhitelistedId); | 117 extension = CreateExtension(kWhitelistedId); |
118 ASSERT_TRUE(extension); | 118 ASSERT_TRUE(extension); |
119 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 119 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
120 EXPECT_NE(string16(), error); | 120 EXPECT_NE(base::string16(), error); |
121 error.clear(); | 121 error.clear(); |
122 } | 122 } |
123 | 123 |
124 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |