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

Side by Side Diff: chrome/browser/chromeos/extensions/device_local_account_management_policy_provider_unittest.cc

Issue 564043004: Remove implicit conversions from scoped_refptr to T* in extensions code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/external_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } // namespace 72 } // namespace
73 73
74 TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) { 74 TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) {
75 DeviceLocalAccountManagementPolicyProvider 75 DeviceLocalAccountManagementPolicyProvider
76 provider(policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); 76 provider(policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION);
77 77
78 // Verify that if an extension's location has been whitelisted for use in 78 // Verify that if an extension's location has been whitelisted for use in
79 // public sessions, the extension can be installed. 79 // public sessions, the extension can be installed.
80 scoped_refptr<const extensions::Extension> extension = 80 scoped_refptr<const extensions::Extension> extension =
81 CreateExternalComponentExtension(); 81 CreateExternalComponentExtension();
82 ASSERT_TRUE(extension); 82 ASSERT_TRUE(extension.get());
83 base::string16 error; 83 base::string16 error;
84 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); 84 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
85 EXPECT_EQ(base::string16(), error); 85 EXPECT_EQ(base::string16(), error);
86 error.clear(); 86 error.clear();
87 87
88 // Verify that if an extension's type has been whitelisted for use in 88 // Verify that if an extension's type has been whitelisted for use in
89 // device-local accounts, the extension can be installed. 89 // device-local accounts, the extension can be installed.
90 extension = CreateHostedApp(); 90 extension = CreateHostedApp();
91 ASSERT_TRUE(extension); 91 ASSERT_TRUE(extension.get());
92 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); 92 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
93 EXPECT_EQ(base::string16(), error); 93 EXPECT_EQ(base::string16(), error);
94 error.clear(); 94 error.clear();
95 95
96 // Verify that if an extension's ID has been explicitly whitelisted for use in 96 // Verify that if an extension's ID has been explicitly whitelisted for use in
97 // device-local accounts, the extension can be installed. 97 // device-local accounts, the extension can be installed.
98 extension = CreateRegularExtension(kWhitelistedId); 98 extension = CreateRegularExtension(kWhitelistedId);
99 ASSERT_TRUE(extension); 99 ASSERT_TRUE(extension.get());
100 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); 100 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
101 EXPECT_EQ(base::string16(), error); 101 EXPECT_EQ(base::string16(), error);
102 error.clear(); 102 error.clear();
103 103
104 // Verify that if neither the location, type nor the ID of an extension have 104 // Verify that if neither the location, type nor the ID of an extension have
105 // been whitelisted for use in public sessions, the extension cannot be 105 // been whitelisted for use in public sessions, the extension cannot be
106 // installed. 106 // installed.
107 extension = CreateRegularExtension(std::string()); 107 extension = CreateRegularExtension(std::string());
108 ASSERT_TRUE(extension); 108 ASSERT_TRUE(extension.get());
109 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); 109 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
110 EXPECT_NE(base::string16(), error); 110 EXPECT_NE(base::string16(), error);
111 error.clear(); 111 error.clear();
112 } 112 }
113 113
114 TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) { 114 TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) {
115 DeviceLocalAccountManagementPolicyProvider 115 DeviceLocalAccountManagementPolicyProvider
116 provider(policy::DeviceLocalAccount::TYPE_KIOSK_APP); 116 provider(policy::DeviceLocalAccount::TYPE_KIOSK_APP);
117 117
118 // Verify that a platform app can be installed. 118 // Verify that a platform app can be installed.
119 scoped_refptr<const extensions::Extension> extension = CreatePlatformApp(); 119 scoped_refptr<const extensions::Extension> extension = CreatePlatformApp();
120 ASSERT_TRUE(extension); 120 ASSERT_TRUE(extension.get());
121 base::string16 error; 121 base::string16 error;
122 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); 122 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
123 EXPECT_EQ(base::string16(), error); 123 EXPECT_EQ(base::string16(), error);
124 error.clear(); 124 error.clear();
125 125
126 // Verify that an extension whose location has been whitelisted for use in 126 // Verify that an extension whose location has been whitelisted for use in
127 // other types of device-local accounts cannot be installed in a single-app 127 // other types of device-local accounts cannot be installed in a single-app
128 // kiosk session. 128 // kiosk session.
129 extension = CreateExternalComponentExtension(); 129 extension = CreateExternalComponentExtension();
130 ASSERT_TRUE(extension); 130 ASSERT_TRUE(extension.get());
131 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); 131 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
132 EXPECT_NE(base::string16(), error); 132 EXPECT_NE(base::string16(), error);
133 error.clear(); 133 error.clear();
134 134
135 // Verify that an extension whose type has been whitelisted for use in other 135 // Verify that an extension whose type has been whitelisted for use in other
136 // types of device-local accounts cannot be installed in a single-app kiosk 136 // types of device-local accounts cannot be installed in a single-app kiosk
137 // session. 137 // session.
138 extension = CreateHostedApp(); 138 extension = CreateHostedApp();
139 ASSERT_TRUE(extension); 139 ASSERT_TRUE(extension.get());
140 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); 140 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
141 EXPECT_NE(base::string16(), error); 141 EXPECT_NE(base::string16(), error);
142 error.clear(); 142 error.clear();
143 143
144 // Verify that an extension whose ID has been whitelisted for use in other 144 // Verify that an extension whose ID has been whitelisted for use in other
145 // types of device-local accounts cannot be installed in a single-app kiosk 145 // types of device-local accounts cannot be installed in a single-app kiosk
146 // session. 146 // session.
147 extension = CreateRegularExtension(kWhitelistedId); 147 extension = CreateRegularExtension(kWhitelistedId);
148 ASSERT_TRUE(extension); 148 ASSERT_TRUE(extension.get());
149 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); 149 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
150 EXPECT_NE(base::string16(), error); 150 EXPECT_NE(base::string16(), error);
151 error.clear(); 151 error.clear();
152 } 152 }
153 153
154 } // namespace chromeos 154 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/external_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698