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