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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 " 'unlimitedStorage'," | 1158 " 'unlimitedStorage'," |
1159 " 'syncFileSystem'," | 1159 " 'syncFileSystem'," |
1160 " 'http://www.blogger.com/'," | 1160 " 'http://www.blogger.com/'," |
1161 " 'http://*.google.com/'," | 1161 " 'http://*.google.com/'," |
1162 " 'http://*.news.com/'," | 1162 " 'http://*.news.com/'," |
1163 " 'http://www.foobar.com/'," | 1163 " 'http://www.foobar.com/'," |
1164 " 'http://*.go.com/'," | 1164 " 'http://*.go.com/'," |
1165 " ]" | 1165 " ]" |
1166 "}"); | 1166 "}"); |
1167 | 1167 |
1168 #ifdef OS_CHROMEOS | |
1169 ASSERT_TRUE(CheckManifestProducesPermissions( | 1168 ASSERT_TRUE(CheckManifestProducesPermissions( |
1170 "Read your browsing history on all your signed-in devices", | 1169 "Read your browsing history on all your signed-in devices", |
1171 "Capture content of your screen", "Read and change your bookmarks", | 1170 "Capture content of your screen", "Read and change your bookmarks", |
1172 "Read and change your data on a number of websites", | 1171 "Read and change your data on a number of websites", |
1173 "Read and change your accessibility settings")); | 1172 "Read and change your accessibility settings")); |
1174 #else | |
1175 ASSERT_TRUE(CheckManifestProducesPermissions( | |
1176 "Read your browsing history on all your signed-in devices", | |
1177 "Capture content of your screen", "Read and change your bookmarks", | |
1178 "Read and change your data on a number of websites")); | |
1179 #endif | |
1180 | 1173 |
1181 ASSERT_TRUE(CheckManifestProducesHostPermissions( | 1174 ASSERT_TRUE(CheckManifestProducesHostPermissions( |
1182 "All go.com sites", "All google.com sites", "All news.com sites", | 1175 "All go.com sites", "All google.com sites", "All news.com sites", |
1183 "www.blogger.com", "www.foobar.com")); | 1176 "www.blogger.com", "www.foobar.com")); |
1184 | 1177 |
1185 // Create an App instead, ensuring that the host permission messages are not | 1178 // Create an App instead, ensuring that the host permission messages are not |
1186 // added. | 1179 // added. |
1187 CreateAndInstall( | 1180 CreateAndInstall( |
1188 "{" | 1181 "{" |
1189 " 'app': {" | 1182 " 'app': {" |
(...skipping 19 matching lines...) Expand all Loading... |
1209 " 'unlimitedStorage'," | 1202 " 'unlimitedStorage'," |
1210 " 'syncFileSystem'," | 1203 " 'syncFileSystem'," |
1211 " 'http://www.blogger.com/'," | 1204 " 'http://www.blogger.com/'," |
1212 " 'http://*.google.com/'," | 1205 " 'http://*.google.com/'," |
1213 " 'http://*.news.com/'," | 1206 " 'http://*.news.com/'," |
1214 " 'http://www.foobar.com/'," | 1207 " 'http://www.foobar.com/'," |
1215 " 'http://*.go.com/'," | 1208 " 'http://*.go.com/'," |
1216 " ]" | 1209 " ]" |
1217 "}"); | 1210 "}"); |
1218 | 1211 |
1219 #ifdef OS_CHROMEOS | |
1220 ASSERT_TRUE(CheckManifestProducesPermissions( | 1212 ASSERT_TRUE(CheckManifestProducesPermissions( |
1221 "Access your serial devices", "Store data in your Google Drive account", | 1213 "Access your serial devices", "Store data in your Google Drive account", |
1222 "Read and change your accessibility settings")); | 1214 "Read and change your accessibility settings")); |
1223 #else | |
1224 ASSERT_TRUE(CheckManifestProducesPermissions( | |
1225 "Access your serial devices", "Store data in your Google Drive account")); | |
1226 #endif | |
1227 | 1215 |
1228 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | 1216 ASSERT_TRUE(CheckManifestProducesHostPermissions()); |
1229 } | 1217 } |
1230 | 1218 |
1231 // Tests that the 'plugin' manifest key produces the correct permission. | 1219 // Tests that the 'plugin' manifest key produces the correct permission. |
1232 TEST_F(PermissionMessageCombinationsUnittest, PluginPermission) { | 1220 TEST_F(PermissionMessageCombinationsUnittest, PluginPermission) { |
1233 // Extensions can have plugins. | 1221 // Extensions can have plugins. |
1234 CreateAndInstall( | 1222 CreateAndInstall( |
1235 "{" | 1223 "{" |
1236 " 'plugins': [" | 1224 " 'plugins': [" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 // TODO(sashab): Add a test that ensures that all permissions that can generate | 1258 // TODO(sashab): Add a test that ensures that all permissions that can generate |
1271 // a coalesced message can also generate a message on their own (i.e. ensure | 1259 // a coalesced message can also generate a message on their own (i.e. ensure |
1272 // that no permissions only modify other permissions). | 1260 // that no permissions only modify other permissions). |
1273 | 1261 |
1274 // TODO(sashab): Add a test for every permission message combination that can | 1262 // TODO(sashab): Add a test for every permission message combination that can |
1275 // generate a message. | 1263 // generate a message. |
1276 | 1264 |
1277 // TODO(aboxhall): Add tests for the automation API permission messages. | 1265 // TODO(aboxhall): Add tests for the automation API permission messages. |
1278 | 1266 |
1279 } // namespace extensions | 1267 } // namespace extensions |
OLD | NEW |