| 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" | |
| 8 #include "base/strings/string_util.h" | |
| 9 #include "base/strings/utf_string_conversions.h" | |
| 10 #include "base/test/values_test_util.h" | 7 #include "base/test/values_test_util.h" |
| 11 #include "chrome/browser/extensions/test_extension_environment.h" | 8 #include "chrome/browser/extensions/test_extension_environment.h" |
| 12 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 9 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
| 13 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/permissions/permission_message_test_util.h" |
| 14 #include "extensions/common/permissions/permissions_data.h" | 12 #include "extensions/common/permissions/permissions_data.h" |
| 15 #include "extensions/common/switches.h" | 13 #include "extensions/common/switches.h" |
| 16 #include "testing/gmock/include/gmock/gmock-matchers.h" | 14 #include "testing/gmock/include/gmock/gmock-matchers.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 16 |
| 19 using testing::Contains; | |
| 20 using testing::Eq; | |
| 21 | |
| 22 namespace extensions { | 17 namespace extensions { |
| 23 | 18 |
| 24 // Tests that ChromePermissionMessageProvider produces the expected messages for | 19 // Tests that ChromePermissionMessageProvider produces the expected messages for |
| 25 // various combinations of app/extension permissions. | 20 // various combinations of app/extension permissions. |
| 26 class PermissionMessageCombinationsUnittest : public testing::Test { | 21 class PermissionMessageCombinationsUnittest : public testing::Test { |
| 27 public: | 22 public: |
| 28 PermissionMessageCombinationsUnittest() | 23 PermissionMessageCombinationsUnittest() |
| 29 : message_provider_(new ChromePermissionMessageProvider()) {} | 24 : message_provider_(new ChromePermissionMessageProvider()) {} |
| 30 ~PermissionMessageCombinationsUnittest() override {} | 25 ~PermissionMessageCombinationsUnittest() override {} |
| 31 | 26 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 *base::test::ParseJson(json_manifest_with_double_quotes)); | 42 *base::test::ParseJson(json_manifest_with_double_quotes)); |
| 48 // Add the app to any whitelists so we can test all permissions. | 43 // Add the app to any whitelists so we can test all permissions. |
| 49 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 44 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 50 switches::kWhitelistedExtensionID, app_->id()); | 45 switches::kWhitelistedExtensionID, app_->id()); |
| 51 } | 46 } |
| 52 | 47 |
| 53 // Checks whether the currently installed app or extension produces the given | 48 // Checks whether the currently installed app or extension produces the given |
| 54 // permission messages. Call this after installing an app with the expected | 49 // permission messages. Call this after installing an app with the expected |
| 55 // permission messages. The messages are tested for existence in any order. | 50 // permission messages. The messages are tested for existence in any order. |
| 56 testing::AssertionResult CheckManifestProducesPermissions() { | 51 testing::AssertionResult CheckManifestProducesPermissions() { |
| 57 return CheckManifestProducesPermissions( | 52 return VerifyNoPermissionMessages(app_->permissions_data()); |
| 58 std::vector<std::string>(), GetPermissionMessages(), | |
| 59 GetCoalescedPermissionMessages(), "messages"); | |
| 60 } | 53 } |
| 61 testing::AssertionResult CheckManifestProducesPermissions( | 54 testing::AssertionResult CheckManifestProducesPermissions( |
| 62 const std::string& expected_message_1) { | 55 const std::string& expected_message_1) { |
| 63 std::vector<std::string> expected_messages; | 56 return VerifyOnePermissionMessage(app_->permissions_data(), |
| 64 expected_messages.push_back(expected_message_1); | 57 expected_message_1); |
| 65 return CheckManifestProducesPermissions( | |
| 66 expected_messages, GetPermissionMessages(), | |
| 67 GetCoalescedPermissionMessages(), "messages"); | |
| 68 } | 58 } |
| 69 testing::AssertionResult CheckManifestProducesPermissions( | 59 testing::AssertionResult CheckManifestProducesPermissions( |
| 70 const std::string& expected_message_1, | 60 const std::string& expected_message_1, |
| 71 const std::string& expected_message_2) { | 61 const std::string& expected_message_2) { |
| 72 std::vector<std::string> expected_messages; | 62 return VerifyTwoPermissionMessages(app_->permissions_data(), |
| 73 expected_messages.push_back(expected_message_1); | 63 expected_message_1, expected_message_2, |
| 74 expected_messages.push_back(expected_message_2); | 64 false); |
| 75 return CheckManifestProducesPermissions( | |
| 76 expected_messages, GetPermissionMessages(), | |
| 77 GetCoalescedPermissionMessages(), "messages"); | |
| 78 } | 65 } |
| 79 testing::AssertionResult CheckManifestProducesPermissions( | 66 testing::AssertionResult CheckManifestProducesPermissions( |
| 80 const std::string& expected_message_1, | 67 const std::string& expected_message_1, |
| 81 const std::string& expected_message_2, | 68 const std::string& expected_message_2, |
| 82 const std::string& expected_message_3) { | 69 const std::string& expected_message_3) { |
| 83 std::vector<std::string> expected_messages; | 70 std::vector<std::string> expected_messages; |
| 84 expected_messages.push_back(expected_message_1); | 71 expected_messages.push_back(expected_message_1); |
| 85 expected_messages.push_back(expected_message_2); | 72 expected_messages.push_back(expected_message_2); |
| 86 expected_messages.push_back(expected_message_3); | 73 expected_messages.push_back(expected_message_3); |
| 87 return CheckManifestProducesPermissions( | 74 return VerifyPermissionMessages(app_->permissions_data(), expected_messages, |
| 88 expected_messages, GetPermissionMessages(), | 75 false); |
| 89 GetCoalescedPermissionMessages(), "messages"); | |
| 90 } | 76 } |
| 91 testing::AssertionResult CheckManifestProducesPermissions( | 77 testing::AssertionResult CheckManifestProducesPermissions( |
| 92 const std::string& expected_message_1, | 78 const std::string& expected_message_1, |
| 93 const std::string& expected_message_2, | 79 const std::string& expected_message_2, |
| 94 const std::string& expected_message_3, | 80 const std::string& expected_message_3, |
| 95 const std::string& expected_message_4) { | 81 const std::string& expected_message_4) { |
| 96 std::vector<std::string> expected_messages; | 82 std::vector<std::string> expected_messages; |
| 97 expected_messages.push_back(expected_message_1); | 83 expected_messages.push_back(expected_message_1); |
| 98 expected_messages.push_back(expected_message_2); | 84 expected_messages.push_back(expected_message_2); |
| 99 expected_messages.push_back(expected_message_3); | 85 expected_messages.push_back(expected_message_3); |
| 100 expected_messages.push_back(expected_message_4); | 86 expected_messages.push_back(expected_message_4); |
| 101 return CheckManifestProducesPermissions( | 87 return VerifyPermissionMessages(app_->permissions_data(), expected_messages, |
| 102 expected_messages, GetPermissionMessages(), | 88 false); |
| 103 GetCoalescedPermissionMessages(), "messages"); | |
| 104 } | 89 } |
| 105 testing::AssertionResult CheckManifestProducesPermissions( | 90 testing::AssertionResult CheckManifestProducesPermissions( |
| 106 const std::string& expected_message_1, | 91 const std::string& expected_message_1, |
| 107 const std::string& expected_message_2, | 92 const std::string& expected_message_2, |
| 108 const std::string& expected_message_3, | 93 const std::string& expected_message_3, |
| 109 const std::string& expected_message_4, | 94 const std::string& expected_message_4, |
| 110 const std::string& expected_message_5) { | 95 const std::string& expected_message_5) { |
| 111 std::vector<std::string> expected_messages; | 96 std::vector<std::string> expected_messages; |
| 112 expected_messages.push_back(expected_message_1); | 97 expected_messages.push_back(expected_message_1); |
| 113 expected_messages.push_back(expected_message_2); | 98 expected_messages.push_back(expected_message_2); |
| 114 expected_messages.push_back(expected_message_3); | 99 expected_messages.push_back(expected_message_3); |
| 115 expected_messages.push_back(expected_message_4); | 100 expected_messages.push_back(expected_message_4); |
| 116 expected_messages.push_back(expected_message_5); | 101 expected_messages.push_back(expected_message_5); |
| 117 return CheckManifestProducesPermissions( | 102 return VerifyPermissionMessages(app_->permissions_data(), expected_messages, |
| 118 expected_messages, GetPermissionMessages(), | 103 false); |
| 119 GetCoalescedPermissionMessages(), "messages"); | |
| 120 } | 104 } |
| 121 | 105 testing::AssertionResult CheckManifestProducesPermissions( |
| 122 // Checks whether the currently installed app or extension produces the given | 106 const std::string& expected_message_1, |
| 123 // host permission messages. Call this after installing an app with the | 107 const std::vector<std::string>& expected_submessages_1) { |
| 124 // expected permission messages. The messages are tested for existence in any | 108 return VerifyOnePermissionMessageWithSubmessages( |
| 125 // order. | 109 app_->permissions_data(), expected_message_1, expected_submessages_1); |
| 126 testing::AssertionResult CheckManifestProducesHostPermissions() { | |
| 127 return CheckManifestProducesPermissions( | |
| 128 std::vector<std::string>(), GetHostPermissionMessages(), | |
| 129 GetCoalescedHostPermissionMessages(), "host messages"); | |
| 130 } | 110 } |
| 131 testing::AssertionResult CheckManifestProducesHostPermissions( | 111 testing::AssertionResult CheckManifestProducesPermissions( |
| 132 const std::string& expected_message_1) { | |
| 133 std::vector<std::string> expected_messages; | |
| 134 expected_messages.push_back(expected_message_1); | |
| 135 return CheckManifestProducesPermissions( | |
| 136 expected_messages, GetHostPermissionMessages(), | |
| 137 GetCoalescedHostPermissionMessages(), "host messages"); | |
| 138 } | |
| 139 testing::AssertionResult CheckManifestProducesHostPermissions( | |
| 140 const std::string& expected_message_1, | 112 const std::string& expected_message_1, |
| 141 const std::string& expected_message_2) { | 113 const std::vector<std::string>& expected_submessages_1, |
| 114 const std::string& expected_message_2, |
| 115 const std::vector<std::string>& expected_submessages_2) { |
| 142 std::vector<std::string> expected_messages; | 116 std::vector<std::string> expected_messages; |
| 143 expected_messages.push_back(expected_message_1); | 117 expected_messages.push_back(expected_message_1); |
| 144 expected_messages.push_back(expected_message_2); | 118 expected_messages.push_back(expected_message_2); |
| 145 return CheckManifestProducesPermissions( | 119 std::vector<std::vector<std::string>> expected_submessages; |
| 146 expected_messages, GetHostPermissionMessages(), | 120 expected_submessages.push_back(expected_submessages_1); |
| 147 GetCoalescedHostPermissionMessages(), "host messages"); | 121 expected_submessages.push_back(expected_submessages_2); |
| 122 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), |
| 123 expected_messages, |
| 124 expected_submessages, false); |
| 148 } | 125 } |
| 149 testing::AssertionResult CheckManifestProducesHostPermissions( | 126 testing::AssertionResult CheckManifestProducesPermissions( |
| 150 const std::string& expected_message_1, | 127 const std::string& expected_message_1, |
| 128 const std::vector<std::string>& expected_submessages_1, |
| 151 const std::string& expected_message_2, | 129 const std::string& expected_message_2, |
| 152 const std::string& expected_message_3) { | 130 const std::vector<std::string>& expected_submessages_2, |
| 131 const std::string& expected_message_3, |
| 132 const std::vector<std::string>& expected_submessages_3) { |
| 153 std::vector<std::string> expected_messages; | 133 std::vector<std::string> expected_messages; |
| 154 expected_messages.push_back(expected_message_1); | 134 expected_messages.push_back(expected_message_1); |
| 155 expected_messages.push_back(expected_message_2); | 135 expected_messages.push_back(expected_message_2); |
| 156 expected_messages.push_back(expected_message_3); | 136 expected_messages.push_back(expected_message_3); |
| 157 return CheckManifestProducesPermissions( | 137 std::vector<std::vector<std::string>> expected_submessages; |
| 158 expected_messages, GetHostPermissionMessages(), | 138 expected_submessages.push_back(expected_submessages_1); |
| 159 GetCoalescedHostPermissionMessages(), "host messages"); | 139 expected_submessages.push_back(expected_submessages_2); |
| 140 expected_submessages.push_back(expected_submessages_3); |
| 141 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), |
| 142 expected_messages, |
| 143 expected_submessages, false); |
| 160 } | 144 } |
| 161 testing::AssertionResult CheckManifestProducesHostPermissions( | 145 testing::AssertionResult CheckManifestProducesPermissions( |
| 162 const std::string& expected_message_1, | 146 const std::string& expected_message_1, |
| 147 const std::vector<std::string>& expected_submessages_1, |
| 163 const std::string& expected_message_2, | 148 const std::string& expected_message_2, |
| 149 const std::vector<std::string>& expected_submessages_2, |
| 164 const std::string& expected_message_3, | 150 const std::string& expected_message_3, |
| 165 const std::string& expected_message_4) { | 151 const std::vector<std::string>& expected_submessages_3, |
| 152 const std::string& expected_message_4, |
| 153 const std::vector<std::string>& expected_submessages_4) { |
| 166 std::vector<std::string> expected_messages; | 154 std::vector<std::string> expected_messages; |
| 167 expected_messages.push_back(expected_message_1); | 155 expected_messages.push_back(expected_message_1); |
| 168 expected_messages.push_back(expected_message_2); | 156 expected_messages.push_back(expected_message_2); |
| 169 expected_messages.push_back(expected_message_3); | 157 expected_messages.push_back(expected_message_3); |
| 170 expected_messages.push_back(expected_message_4); | 158 expected_messages.push_back(expected_message_4); |
| 171 return CheckManifestProducesPermissions( | 159 std::vector<std::vector<std::string>> expected_submessages; |
| 172 expected_messages, GetHostPermissionMessages(), | 160 expected_submessages.push_back(expected_submessages_1); |
| 173 GetCoalescedHostPermissionMessages(), "host messages"); | 161 expected_submessages.push_back(expected_submessages_2); |
| 162 expected_submessages.push_back(expected_submessages_3); |
| 163 expected_submessages.push_back(expected_submessages_4); |
| 164 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), |
| 165 expected_messages, |
| 166 expected_submessages, false); |
| 174 } | 167 } |
| 175 testing::AssertionResult CheckManifestProducesHostPermissions( | 168 testing::AssertionResult CheckManifestProducesPermissions( |
| 176 const std::string& expected_message_1, | 169 const std::string& expected_message_1, |
| 170 const std::vector<std::string>& expected_submessages_1, |
| 177 const std::string& expected_message_2, | 171 const std::string& expected_message_2, |
| 172 const std::vector<std::string>& expected_submessages_2, |
| 178 const std::string& expected_message_3, | 173 const std::string& expected_message_3, |
| 174 const std::vector<std::string>& expected_submessages_3, |
| 179 const std::string& expected_message_4, | 175 const std::string& expected_message_4, |
| 180 const std::string& expected_message_5) { | 176 const std::vector<std::string>& expected_submessages_4, |
| 177 const std::string& expected_message_5, |
| 178 const std::vector<std::string>& expected_submessages_5) { |
| 181 std::vector<std::string> expected_messages; | 179 std::vector<std::string> expected_messages; |
| 182 expected_messages.push_back(expected_message_1); | 180 expected_messages.push_back(expected_message_1); |
| 183 expected_messages.push_back(expected_message_2); | 181 expected_messages.push_back(expected_message_2); |
| 184 expected_messages.push_back(expected_message_3); | 182 expected_messages.push_back(expected_message_3); |
| 185 expected_messages.push_back(expected_message_4); | 183 expected_messages.push_back(expected_message_4); |
| 186 expected_messages.push_back(expected_message_5); | 184 expected_messages.push_back(expected_message_5); |
| 187 return CheckManifestProducesPermissions( | 185 std::vector<std::vector<std::string>> expected_submessages; |
| 188 expected_messages, GetHostPermissionMessages(), | 186 expected_submessages.push_back(expected_submessages_1); |
| 189 GetCoalescedHostPermissionMessages(), "host messages"); | 187 expected_submessages.push_back(expected_submessages_2); |
| 188 expected_submessages.push_back(expected_submessages_3); |
| 189 expected_submessages.push_back(expected_submessages_4); |
| 190 expected_submessages.push_back(expected_submessages_5); |
| 191 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), |
| 192 expected_messages, |
| 193 expected_submessages, false); |
| 190 } | 194 } |
| 191 | 195 |
| 192 private: | 196 private: |
| 193 std::vector<base::string16> GetPermissionMessages() { | |
| 194 return app_->permissions_data()->GetPermissionMessageStrings(); | |
| 195 } | |
| 196 | |
| 197 std::vector<base::string16> GetCoalescedPermissionMessages() { | |
| 198 CoalescedPermissionMessages messages = | |
| 199 app_->permissions_data()->GetCoalescedPermissionMessages(); | |
| 200 std::vector<base::string16> message_strings; | |
| 201 for (const auto& message : messages) { | |
| 202 message_strings.push_back(message.message()); | |
| 203 } | |
| 204 return message_strings; | |
| 205 } | |
| 206 | |
| 207 std::vector<base::string16> GetHostPermissionMessages() { | |
| 208 std::vector<base::string16> details = | |
| 209 app_->permissions_data()->GetPermissionMessageDetailsStrings(); | |
| 210 // If we have a host permission, exactly one message will contain the | |
| 211 // details for it. | |
| 212 for (const auto& host_string : details) { | |
| 213 if (!host_string.empty()) { | |
| 214 // The host_string will be a newline-separated string of entries. | |
| 215 std::vector<base::string16> pieces; | |
| 216 base::SplitString(host_string, base::char16('\n'), &pieces); | |
| 217 return pieces; | |
| 218 } | |
| 219 } | |
| 220 return std::vector<base::string16>(); | |
| 221 } | |
| 222 | |
| 223 std::vector<base::string16> GetCoalescedHostPermissionMessages() { | |
| 224 // If we have a host permission, exactly one message will contain the | |
| 225 // details for it. | |
| 226 CoalescedPermissionMessages messages = | |
| 227 app_->permissions_data()->GetCoalescedPermissionMessages(); | |
| 228 for (const auto& message : messages) { | |
| 229 if (!message.submessages().empty()) | |
| 230 return message.submessages(); | |
| 231 } | |
| 232 return std::vector<base::string16>(); | |
| 233 } | |
| 234 | |
| 235 // TODO(sashab): Remove the legacy messages from this function once the legacy | |
| 236 // messages system is no longer used. | |
| 237 testing::AssertionResult CheckManifestProducesPermissions( | |
| 238 const std::vector<std::string>& expected_messages, | |
| 239 const std::vector<base::string16>& actual_legacy_messages, | |
| 240 const std::vector<base::string16>& actual_messages, | |
| 241 const std::string& message_type_name) { | |
| 242 // Check the new messages system matches the legacy one. | |
| 243 if (actual_legacy_messages.size() != actual_messages.size()) { | |
| 244 // Message: Got 2 messages in the legacy system { "Bar", "Baz" }, but 0 in | |
| 245 // the new system {} | |
| 246 return testing::AssertionFailure() | |
| 247 << "Got " << actual_legacy_messages.size() << " " | |
| 248 << message_type_name << " in the legacy system " | |
| 249 << MessagesVectorToString(actual_legacy_messages) << ", but " | |
| 250 << actual_messages.size() << " in the new system " | |
| 251 << MessagesVectorToString(actual_messages); | |
| 252 } | |
| 253 | |
| 254 for (const auto& actual_message : actual_messages) { | |
| 255 if (std::find(actual_legacy_messages.begin(), | |
| 256 actual_legacy_messages.end(), | |
| 257 actual_message) == actual_legacy_messages.end()) { | |
| 258 // Message: Got { "Foo" } in the legacy messages system, but { "Bar", | |
| 259 // "Baz" } in the new system | |
| 260 return testing::AssertionFailure() | |
| 261 << "Got " << MessagesVectorToString(actual_legacy_messages) | |
| 262 << " in the legacy " << message_type_name << " system, but " | |
| 263 << MessagesVectorToString(actual_messages) | |
| 264 << " in the new system"; | |
| 265 } | |
| 266 } | |
| 267 | |
| 268 // Check the non-legacy & actual messages are equal. | |
| 269 if (expected_messages.size() != actual_messages.size()) { | |
| 270 // Message: Expected 7 messages, got 5 | |
| 271 return testing::AssertionFailure() | |
| 272 << "Expected " << expected_messages.size() << " " | |
| 273 << message_type_name << ", got " << actual_messages.size() << ": " | |
| 274 << MessagesVectorToString(actual_messages); | |
| 275 } | |
| 276 | |
| 277 for (const auto& expected_message : expected_messages) { | |
| 278 if (std::find(actual_messages.begin(), actual_messages.end(), | |
| 279 base::ASCIIToUTF16(expected_message)) == | |
| 280 actual_messages.end()) { | |
| 281 // Message: Expected messages to contain "Foo", got { "Bar", "Baz" } | |
| 282 return testing::AssertionFailure() | |
| 283 << "Expected " << message_type_name << " to contain \"" | |
| 284 << expected_message << "\", got " | |
| 285 << MessagesVectorToString(actual_messages); | |
| 286 } | |
| 287 } | |
| 288 | |
| 289 return testing::AssertionSuccess(); | |
| 290 } | |
| 291 | |
| 292 // Returns the vector of messages in a human-readable string format, e.g.: | |
| 293 // { "Bar", "Baz" } | |
| 294 base::string16 MessagesVectorToString( | |
| 295 const std::vector<base::string16>& messages) { | |
| 296 if (messages.empty()) | |
| 297 return base::ASCIIToUTF16("{}"); | |
| 298 return base::ASCIIToUTF16("{ \"") + | |
| 299 JoinString(messages, base::ASCIIToUTF16("\", \"")) + | |
| 300 base::ASCIIToUTF16("\" }"); | |
| 301 } | |
| 302 | |
| 303 extensions::TestExtensionEnvironment env_; | 197 extensions::TestExtensionEnvironment env_; |
| 304 scoped_ptr<ChromePermissionMessageProvider> message_provider_; | 198 scoped_ptr<ChromePermissionMessageProvider> message_provider_; |
| 305 scoped_refptr<const Extension> app_; | 199 scoped_refptr<const Extension> app_; |
| 306 | 200 |
| 307 DISALLOW_COPY_AND_ASSIGN(PermissionMessageCombinationsUnittest); | 201 DISALLOW_COPY_AND_ASSIGN(PermissionMessageCombinationsUnittest); |
| 308 }; | 202 }; |
| 309 | 203 |
| 310 // Test that the USB, Bluetooth and Serial permissions do not coalesce on their | 204 // Test that the USB, Bluetooth and Serial permissions do not coalesce on their |
| 311 // own, but do coalesce when more than 1 is present. | 205 // own, but do coalesce when more than 1 is present. |
| 312 TEST_F(PermissionMessageCombinationsUnittest, USBSerialBluetoothCoalescing) { | 206 TEST_F(PermissionMessageCombinationsUnittest, USBSerialBluetoothCoalescing) { |
| 313 // Test that the USB permission does not coalesce on its own. | 207 // Test that the USB permission does not coalesce on its own. |
| 314 CreateAndInstall( | 208 CreateAndInstall( |
| 315 "{" | 209 "{" |
| 316 " 'app': {" | 210 " 'app': {" |
| 317 " 'background': {" | 211 " 'background': {" |
| 318 " 'scripts': ['background.js']" | 212 " 'scripts': ['background.js']" |
| 319 " }" | 213 " }" |
| 320 " }," | 214 " }," |
| 321 " 'permissions': [" | 215 " 'permissions': [" |
| 322 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }" | 216 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }" |
| 323 " ]" | 217 " ]" |
| 324 "}"); | 218 "}"); |
| 325 ASSERT_TRUE(CheckManifestProducesPermissions( | 219 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 326 "Access USB devices from an unknown vendor")); | 220 "Access USB devices from an unknown vendor")); |
| 327 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 328 | 221 |
| 329 CreateAndInstall( | 222 CreateAndInstall( |
| 330 "{" | 223 "{" |
| 331 " 'app': {" | 224 " 'app': {" |
| 332 " 'background': {" | 225 " 'background': {" |
| 333 " 'scripts': ['background.js']" | 226 " 'scripts': ['background.js']" |
| 334 " }" | 227 " }" |
| 335 " }," | 228 " }," |
| 336 " 'permissions': [" | 229 " 'permissions': [" |
| 337 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }" | 230 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }" |
| 338 " ]" | 231 " ]" |
| 339 "}"); | 232 "}"); |
| 340 ASSERT_TRUE(CheckManifestProducesPermissions( | 233 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 341 "Access USB devices from an unknown vendor")); | 234 "Access USB devices from an unknown vendor")); |
| 342 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 343 | 235 |
| 344 // Test that the serial permission does not coalesce on its own. | 236 // Test that the serial permission does not coalesce on its own. |
| 345 CreateAndInstall( | 237 CreateAndInstall( |
| 346 "{" | 238 "{" |
| 347 " 'app': {" | 239 " 'app': {" |
| 348 " 'background': {" | 240 " 'background': {" |
| 349 " 'scripts': ['background.js']" | 241 " 'scripts': ['background.js']" |
| 350 " }" | 242 " }" |
| 351 " }," | 243 " }," |
| 352 " 'permissions': [" | 244 " 'permissions': [" |
| 353 " 'serial'" | 245 " 'serial'" |
| 354 " ]" | 246 " ]" |
| 355 "}"); | 247 "}"); |
| 356 ASSERT_TRUE(CheckManifestProducesPermissions("Access your serial devices")); | 248 ASSERT_TRUE(CheckManifestProducesPermissions("Access your serial devices")); |
| 357 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 358 | 249 |
| 359 // Test that the bluetooth permission does not coalesce on its own. | 250 // Test that the bluetooth permission does not coalesce on its own. |
| 360 CreateAndInstall( | 251 CreateAndInstall( |
| 361 "{" | 252 "{" |
| 362 " 'app': {" | 253 " 'app': {" |
| 363 " 'background': {" | 254 " 'background': {" |
| 364 " 'scripts': ['background.js']" | 255 " 'scripts': ['background.js']" |
| 365 " }" | 256 " }" |
| 366 " }," | 257 " }," |
| 367 " 'bluetooth': {}" | 258 " 'bluetooth': {}" |
| 368 "}"); | 259 "}"); |
| 369 ASSERT_TRUE(CheckManifestProducesPermissions( | 260 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 370 "Access information about Bluetooth devices paired with your system and " | 261 "Access information about Bluetooth devices paired with your system and " |
| 371 "discover nearby Bluetooth devices.")); | 262 "discover nearby Bluetooth devices.")); |
| 372 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 373 | 263 |
| 374 // Test that the bluetooth permission does not coalesce on its own, even | 264 // Test that the bluetooth permission does not coalesce on its own, even |
| 375 // when it specifies additional permissions. | 265 // when it specifies additional permissions. |
| 376 CreateAndInstall( | 266 CreateAndInstall( |
| 377 "{" | 267 "{" |
| 378 " 'app': {" | 268 " 'app': {" |
| 379 " 'background': {" | 269 " 'background': {" |
| 380 " 'scripts': ['background.js']" | 270 " 'scripts': ['background.js']" |
| 381 " }" | 271 " }" |
| 382 " }," | 272 " }," |
| 383 " 'bluetooth': {" | 273 " 'bluetooth': {" |
| 384 " 'uuids': ['1105', '1106']" | 274 " 'uuids': ['1105', '1106']" |
| 385 " }" | 275 " }" |
| 386 "}"); | 276 "}"); |
| 387 ASSERT_TRUE(CheckManifestProducesPermissions( | 277 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 388 "Access information about Bluetooth devices paired with your system and " | 278 "Access information about Bluetooth devices paired with your system and " |
| 389 "discover nearby Bluetooth devices.")); | 279 "discover nearby Bluetooth devices.")); |
| 390 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 391 | 280 |
| 392 // Test that the USB and Serial permissions coalesce. | 281 // Test that the USB and Serial permissions coalesce. |
| 393 CreateAndInstall( | 282 CreateAndInstall( |
| 394 "{" | 283 "{" |
| 395 " 'app': {" | 284 " 'app': {" |
| 396 " 'background': {" | 285 " 'background': {" |
| 397 " 'scripts': ['background.js']" | 286 " 'scripts': ['background.js']" |
| 398 " }" | 287 " }" |
| 399 " }," | 288 " }," |
| 400 " 'permissions': [" | 289 " 'permissions': [" |
| 401 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," | 290 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," |
| 402 " 'serial'" | 291 " 'serial'" |
| 403 " ]" | 292 " ]" |
| 404 "}"); | 293 "}"); |
| 405 ASSERT_TRUE(CheckManifestProducesPermissions( | 294 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 406 "Access USB devices from an unknown vendor", | 295 "Access USB devices from an unknown vendor", |
| 407 "Access your serial devices")); | 296 "Access your serial devices")); |
| 408 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 409 | 297 |
| 410 // Test that the USB, Serial and Bluetooth permissions coalesce. | 298 // Test that the USB, Serial and Bluetooth permissions coalesce. |
| 411 CreateAndInstall( | 299 CreateAndInstall( |
| 412 "{" | 300 "{" |
| 413 " 'app': {" | 301 " 'app': {" |
| 414 " 'background': {" | 302 " 'background': {" |
| 415 " 'scripts': ['background.js']" | 303 " 'scripts': ['background.js']" |
| 416 " }" | 304 " }" |
| 417 " }," | 305 " }," |
| 418 " 'permissions': [" | 306 " 'permissions': [" |
| 419 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," | 307 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," |
| 420 " 'serial'" | 308 " 'serial'" |
| 421 " ]," | 309 " ]," |
| 422 " 'bluetooth': {}" | 310 " 'bluetooth': {}" |
| 423 "}"); | 311 "}"); |
| 424 ASSERT_TRUE(CheckManifestProducesPermissions( | 312 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 425 "Access USB devices from an unknown vendor", | 313 "Access USB devices from an unknown vendor", |
| 426 "Access your Bluetooth and Serial devices")); | 314 "Access your Bluetooth and Serial devices")); |
| 427 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 428 | 315 |
| 429 // Test that the USB, Serial and Bluetooth permissions coalesce even when | 316 // Test that the USB, Serial and Bluetooth permissions coalesce even when |
| 430 // Bluetooth specifies multiple additional permissions. | 317 // Bluetooth specifies multiple additional permissions. |
| 431 CreateAndInstall( | 318 CreateAndInstall( |
| 432 "{" | 319 "{" |
| 433 " 'app': {" | 320 " 'app': {" |
| 434 " 'background': {" | 321 " 'background': {" |
| 435 " 'scripts': ['background.js']" | 322 " 'scripts': ['background.js']" |
| 436 " }" | 323 " }" |
| 437 " }," | 324 " }," |
| 438 " 'permissions': [" | 325 " 'permissions': [" |
| 439 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," | 326 " { 'usbDevices': [{ 'vendorId': 123, 'productId': 456 }] }," |
| 440 " 'serial'" | 327 " 'serial'" |
| 441 " ]," | 328 " ]," |
| 442 " 'bluetooth': {" | 329 " 'bluetooth': {" |
| 443 " 'uuids': ['1105', '1106']," | 330 " 'uuids': ['1105', '1106']," |
| 444 " 'socket': true," | 331 " 'socket': true," |
| 445 " 'low_energy': true" | 332 " 'low_energy': true" |
| 446 " }" | 333 " }" |
| 447 "}"); | 334 "}"); |
| 448 ASSERT_TRUE(CheckManifestProducesPermissions( | 335 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 449 "Access USB devices from an unknown vendor", | 336 "Access USB devices from an unknown vendor", |
| 450 "Access your Bluetooth and Serial devices")); | 337 "Access your Bluetooth and Serial devices")); |
| 451 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 452 } | 338 } |
| 453 | 339 |
| 454 // Test that the History permission takes precedence over the Tabs permission, | 340 // Test that the History permission takes precedence over the Tabs permission, |
| 455 // and that the Sessions permission modifies this final message. | 341 // and that the Sessions permission modifies this final message. |
| 456 TEST_F(PermissionMessageCombinationsUnittest, TabsHistorySessionsCoalescing) { | 342 TEST_F(PermissionMessageCombinationsUnittest, TabsHistorySessionsCoalescing) { |
| 457 CreateAndInstall( | 343 CreateAndInstall( |
| 458 "{" | 344 "{" |
| 459 " 'permissions': [" | 345 " 'permissions': [" |
| 460 " 'tabs'" | 346 " 'tabs'" |
| 461 " ]" | 347 " ]" |
| 462 "}"); | 348 "}"); |
| 463 ASSERT_TRUE(CheckManifestProducesPermissions("Read your browsing history")); | 349 ASSERT_TRUE(CheckManifestProducesPermissions("Read your browsing history")); |
| 464 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 465 | 350 |
| 466 CreateAndInstall( | 351 CreateAndInstall( |
| 467 "{" | 352 "{" |
| 468 " 'permissions': [" | 353 " 'permissions': [" |
| 469 " 'tabs', 'sessions'" | 354 " 'tabs', 'sessions'" |
| 470 " ]" | 355 " ]" |
| 471 "}"); | 356 "}"); |
| 472 ASSERT_TRUE(CheckManifestProducesPermissions( | 357 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 473 "Read your browsing history on all your signed-in devices")); | 358 "Read your browsing history on all your signed-in devices")); |
| 474 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 475 | 359 |
| 476 CreateAndInstall( | 360 CreateAndInstall( |
| 477 "{" | 361 "{" |
| 478 " 'permissions': [" | 362 " 'permissions': [" |
| 479 " 'tabs', 'history'" | 363 " 'tabs', 'history'" |
| 480 " ]" | 364 " ]" |
| 481 "}"); | 365 "}"); |
| 482 ASSERT_TRUE(CheckManifestProducesPermissions( | 366 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 483 "Read and change your browsing history")); | 367 "Read and change your browsing history")); |
| 484 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 485 | 368 |
| 486 CreateAndInstall( | 369 CreateAndInstall( |
| 487 "{" | 370 "{" |
| 488 " 'permissions': [" | 371 " 'permissions': [" |
| 489 " 'tabs', 'history', 'sessions'" | 372 " 'tabs', 'history', 'sessions'" |
| 490 " ]" | 373 " ]" |
| 491 "}"); | 374 "}"); |
| 492 ASSERT_TRUE(CheckManifestProducesPermissions( | 375 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 493 "Read and change your browsing history on all your signed-in devices")); | 376 "Read and change your browsing history on all your signed-in devices")); |
| 494 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 495 } | 377 } |
| 496 | 378 |
| 497 // Test that the fileSystem permission produces no messages by itself, unless it | 379 // Test that the fileSystem permission produces no messages by itself, unless it |
| 498 // has both the 'write' and 'directory' additional permissions, in which case it | 380 // has both the 'write' and 'directory' additional permissions, in which case it |
| 499 // displays a message. | 381 // displays a message. |
| 500 TEST_F(PermissionMessageCombinationsUnittest, FileSystemReadWriteCoalescing) { | 382 TEST_F(PermissionMessageCombinationsUnittest, FileSystemReadWriteCoalescing) { |
| 501 CreateAndInstall( | 383 CreateAndInstall( |
| 502 "{" | 384 "{" |
| 503 " 'app': {" | 385 " 'app': {" |
| 504 " 'background': {" | 386 " 'background': {" |
| 505 " 'scripts': ['background.js']" | 387 " 'scripts': ['background.js']" |
| 506 " }" | 388 " }" |
| 507 " }," | 389 " }," |
| 508 " 'permissions': [" | 390 " 'permissions': [" |
| 509 " 'fileSystem'" | 391 " 'fileSystem'" |
| 510 " ]" | 392 " ]" |
| 511 "}"); | 393 "}"); |
| 512 ASSERT_TRUE(CheckManifestProducesPermissions()); | 394 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 513 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 514 | 395 |
| 515 CreateAndInstall( | 396 CreateAndInstall( |
| 516 "{" | 397 "{" |
| 517 " 'app': {" | 398 " 'app': {" |
| 518 " 'background': {" | 399 " 'background': {" |
| 519 " 'scripts': ['background.js']" | 400 " 'scripts': ['background.js']" |
| 520 " }" | 401 " }" |
| 521 " }," | 402 " }," |
| 522 " 'permissions': [" | 403 " 'permissions': [" |
| 523 " 'fileSystem', {'fileSystem': ['retainEntries', 'write']}" | 404 " 'fileSystem', {'fileSystem': ['retainEntries', 'write']}" |
| 524 " ]" | 405 " ]" |
| 525 "}"); | 406 "}"); |
| 526 ASSERT_TRUE(CheckManifestProducesPermissions()); | 407 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 527 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 528 | 408 |
| 529 CreateAndInstall( | 409 CreateAndInstall( |
| 530 "{" | 410 "{" |
| 531 " 'app': {" | 411 " 'app': {" |
| 532 " 'background': {" | 412 " 'background': {" |
| 533 " 'scripts': ['background.js']" | 413 " 'scripts': ['background.js']" |
| 534 " }" | 414 " }" |
| 535 " }," | 415 " }," |
| 536 " 'permissions': [" | 416 " 'permissions': [" |
| 537 " 'fileSystem', {'fileSystem': [" | 417 " 'fileSystem', {'fileSystem': [" |
| 538 " 'retainEntries', 'write', 'directory'" | 418 " 'retainEntries', 'write', 'directory'" |
| 539 " ]}" | 419 " ]}" |
| 540 " ]" | 420 " ]" |
| 541 "}"); | 421 "}"); |
| 542 ASSERT_TRUE(CheckManifestProducesPermissions( | 422 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 543 "Write to files and folders that you open in the application")); | 423 "Write to files and folders that you open in the application")); |
| 544 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 545 } | 424 } |
| 546 | 425 |
| 547 // Check that host permission messages are generated correctly when URLs are | 426 // Check that host permission messages are generated correctly when URLs are |
| 548 // entered as permissions. | 427 // entered as permissions. |
| 549 TEST_F(PermissionMessageCombinationsUnittest, HostsPermissionMessages) { | 428 TEST_F(PermissionMessageCombinationsUnittest, HostsPermissionMessages) { |
| 550 CreateAndInstall( | 429 CreateAndInstall( |
| 551 "{" | 430 "{" |
| 552 " 'permissions': [" | 431 " 'permissions': [" |
| 553 " 'http://www.blogger.com/'," | 432 " 'http://www.blogger.com/'," |
| 554 " ]" | 433 " ]" |
| 555 "}"); | 434 "}"); |
| 556 ASSERT_TRUE(CheckManifestProducesPermissions( | 435 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 557 "Read and change your data on www.blogger.com")); | 436 "Read and change your data on www.blogger.com")); |
| 558 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 559 | 437 |
| 560 CreateAndInstall( | 438 CreateAndInstall( |
| 561 "{" | 439 "{" |
| 562 " 'permissions': [" | 440 " 'permissions': [" |
| 563 " 'http://*.google.com/'," | 441 " 'http://*.google.com/'," |
| 564 " ]" | 442 " ]" |
| 565 "}"); | 443 "}"); |
| 566 ASSERT_TRUE(CheckManifestProducesPermissions( | 444 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 567 "Read and change your data on all google.com sites")); | 445 "Read and change your data on all google.com sites")); |
| 568 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 569 | 446 |
| 570 CreateAndInstall( | 447 CreateAndInstall( |
| 571 "{" | 448 "{" |
| 572 " 'permissions': [" | 449 " 'permissions': [" |
| 573 " 'http://www.blogger.com/'," | 450 " 'http://www.blogger.com/'," |
| 574 " 'http://*.google.com/'," | 451 " 'http://*.google.com/'," |
| 575 " ]" | 452 " ]" |
| 576 "}"); | 453 "}"); |
| 577 ASSERT_TRUE(CheckManifestProducesPermissions( | 454 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 578 "Read and change your data on all google.com sites and " | 455 "Read and change your data on all google.com sites and " |
| 579 "www.blogger.com")); | 456 "www.blogger.com")); |
| 580 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 581 | 457 |
| 582 CreateAndInstall( | 458 CreateAndInstall( |
| 583 "{" | 459 "{" |
| 584 " 'permissions': [" | 460 " 'permissions': [" |
| 585 " 'http://www.blogger.com/'," | 461 " 'http://www.blogger.com/'," |
| 586 " 'http://*.google.com/'," | 462 " 'http://*.google.com/'," |
| 587 " 'http://*.news.com/'," | 463 " 'http://*.news.com/'," |
| 588 " ]" | 464 " ]" |
| 589 "}"); | 465 "}"); |
| 590 ASSERT_TRUE(CheckManifestProducesPermissions( | 466 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 591 "Read and change your data on all google.com sites, all news.com sites, " | 467 "Read and change your data on all google.com sites, all news.com sites, " |
| 592 "and www.blogger.com")); | 468 "and www.blogger.com")); |
| 593 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 594 | 469 |
| 595 CreateAndInstall( | 470 CreateAndInstall( |
| 596 "{" | 471 "{" |
| 597 " 'permissions': [" | 472 " 'permissions': [" |
| 598 " 'http://www.blogger.com/'," | 473 " 'http://www.blogger.com/'," |
| 599 " 'http://*.google.com/'," | 474 " 'http://*.google.com/'," |
| 600 " 'http://*.news.com/'," | 475 " 'http://*.news.com/'," |
| 601 " 'http://www.foobar.com/'," | 476 " 'http://www.foobar.com/'," |
| 602 " ]" | 477 " ]" |
| 603 "}"); | 478 "}"); |
| 479 std::vector<std::string> submessages; |
| 480 submessages.push_back("All google.com sites"); |
| 481 submessages.push_back("All news.com sites"); |
| 482 submessages.push_back("www.blogger.com"); |
| 483 submessages.push_back("www.foobar.com"); |
| 604 ASSERT_TRUE(CheckManifestProducesPermissions( | 484 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 605 "Read and change your data on a number of websites")); | 485 "Read and change your data on a number of websites", submessages)); |
| 606 ASSERT_TRUE(CheckManifestProducesHostPermissions( | |
| 607 "All google.com sites", "All news.com sites", "www.blogger.com", | |
| 608 "www.foobar.com")); | |
| 609 | 486 |
| 610 CreateAndInstall( | 487 CreateAndInstall( |
| 611 "{" | 488 "{" |
| 612 " 'permissions': [" | 489 " 'permissions': [" |
| 613 " 'http://www.blogger.com/'," | 490 " 'http://www.blogger.com/'," |
| 614 " 'http://*.google.com/'," | 491 " 'http://*.google.com/'," |
| 615 " 'http://*.news.com/'," | 492 " 'http://*.news.com/'," |
| 616 " 'http://www.foobar.com/'," | 493 " 'http://www.foobar.com/'," |
| 617 " 'http://*.go.com/'," | 494 " 'http://*.go.com/'," |
| 618 " ]" | 495 " ]" |
| 619 "}"); | 496 "}"); |
| 497 submessages.clear(); |
| 498 submessages.push_back("All go.com sites"); |
| 499 submessages.push_back("All google.com sites"); |
| 500 submessages.push_back("All news.com sites"); |
| 501 submessages.push_back("www.blogger.com"); |
| 502 submessages.push_back("www.foobar.com"); |
| 620 ASSERT_TRUE(CheckManifestProducesPermissions( | 503 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 621 "Read and change your data on a number of websites")); | 504 "Read and change your data on a number of websites", submessages)); |
| 622 ASSERT_TRUE(CheckManifestProducesHostPermissions( | |
| 623 "All go.com sites", "All google.com sites", "All news.com sites", | |
| 624 "www.blogger.com", "www.foobar.com")); | |
| 625 | 505 |
| 626 CreateAndInstall( | 506 CreateAndInstall( |
| 627 "{" | 507 "{" |
| 628 " 'permissions': [" | 508 " 'permissions': [" |
| 629 " 'http://*.go.com/'," | 509 " 'http://*.go.com/'," |
| 630 " 'chrome://favicon/'," | 510 " 'chrome://favicon/'," |
| 631 " ]" | 511 " ]" |
| 632 "}"); | 512 "}"); |
| 633 ASSERT_TRUE(CheckManifestProducesPermissions( | 513 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 634 "Read and change your data on all go.com sites", | 514 "Read and change your data on all go.com sites", |
| 635 "Read the icons of the websites you visit")); | 515 "Read the icons of the websites you visit")); |
| 636 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 637 | 516 |
| 638 // Having the 'all sites' permission doesn't change the permission message, | 517 // Having the 'all sites' permission doesn't change the permission message, |
| 639 // since its pseudo-granted at runtime. | 518 // since its pseudo-granted at runtime. |
| 640 CreateAndInstall( | 519 CreateAndInstall( |
| 641 "{" | 520 "{" |
| 642 " 'permissions': [" | 521 " 'permissions': [" |
| 643 " 'http://*.go.com/'," | 522 " 'http://*.go.com/'," |
| 644 " 'chrome://favicon/'," | 523 " 'chrome://favicon/'," |
| 645 " 'http://*.*'," | 524 " 'http://*.*'," |
| 646 " ]" | 525 " ]" |
| 647 "}"); | 526 "}"); |
| 648 ASSERT_TRUE(CheckManifestProducesPermissions( | 527 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 649 "Read and change your data on all go.com sites", | 528 "Read and change your data on all go.com sites", |
| 650 "Read the icons of the websites you visit")); | 529 "Read the icons of the websites you visit")); |
| 651 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 652 } | 530 } |
| 653 | 531 |
| 654 // Check that permission messages are generated correctly for | 532 // Check that permission messages are generated correctly for |
| 655 // SocketsManifestPermission, which has host-like permission messages. | 533 // SocketsManifestPermission, which has host-like permission messages. |
| 656 TEST_F(PermissionMessageCombinationsUnittest, | 534 TEST_F(PermissionMessageCombinationsUnittest, |
| 657 SocketsManifestPermissionMessages) { | 535 SocketsManifestPermissionMessages) { |
| 658 CreateAndInstall( | 536 CreateAndInstall( |
| 659 "{" | 537 "{" |
| 660 " 'app': {" | 538 " 'app': {" |
| 661 " 'background': {" | 539 " 'background': {" |
| 662 " 'scripts': ['background.js']" | 540 " 'scripts': ['background.js']" |
| 663 " }" | 541 " }" |
| 664 " }," | 542 " }," |
| 665 " 'sockets': {" | 543 " 'sockets': {" |
| 666 " 'udp': {'send': '*'}," | 544 " 'udp': {'send': '*'}," |
| 667 " }" | 545 " }" |
| 668 "}"); | 546 "}"); |
| 669 ASSERT_TRUE(CheckManifestProducesPermissions( | 547 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 670 "Exchange data with any computer on the local network or internet")); | 548 "Exchange data with any computer on the local network or internet")); |
| 671 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 672 | 549 |
| 673 CreateAndInstall( | 550 CreateAndInstall( |
| 674 "{" | 551 "{" |
| 675 " 'app': {" | 552 " 'app': {" |
| 676 " 'background': {" | 553 " 'background': {" |
| 677 " 'scripts': ['background.js']" | 554 " 'scripts': ['background.js']" |
| 678 " }" | 555 " }" |
| 679 " }," | 556 " }," |
| 680 " 'sockets': {" | 557 " 'sockets': {" |
| 681 " 'udp': {'send': ':99'}," | 558 " 'udp': {'send': ':99'}," |
| 682 " }" | 559 " }" |
| 683 "}"); | 560 "}"); |
| 684 ASSERT_TRUE(CheckManifestProducesPermissions( | 561 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 685 "Exchange data with any computer on the local network or internet")); | 562 "Exchange data with any computer on the local network or internet")); |
| 686 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 687 | 563 |
| 688 CreateAndInstall( | 564 CreateAndInstall( |
| 689 "{" | 565 "{" |
| 690 " 'app': {" | 566 " 'app': {" |
| 691 " 'background': {" | 567 " 'background': {" |
| 692 " 'scripts': ['background.js']" | 568 " 'scripts': ['background.js']" |
| 693 " }" | 569 " }" |
| 694 " }," | 570 " }," |
| 695 " 'sockets': {" | 571 " 'sockets': {" |
| 696 " 'tcp': {'connect': '127.0.0.1:80'}," | 572 " 'tcp': {'connect': '127.0.0.1:80'}," |
| 697 " }" | 573 " }" |
| 698 "}"); | 574 "}"); |
| 699 ASSERT_TRUE(CheckManifestProducesPermissions( | 575 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 700 "Exchange data with the computer named 127.0.0.1")); | 576 "Exchange data with the computer named 127.0.0.1")); |
| 701 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 702 | 577 |
| 703 CreateAndInstall( | 578 CreateAndInstall( |
| 704 "{" | 579 "{" |
| 705 " 'app': {" | 580 " 'app': {" |
| 706 " 'background': {" | 581 " 'background': {" |
| 707 " 'scripts': ['background.js']" | 582 " 'scripts': ['background.js']" |
| 708 " }" | 583 " }" |
| 709 " }," | 584 " }," |
| 710 " 'sockets': {" | 585 " 'sockets': {" |
| 711 " 'tcp': {'connect': 'www.example.com:23'}," | 586 " 'tcp': {'connect': 'www.example.com:23'}," |
| 712 " }" | 587 " }" |
| 713 "}"); | 588 "}"); |
| 714 ASSERT_TRUE(CheckManifestProducesPermissions( | 589 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 715 "Exchange data with the computer named www.example.com")); | 590 "Exchange data with the computer named www.example.com")); |
| 716 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 717 | 591 |
| 718 CreateAndInstall( | 592 CreateAndInstall( |
| 719 "{" | 593 "{" |
| 720 " 'app': {" | 594 " 'app': {" |
| 721 " 'background': {" | 595 " 'background': {" |
| 722 " 'scripts': ['background.js']" | 596 " 'scripts': ['background.js']" |
| 723 " }" | 597 " }" |
| 724 " }," | 598 " }," |
| 725 " 'sockets': {" | 599 " 'sockets': {" |
| 726 " 'tcpServer': {'listen': '127.0.0.1:80'}" | 600 " 'tcpServer': {'listen': '127.0.0.1:80'}" |
| 727 " }" | 601 " }" |
| 728 "}"); | 602 "}"); |
| 729 ASSERT_TRUE(CheckManifestProducesPermissions( | 603 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 730 "Exchange data with the computer named 127.0.0.1")); | 604 "Exchange data with the computer named 127.0.0.1")); |
| 731 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 732 | 605 |
| 733 CreateAndInstall( | 606 CreateAndInstall( |
| 734 "{" | 607 "{" |
| 735 " 'app': {" | 608 " 'app': {" |
| 736 " 'background': {" | 609 " 'background': {" |
| 737 " 'scripts': ['background.js']" | 610 " 'scripts': ['background.js']" |
| 738 " }" | 611 " }" |
| 739 " }," | 612 " }," |
| 740 " 'sockets': {" | 613 " 'sockets': {" |
| 741 " 'tcpServer': {'listen': ':8080'}" | 614 " 'tcpServer': {'listen': ':8080'}" |
| 742 " }" | 615 " }" |
| 743 "}"); | 616 "}"); |
| 744 ASSERT_TRUE(CheckManifestProducesPermissions( | 617 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 745 "Exchange data with any computer on the local network or internet")); | 618 "Exchange data with any computer on the local network or internet")); |
| 746 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 747 | 619 |
| 748 CreateAndInstall( | 620 CreateAndInstall( |
| 749 "{" | 621 "{" |
| 750 " 'app': {" | 622 " 'app': {" |
| 751 " 'background': {" | 623 " 'background': {" |
| 752 " 'scripts': ['background.js']" | 624 " 'scripts': ['background.js']" |
| 753 " }" | 625 " }" |
| 754 " }," | 626 " }," |
| 755 " 'sockets': {" | 627 " 'sockets': {" |
| 756 " 'tcpServer': {" | 628 " 'tcpServer': {" |
| 757 " 'listen': [" | 629 " 'listen': [" |
| 758 " '127.0.0.1:80'," | 630 " '127.0.0.1:80'," |
| 759 " 'www.google.com'," | 631 " 'www.google.com'," |
| 760 " 'www.example.com:*'," | 632 " 'www.example.com:*'," |
| 761 " 'www.foo.com:200'," | 633 " 'www.foo.com:200'," |
| 762 " 'www.bar.com:200'" | 634 " 'www.bar.com:200'" |
| 763 " ]" | 635 " ]" |
| 764 " }" | 636 " }" |
| 765 " }" | 637 " }" |
| 766 "}"); | 638 "}"); |
| 767 ASSERT_TRUE(CheckManifestProducesPermissions( | 639 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 768 "Exchange data with the computers named: 127.0.0.1 www.bar.com " | 640 "Exchange data with the computers named: 127.0.0.1 www.bar.com " |
| 769 "www.example.com www.foo.com www.google.com")); | 641 "www.example.com www.foo.com www.google.com")); |
| 770 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 771 | 642 |
| 772 CreateAndInstall( | 643 CreateAndInstall( |
| 773 "{" | 644 "{" |
| 774 " 'app': {" | 645 " 'app': {" |
| 775 " 'background': {" | 646 " 'background': {" |
| 776 " 'scripts': ['background.js']" | 647 " 'scripts': ['background.js']" |
| 777 " }" | 648 " }" |
| 778 " }," | 649 " }," |
| 779 " 'sockets': {" | 650 " 'sockets': {" |
| 780 " 'tcp': {" | 651 " 'tcp': {" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 793 " 'www.example.com:*'," | 664 " 'www.example.com:*'," |
| 794 " 'www.foo.com:200'," | 665 " 'www.foo.com:200'," |
| 795 " ]" | 666 " ]" |
| 796 " }" | 667 " }" |
| 797 " }" | 668 " }" |
| 798 "}"); | 669 "}"); |
| 799 ASSERT_TRUE(CheckManifestProducesPermissions( | 670 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 800 "Exchange data with the computers named: 127.0.0.1 www.abc.com " | 671 "Exchange data with the computers named: 127.0.0.1 www.abc.com " |
| 801 "www.example.com www.foo.com www.freestuff.com www.google.com " | 672 "www.example.com www.foo.com www.freestuff.com www.google.com " |
| 802 "www.mywebsite.com www.test.com")); | 673 "www.mywebsite.com www.test.com")); |
| 803 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 804 | 674 |
| 805 CreateAndInstall( | 675 CreateAndInstall( |
| 806 "{" | 676 "{" |
| 807 " 'app': {" | 677 " 'app': {" |
| 808 " 'background': {" | 678 " 'background': {" |
| 809 " 'scripts': ['background.js']" | 679 " 'scripts': ['background.js']" |
| 810 " }" | 680 " }" |
| 811 " }," | 681 " }," |
| 812 " 'sockets': {" | 682 " 'sockets': {" |
| 813 " 'tcp': {'send': '*:*'}," | 683 " 'tcp': {'send': '*:*'}," |
| 814 " 'tcpServer': {'listen': '*:*'}," | 684 " 'tcpServer': {'listen': '*:*'}," |
| 815 " }" | 685 " }" |
| 816 "}"); | 686 "}"); |
| 817 ASSERT_TRUE(CheckManifestProducesPermissions( | 687 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 818 "Exchange data with any computer on the local network or internet")); | 688 "Exchange data with any computer on the local network or internet")); |
| 819 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 820 } | 689 } |
| 821 | 690 |
| 822 // Check that permission messages are generated correctly for | 691 // Check that permission messages are generated correctly for |
| 823 // MediaGalleriesPermission (an API permission with custom messages). | 692 // MediaGalleriesPermission (an API permission with custom messages). |
| 824 TEST_F(PermissionMessageCombinationsUnittest, | 693 TEST_F(PermissionMessageCombinationsUnittest, |
| 825 MediaGalleriesPermissionMessages) { | 694 MediaGalleriesPermissionMessages) { |
| 826 CreateAndInstall( | 695 CreateAndInstall( |
| 827 "{" | 696 "{" |
| 828 " 'app': {" | 697 " 'app': {" |
| 829 " 'background': {" | 698 " 'background': {" |
| 830 " 'scripts': ['background.js']" | 699 " 'scripts': ['background.js']" |
| 831 " }" | 700 " }" |
| 832 " }," | 701 " }," |
| 833 " 'permissions': [" | 702 " 'permissions': [" |
| 834 " { 'mediaGalleries': ['read'] }" | 703 " { 'mediaGalleries': ['read'] }" |
| 835 " ]" | 704 " ]" |
| 836 "}"); | 705 "}"); |
| 837 ASSERT_TRUE(CheckManifestProducesPermissions()); | 706 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 838 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 839 | 707 |
| 840 CreateAndInstall( | 708 CreateAndInstall( |
| 841 "{" | 709 "{" |
| 842 " 'app': {" | 710 " 'app': {" |
| 843 " 'background': {" | 711 " 'background': {" |
| 844 " 'scripts': ['background.js']" | 712 " 'scripts': ['background.js']" |
| 845 " }" | 713 " }" |
| 846 " }," | 714 " }," |
| 847 " 'permissions': [" | 715 " 'permissions': [" |
| 848 " { 'mediaGalleries': ['read', 'allAutoDetected'] }" | 716 " { 'mediaGalleries': ['read', 'allAutoDetected'] }" |
| 849 " ]" | 717 " ]" |
| 850 "}"); | 718 "}"); |
| 851 ASSERT_TRUE(CheckManifestProducesPermissions( | 719 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 852 "Access photos, music, and other media from your computer")); | 720 "Access photos, music, and other media from your computer")); |
| 853 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 854 | 721 |
| 855 // TODO(sashab): Add a test for the | 722 // TODO(sashab): Add a test for the |
| 856 // IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_WRITE message (generated | 723 // IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_WRITE message (generated |
| 857 // with the 'read' and 'copyTo' permissions, but not the 'delete' permission), | 724 // with the 'read' and 'copyTo' permissions, but not the 'delete' permission), |
| 858 // if it's possible to get this message. Otherwise, remove it from the code. | 725 // if it's possible to get this message. Otherwise, remove it from the code. |
| 859 | 726 |
| 860 CreateAndInstall( | 727 CreateAndInstall( |
| 861 "{" | 728 "{" |
| 862 " 'app': {" | 729 " 'app': {" |
| 863 " 'background': {" | 730 " 'background': {" |
| 864 " 'scripts': ['background.js']" | 731 " 'scripts': ['background.js']" |
| 865 " }" | 732 " }" |
| 866 " }," | 733 " }," |
| 867 " 'permissions': [" | 734 " 'permissions': [" |
| 868 " { 'mediaGalleries': ['read', 'delete', 'allAutoDetected'] }" | 735 " { 'mediaGalleries': ['read', 'delete', 'allAutoDetected'] }" |
| 869 " ]" | 736 " ]" |
| 870 "}"); | 737 "}"); |
| 871 ASSERT_TRUE(CheckManifestProducesPermissions( | 738 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 872 "Read and delete photos, music, and other media from your computer")); | 739 "Read and delete photos, music, and other media from your computer")); |
| 873 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 874 | 740 |
| 875 CreateAndInstall( | 741 CreateAndInstall( |
| 876 "{" | 742 "{" |
| 877 " 'app': {" | 743 " 'app': {" |
| 878 " 'background': {" | 744 " 'background': {" |
| 879 " 'scripts': ['background.js']" | 745 " 'scripts': ['background.js']" |
| 880 " }" | 746 " }" |
| 881 " }," | 747 " }," |
| 882 " 'permissions': [" | 748 " 'permissions': [" |
| 883 " { 'mediaGalleries':" | 749 " { 'mediaGalleries':" |
| 884 " [ 'read', 'delete', 'copyTo', 'allAutoDetected' ] }" | 750 " [ 'read', 'delete', 'copyTo', 'allAutoDetected' ] }" |
| 885 " ]" | 751 " ]" |
| 886 "}"); | 752 "}"); |
| 887 ASSERT_TRUE(CheckManifestProducesPermissions( | 753 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 888 "Read, change and delete photos, music, and other media from your " | 754 "Read, change and delete photos, music, and other media from your " |
| 889 "computer")); | 755 "computer")); |
| 890 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 891 | 756 |
| 892 // Without the allAutoDetected permission, there should be no install-time | 757 // Without the allAutoDetected permission, there should be no install-time |
| 893 // permission messages. | 758 // permission messages. |
| 894 CreateAndInstall( | 759 CreateAndInstall( |
| 895 "{" | 760 "{" |
| 896 " 'app': {" | 761 " 'app': {" |
| 897 " 'background': {" | 762 " 'background': {" |
| 898 " 'scripts': ['background.js']" | 763 " 'scripts': ['background.js']" |
| 899 " }" | 764 " }" |
| 900 " }," | 765 " }," |
| 901 " 'permissions': [" | 766 " 'permissions': [" |
| 902 " { 'mediaGalleries': ['read', 'delete', 'copyTo'] }" | 767 " { 'mediaGalleries': ['read', 'delete', 'copyTo'] }" |
| 903 " ]" | 768 " ]" |
| 904 "}"); | 769 "}"); |
| 905 ASSERT_TRUE(CheckManifestProducesPermissions()); | 770 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 906 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 907 } | 771 } |
| 908 | 772 |
| 909 // TODO(sashab): Add tests for SettingsOverrideAPIPermission (an API permission | 773 // TODO(sashab): Add tests for SettingsOverrideAPIPermission (an API permission |
| 910 // with custom messages). | 774 // with custom messages). |
| 911 | 775 |
| 912 // Check that permission messages are generated correctly for SocketPermission | 776 // Check that permission messages are generated correctly for SocketPermission |
| 913 // (an API permission with custom messages). | 777 // (an API permission with custom messages). |
| 914 TEST_F(PermissionMessageCombinationsUnittest, SocketPermissionMessages) { | 778 TEST_F(PermissionMessageCombinationsUnittest, SocketPermissionMessages) { |
| 915 CreateAndInstall( | 779 CreateAndInstall( |
| 916 "{" | 780 "{" |
| 917 " 'app': {" | 781 " 'app': {" |
| 918 " 'background': {" | 782 " 'background': {" |
| 919 " 'scripts': ['background.js']" | 783 " 'scripts': ['background.js']" |
| 920 " }" | 784 " }" |
| 921 " }," | 785 " }," |
| 922 " 'permissions': [" | 786 " 'permissions': [" |
| 923 " { 'socket': ['tcp-connect:*:*'] }" | 787 " { 'socket': ['tcp-connect:*:*'] }" |
| 924 " ]" | 788 " ]" |
| 925 "}"); | 789 "}"); |
| 926 ASSERT_TRUE(CheckManifestProducesPermissions( | 790 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 927 "Exchange data with any computer on the local network or internet")); | 791 "Exchange data with any computer on the local network or internet")); |
| 928 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 929 | 792 |
| 930 CreateAndInstall( | 793 CreateAndInstall( |
| 931 "{" | 794 "{" |
| 932 " 'app': {" | 795 " 'app': {" |
| 933 " 'background': {" | 796 " 'background': {" |
| 934 " 'scripts': ['background.js']" | 797 " 'scripts': ['background.js']" |
| 935 " }" | 798 " }" |
| 936 " }," | 799 " }," |
| 937 " 'permissions': [" | 800 " 'permissions': [" |
| 938 " { 'socket': [" | 801 " { 'socket': [" |
| 939 " 'tcp-connect:*:443'," | 802 " 'tcp-connect:*:443'," |
| 940 " 'tcp-connect:*:50032'," | 803 " 'tcp-connect:*:50032'," |
| 941 " 'tcp-connect:*:23'," | 804 " 'tcp-connect:*:23'," |
| 942 " ] }" | 805 " ] }" |
| 943 " ]" | 806 " ]" |
| 944 "}"); | 807 "}"); |
| 945 ASSERT_TRUE(CheckManifestProducesPermissions( | 808 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 946 "Exchange data with any computer on the local network or internet")); | 809 "Exchange data with any computer on the local network or internet")); |
| 947 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 948 | 810 |
| 949 CreateAndInstall( | 811 CreateAndInstall( |
| 950 "{" | 812 "{" |
| 951 " 'app': {" | 813 " 'app': {" |
| 952 " 'background': {" | 814 " 'background': {" |
| 953 " 'scripts': ['background.js']" | 815 " 'scripts': ['background.js']" |
| 954 " }" | 816 " }" |
| 955 " }," | 817 " }," |
| 956 " 'permissions': [" | 818 " 'permissions': [" |
| 957 " { 'socket': ['tcp-connect:foo.example.com:443'] }" | 819 " { 'socket': ['tcp-connect:foo.example.com:443'] }" |
| 958 " ]" | 820 " ]" |
| 959 "}"); | 821 "}"); |
| 960 ASSERT_TRUE(CheckManifestProducesPermissions( | 822 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 961 "Exchange data with the computer named foo.example.com")); | 823 "Exchange data with the computer named foo.example.com")); |
| 962 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 963 | 824 |
| 964 CreateAndInstall( | 825 CreateAndInstall( |
| 965 "{" | 826 "{" |
| 966 " 'app': {" | 827 " 'app': {" |
| 967 " 'background': {" | 828 " 'background': {" |
| 968 " 'scripts': ['background.js']" | 829 " 'scripts': ['background.js']" |
| 969 " }" | 830 " }" |
| 970 " }," | 831 " }," |
| 971 " 'permissions': [" | 832 " 'permissions': [" |
| 972 " { 'socket': ['tcp-connect:foo.example.com:443', 'udp-send-to'] }" | 833 " { 'socket': ['tcp-connect:foo.example.com:443', 'udp-send-to'] }" |
| 973 " ]" | 834 " ]" |
| 974 "}"); | 835 "}"); |
| 975 ASSERT_TRUE(CheckManifestProducesPermissions( | 836 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 976 "Exchange data with any computer on the local network or internet")); | 837 "Exchange data with any computer on the local network or internet")); |
| 977 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 978 | 838 |
| 979 CreateAndInstall( | 839 CreateAndInstall( |
| 980 "{" | 840 "{" |
| 981 " 'app': {" | 841 " 'app': {" |
| 982 " 'background': {" | 842 " 'background': {" |
| 983 " 'scripts': ['background.js']" | 843 " 'scripts': ['background.js']" |
| 984 " }" | 844 " }" |
| 985 " }," | 845 " }," |
| 986 " 'permissions': [" | 846 " 'permissions': [" |
| 987 " { 'socket': [" | 847 " { 'socket': [" |
| 988 " 'tcp-connect:foo.example.com:443'," | 848 " 'tcp-connect:foo.example.com:443'," |
| 989 " 'udp-send-to:test.ping.com:50032'," | 849 " 'udp-send-to:test.ping.com:50032'," |
| 990 " ] }" | 850 " ] }" |
| 991 " ]" | 851 " ]" |
| 992 "}"); | 852 "}"); |
| 993 ASSERT_TRUE(CheckManifestProducesPermissions( | 853 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 994 "Exchange data with the computers named: foo.example.com test.ping.com")); | 854 "Exchange data with the computers named: foo.example.com test.ping.com")); |
| 995 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 996 | 855 |
| 997 CreateAndInstall( | 856 CreateAndInstall( |
| 998 "{" | 857 "{" |
| 999 " 'app': {" | 858 " 'app': {" |
| 1000 " 'background': {" | 859 " 'background': {" |
| 1001 " 'scripts': ['background.js']" | 860 " 'scripts': ['background.js']" |
| 1002 " }" | 861 " }" |
| 1003 " }," | 862 " }," |
| 1004 " 'permissions': [" | 863 " 'permissions': [" |
| 1005 " { 'socket': [" | 864 " { 'socket': [" |
| 1006 " 'tcp-connect:foo.example.com:443'," | 865 " 'tcp-connect:foo.example.com:443'," |
| 1007 " 'udp-send-to:test.ping.com:50032'," | 866 " 'udp-send-to:test.ping.com:50032'," |
| 1008 " 'udp-send-to:www.ping.com:50032'," | 867 " 'udp-send-to:www.ping.com:50032'," |
| 1009 " 'udp-send-to:test2.ping.com:50032'," | 868 " 'udp-send-to:test2.ping.com:50032'," |
| 1010 " 'udp-bind:test.ping.com:50032'," | 869 " 'udp-bind:test.ping.com:50032'," |
| 1011 " ] }" | 870 " ] }" |
| 1012 " ]" | 871 " ]" |
| 1013 "}"); | 872 "}"); |
| 1014 ASSERT_TRUE(CheckManifestProducesPermissions( | 873 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1015 "Exchange data with the computers named: foo.example.com test.ping.com " | 874 "Exchange data with the computers named: foo.example.com test.ping.com " |
| 1016 "test2.ping.com www.ping.com")); | 875 "test2.ping.com www.ping.com")); |
| 1017 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1018 | 876 |
| 1019 CreateAndInstall( | 877 CreateAndInstall( |
| 1020 "{" | 878 "{" |
| 1021 " 'app': {" | 879 " 'app': {" |
| 1022 " 'background': {" | 880 " 'background': {" |
| 1023 " 'scripts': ['background.js']" | 881 " 'scripts': ['background.js']" |
| 1024 " }" | 882 " }" |
| 1025 " }," | 883 " }," |
| 1026 " 'permissions': [" | 884 " 'permissions': [" |
| 1027 " { 'socket': [" | 885 " { 'socket': [" |
| 1028 " 'tcp-connect:foo.example.com:443'," | 886 " 'tcp-connect:foo.example.com:443'," |
| 1029 " 'udp-send-to:test.ping.com:50032'," | 887 " 'udp-send-to:test.ping.com:50032'," |
| 1030 " 'tcp-connect:*:23'," | 888 " 'tcp-connect:*:23'," |
| 1031 " ] }" | 889 " ] }" |
| 1032 " ]" | 890 " ]" |
| 1033 "}"); | 891 "}"); |
| 1034 ASSERT_TRUE(CheckManifestProducesPermissions( | 892 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1035 "Exchange data with any computer on the local network or internet")); | 893 "Exchange data with any computer on the local network or internet")); |
| 1036 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1037 } | 894 } |
| 1038 | 895 |
| 1039 // Check that permission messages are generated correctly for | 896 // Check that permission messages are generated correctly for |
| 1040 // USBDevicePermission (an API permission with custom messages). | 897 // USBDevicePermission (an API permission with custom messages). |
| 1041 TEST_F(PermissionMessageCombinationsUnittest, USBDevicePermissionMessages) { | 898 TEST_F(PermissionMessageCombinationsUnittest, USBDevicePermissionMessages) { |
| 1042 CreateAndInstall( | 899 CreateAndInstall( |
| 1043 "{" | 900 "{" |
| 1044 " 'app': {" | 901 " 'app': {" |
| 1045 " 'background': {" | 902 " 'background': {" |
| 1046 " 'scripts': ['background.js']" | 903 " 'scripts': ['background.js']" |
| 1047 " }" | 904 " }" |
| 1048 " }," | 905 " }," |
| 1049 " 'permissions': [" | 906 " 'permissions': [" |
| 1050 " { 'usbDevices': [" | 907 " { 'usbDevices': [" |
| 1051 " { 'vendorId': 0, 'productId': 0 }," | 908 " { 'vendorId': 0, 'productId': 0 }," |
| 1052 " ] }" | 909 " ] }" |
| 1053 " ]" | 910 " ]" |
| 1054 "}"); | 911 "}"); |
| 1055 ASSERT_TRUE(CheckManifestProducesPermissions( | 912 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1056 "Access USB devices from an unknown vendor")); | 913 "Access USB devices from an unknown vendor")); |
| 1057 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1058 | 914 |
| 1059 CreateAndInstall( | 915 CreateAndInstall( |
| 1060 "{" | 916 "{" |
| 1061 " 'app': {" | 917 " 'app': {" |
| 1062 " 'background': {" | 918 " 'background': {" |
| 1063 " 'scripts': ['background.js']" | 919 " 'scripts': ['background.js']" |
| 1064 " }" | 920 " }" |
| 1065 " }," | 921 " }," |
| 1066 " 'permissions': [" | 922 " 'permissions': [" |
| 1067 " { 'usbDevices': [" | 923 " { 'usbDevices': [" |
| 1068 " { 'vendorId': 4179, 'productId': 529 }," | 924 " { 'vendorId': 4179, 'productId': 529 }," |
| 1069 " ] }" | 925 " ] }" |
| 1070 " ]" | 926 " ]" |
| 1071 "}"); | 927 "}"); |
| 1072 ASSERT_TRUE(CheckManifestProducesPermissions( | 928 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1073 "Access USB devices from Immanuel Electronics Co., Ltd")); | 929 "Access USB devices from Immanuel Electronics Co., Ltd")); |
| 1074 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1075 | 930 |
| 1076 CreateAndInstall( | 931 CreateAndInstall( |
| 1077 "{" | 932 "{" |
| 1078 " 'app': {" | 933 " 'app': {" |
| 1079 " 'background': {" | 934 " 'background': {" |
| 1080 " 'scripts': ['background.js']" | 935 " 'scripts': ['background.js']" |
| 1081 " }" | 936 " }" |
| 1082 " }," | 937 " }," |
| 1083 " 'permissions': [" | 938 " 'permissions': [" |
| 1084 " { 'usbDevices': [" | 939 " { 'usbDevices': [" |
| 1085 " { 'vendorId': 6353, 'productId': 8192 }," | 940 " { 'vendorId': 6353, 'productId': 8192 }," |
| 1086 " ] }" | 941 " ] }" |
| 1087 " ]" | 942 " ]" |
| 1088 "}"); | 943 "}"); |
| 1089 ASSERT_TRUE( | 944 ASSERT_TRUE( |
| 1090 CheckManifestProducesPermissions("Access USB devices from Google Inc.")); | 945 CheckManifestProducesPermissions("Access USB devices from Google Inc.")); |
| 1091 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1092 | 946 |
| 1093 CreateAndInstall( | 947 CreateAndInstall( |
| 1094 "{" | 948 "{" |
| 1095 " 'app': {" | 949 " 'app': {" |
| 1096 " 'background': {" | 950 " 'background': {" |
| 1097 " 'scripts': ['background.js']" | 951 " 'scripts': ['background.js']" |
| 1098 " }" | 952 " }" |
| 1099 " }," | 953 " }," |
| 1100 " 'permissions': [" | 954 " 'permissions': [" |
| 1101 " { 'usbDevices': [" | 955 " { 'usbDevices': [" |
| 1102 " { 'vendorId': 4179, 'productId': 529 }," | 956 " { 'vendorId': 4179, 'productId': 529 }," |
| 1103 " { 'vendorId': 6353, 'productId': 8192 }," | 957 " { 'vendorId': 6353, 'productId': 8192 }," |
| 1104 " ] }" | 958 " ] }" |
| 1105 " ]" | 959 " ]" |
| 1106 "}"); | 960 "}"); |
| 1107 ASSERT_TRUE( | 961 std::vector<std::string> submessages; |
| 1108 CheckManifestProducesPermissions("Access any of these USB devices")); | 962 submessages.push_back("unknown devices from Immanuel Electronics Co., Ltd"); |
| 1109 | 963 submessages.push_back("unknown devices from Google Inc."); |
| 1110 // Although technically not host permissions, devices are currently stored in | 964 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1111 // the 'host permissions' (details list) for the USB permission, in the same | 965 "Access any of these USB devices", submessages)); |
| 1112 // format. | |
| 1113 // TODO(sashab): Rename host permissions to 'details list' or 'nested | |
| 1114 // permissions', and change this test system to allow specifying each message | |
| 1115 // as well as its corresponding nested messages, if any. Also add a test that | |
| 1116 // uses this to test an app with multiple nested permission lists (e.g. both | |
| 1117 // USB and host permissions). | |
| 1118 ASSERT_TRUE(CheckManifestProducesHostPermissions( | |
| 1119 "unknown devices from Immanuel Electronics Co., Ltd", | |
| 1120 "unknown devices from Google Inc.")); | |
| 1121 | 966 |
| 1122 // TODO(sashab): Add a test with a valid product/vendor USB device. | 967 // TODO(sashab): Add a test with a valid product/vendor USB device. |
| 1123 } | 968 } |
| 1124 | 969 |
| 1125 // Test that hosted apps are not given any messages for host permissions. | 970 // Test that hosted apps are not given any messages for host permissions. |
| 1126 TEST_F(PermissionMessageCombinationsUnittest, | 971 TEST_F(PermissionMessageCombinationsUnittest, |
| 1127 PackagedAppsHaveNoHostPermissions) { | 972 PackagedAppsHaveNoHostPermissions) { |
| 1128 CreateAndInstall( | 973 CreateAndInstall( |
| 1129 "{" | 974 "{" |
| 1130 " 'app': {" | 975 " 'app': {" |
| 1131 " 'background': {" | 976 " 'background': {" |
| 1132 " 'scripts': ['background.js']" | 977 " 'scripts': ['background.js']" |
| 1133 " }" | 978 " }" |
| 1134 " }," | 979 " }," |
| 1135 " 'permissions': [" | 980 " 'permissions': [" |
| 1136 " 'http://www.blogger.com/'," | 981 " 'http://www.blogger.com/'," |
| 1137 " 'http://*.google.com/'," | 982 " 'http://*.google.com/'," |
| 1138 " ]" | 983 " ]" |
| 1139 "}"); | 984 "}"); |
| 1140 ASSERT_TRUE(CheckManifestProducesPermissions()); | 985 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 1141 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1142 | 986 |
| 1143 CreateAndInstall( | 987 CreateAndInstall( |
| 1144 "{" | 988 "{" |
| 1145 " 'app': {" | 989 " 'app': {" |
| 1146 " 'background': {" | 990 " 'background': {" |
| 1147 " 'scripts': ['background.js']" | 991 " 'scripts': ['background.js']" |
| 1148 " }" | 992 " }" |
| 1149 " }," | 993 " }," |
| 1150 " 'permissions': [" | 994 " 'permissions': [" |
| 1151 " 'serial'," | 995 " 'serial'," |
| 1152 " 'http://www.blogger.com/'," | 996 " 'http://www.blogger.com/'," |
| 1153 " 'http://*.google.com/'," | 997 " 'http://*.google.com/'," |
| 1154 " ]" | 998 " ]" |
| 1155 "}"); | 999 "}"); |
| 1156 ASSERT_TRUE(CheckManifestProducesPermissions("Access your serial devices")); | 1000 ASSERT_TRUE(CheckManifestProducesPermissions("Access your serial devices")); |
| 1157 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1158 } | 1001 } |
| 1159 | 1002 |
| 1160 // Test various apps with lots of permissions, including those with no | 1003 // Test various apps with lots of permissions, including those with no |
| 1161 // permission messages, or those that only apply to apps or extensions even when | 1004 // permission messages, or those that only apply to apps or extensions even when |
| 1162 // the given manifest is for a different type. | 1005 // the given manifest is for a different type. |
| 1163 TEST_F(PermissionMessageCombinationsUnittest, PermissionMessageCombos) { | 1006 TEST_F(PermissionMessageCombinationsUnittest, PermissionMessageCombos) { |
| 1164 CreateAndInstall( | 1007 CreateAndInstall( |
| 1165 "{" | 1008 "{" |
| 1166 " 'permissions': [" | 1009 " 'permissions': [" |
| 1167 " 'tabs'," | 1010 " 'tabs'," |
| 1168 " 'bookmarks'," | 1011 " 'bookmarks'," |
| 1169 " 'http://www.blogger.com/'," | 1012 " 'http://www.blogger.com/'," |
| 1170 " 'http://*.google.com/'," | 1013 " 'http://*.google.com/'," |
| 1171 " 'unlimitedStorage'," | 1014 " 'unlimitedStorage'," |
| 1172 " ]" | 1015 " ]" |
| 1173 "}"); | 1016 "}"); |
| 1174 ASSERT_TRUE(CheckManifestProducesPermissions( | 1017 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1175 "Read and change your data on all google.com sites and www.blogger.com", | 1018 "Read and change your data on all google.com sites and www.blogger.com", |
| 1176 "Read your browsing history", "Read and change your bookmarks")); | 1019 "Read your browsing history", "Read and change your bookmarks")); |
| 1177 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1178 | 1020 |
| 1179 CreateAndInstall( | 1021 CreateAndInstall( |
| 1180 "{" | 1022 "{" |
| 1181 " 'permissions': [" | 1023 " 'permissions': [" |
| 1182 " 'tabs'," | 1024 " 'tabs'," |
| 1183 " 'sessions'," | 1025 " 'sessions'," |
| 1184 " 'bookmarks'," | 1026 " 'bookmarks'," |
| 1185 " 'unlimitedStorage'," | 1027 " 'unlimitedStorage'," |
| 1186 " 'syncFileSystem'," | 1028 " 'syncFileSystem'," |
| 1187 " 'http://www.blogger.com/'," | 1029 " 'http://www.blogger.com/'," |
| 1188 " 'http://*.google.com/'," | 1030 " 'http://*.google.com/'," |
| 1189 " 'http://*.news.com/'," | 1031 " 'http://*.news.com/'," |
| 1190 " 'http://www.foobar.com/'," | 1032 " 'http://www.foobar.com/'," |
| 1191 " 'http://*.go.com/'," | 1033 " 'http://*.go.com/'," |
| 1192 " ]" | 1034 " ]" |
| 1193 "}"); | 1035 "}"); |
| 1036 std::vector<std::string> submessages; |
| 1037 submessages.push_back("All go.com sites"); |
| 1038 submessages.push_back("All google.com sites"); |
| 1039 submessages.push_back("All news.com sites"); |
| 1040 submessages.push_back("www.blogger.com"); |
| 1041 submessages.push_back("www.foobar.com"); |
| 1194 ASSERT_TRUE(CheckManifestProducesPermissions( | 1042 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1195 "Read your browsing history on all your signed-in devices", | 1043 "Read your browsing history on all your signed-in devices", |
| 1196 "Read and change your bookmarks", | 1044 std::vector<std::string>(), "Read and change your bookmarks", |
| 1197 "Read and change your data on a number of websites")); | 1045 std::vector<std::string>(), |
| 1198 ASSERT_TRUE(CheckManifestProducesHostPermissions( | 1046 "Read and change your data on a number of websites", submessages)); |
| 1199 "All go.com sites", "All google.com sites", "All news.com sites", | |
| 1200 "www.blogger.com", "www.foobar.com")); | |
| 1201 | 1047 |
| 1202 CreateAndInstall( | 1048 CreateAndInstall( |
| 1203 "{" | 1049 "{" |
| 1204 " 'permissions': [" | 1050 " 'permissions': [" |
| 1205 " 'tabs'," | 1051 " 'tabs'," |
| 1206 " 'sessions'," | 1052 " 'sessions'," |
| 1207 " 'bookmarks'," | 1053 " 'bookmarks'," |
| 1208 " 'accessibilityFeatures.read'," | 1054 " 'accessibilityFeatures.read'," |
| 1209 " 'accessibilityFeatures.modify'," | 1055 " 'accessibilityFeatures.modify'," |
| 1210 " 'alarms'," | 1056 " 'alarms'," |
| 1211 " 'browsingData'," | 1057 " 'browsingData'," |
| 1212 " 'cookies'," | 1058 " 'cookies'," |
| 1213 " 'desktopCapture'," | 1059 " 'desktopCapture'," |
| 1214 " 'gcm'," | 1060 " 'gcm'," |
| 1215 " 'topSites'," | 1061 " 'topSites'," |
| 1216 " 'storage'," | 1062 " 'storage'," |
| 1217 " 'unlimitedStorage'," | 1063 " 'unlimitedStorage'," |
| 1218 " 'syncFileSystem'," | 1064 " 'syncFileSystem'," |
| 1219 " 'http://www.blogger.com/'," | 1065 " 'http://www.blogger.com/'," |
| 1220 " 'http://*.google.com/'," | 1066 " 'http://*.google.com/'," |
| 1221 " 'http://*.news.com/'," | 1067 " 'http://*.news.com/'," |
| 1222 " 'http://www.foobar.com/'," | 1068 " 'http://www.foobar.com/'," |
| 1223 " 'http://*.go.com/'," | 1069 " 'http://*.go.com/'," |
| 1224 " ]" | 1070 " ]" |
| 1225 "}"); | 1071 "}"); |
| 1226 | 1072 |
| 1073 submessages.clear(); |
| 1074 submessages.push_back("All go.com sites"); |
| 1075 submessages.push_back("All google.com sites"); |
| 1076 submessages.push_back("All news.com sites"); |
| 1077 submessages.push_back("www.blogger.com"); |
| 1078 submessages.push_back("www.foobar.com"); |
| 1227 ASSERT_TRUE(CheckManifestProducesPermissions( | 1079 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1228 "Read your browsing history on all your signed-in devices", | 1080 "Read your browsing history on all your signed-in devices", |
| 1229 "Capture content of your screen", "Read and change your bookmarks", | 1081 std::vector<std::string>(), "Capture content of your screen", |
| 1230 "Read and change your data on a number of websites", | 1082 std::vector<std::string>(), "Read and change your bookmarks", |
| 1231 "Read and change your accessibility settings")); | 1083 std::vector<std::string>(), |
| 1232 | 1084 "Read and change your data on a number of websites", submessages, |
| 1233 ASSERT_TRUE(CheckManifestProducesHostPermissions( | 1085 "Read and change your accessibility settings", |
| 1234 "All go.com sites", "All google.com sites", "All news.com sites", | 1086 std::vector<std::string>())); |
| 1235 "www.blogger.com", "www.foobar.com")); | |
| 1236 | 1087 |
| 1237 // Create an App instead, ensuring that the host permission messages are not | 1088 // Create an App instead, ensuring that the host permission messages are not |
| 1238 // added. | 1089 // added. |
| 1239 CreateAndInstall( | 1090 CreateAndInstall( |
| 1240 "{" | 1091 "{" |
| 1241 " 'app': {" | 1092 " 'app': {" |
| 1242 " 'background': {" | 1093 " 'background': {" |
| 1243 " 'scripts': ['background.js']" | 1094 " 'scripts': ['background.js']" |
| 1244 " }" | 1095 " }" |
| 1245 " }," | 1096 " }," |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1264 " 'http://*.news.com/'," | 1115 " 'http://*.news.com/'," |
| 1265 " 'http://www.foobar.com/'," | 1116 " 'http://www.foobar.com/'," |
| 1266 " 'http://*.go.com/'," | 1117 " 'http://*.go.com/'," |
| 1267 " ]" | 1118 " ]" |
| 1268 "}"); | 1119 "}"); |
| 1269 | 1120 |
| 1270 ASSERT_TRUE(CheckManifestProducesPermissions( | 1121 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1271 "Access your serial devices", "Store data in your Google Drive account", | 1122 "Access your serial devices", "Store data in your Google Drive account", |
| 1272 "Read and change your accessibility settings")); | 1123 "Read and change your accessibility settings")); |
| 1273 | 1124 |
| 1274 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1275 } | 1125 } |
| 1276 | 1126 |
| 1277 // Tests that the 'plugin' manifest key produces the correct permission. | 1127 // Tests that the 'plugin' manifest key produces the correct permission. |
| 1278 TEST_F(PermissionMessageCombinationsUnittest, PluginPermission) { | 1128 TEST_F(PermissionMessageCombinationsUnittest, PluginPermission) { |
| 1279 // Extensions can have plugins. | 1129 // Extensions can have plugins. |
| 1280 CreateAndInstall( | 1130 CreateAndInstall( |
| 1281 "{" | 1131 "{" |
| 1282 " 'plugins': [" | 1132 " 'plugins': [" |
| 1283 " { 'path': 'extension_plugin.dll' }" | 1133 " { 'path': 'extension_plugin.dll' }" |
| 1284 " ]" | 1134 " ]" |
| 1285 "}"); | 1135 "}"); |
| 1286 | 1136 |
| 1287 #ifdef OS_CHROMEOS | 1137 #ifdef OS_CHROMEOS |
| 1288 ASSERT_TRUE(CheckManifestProducesPermissions()); | 1138 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 1289 #else | 1139 #else |
| 1290 ASSERT_TRUE(CheckManifestProducesPermissions( | 1140 ASSERT_TRUE(CheckManifestProducesPermissions( |
| 1291 "Read and change all your data on your computer and the websites you " | 1141 "Read and change all your data on your computer and the websites you " |
| 1292 "visit")); | 1142 "visit")); |
| 1293 #endif | 1143 #endif |
| 1294 | 1144 |
| 1295 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1296 | |
| 1297 // Apps can't have plugins. | 1145 // Apps can't have plugins. |
| 1298 CreateAndInstall( | 1146 CreateAndInstall( |
| 1299 "{" | 1147 "{" |
| 1300 " 'app': {" | 1148 " 'app': {" |
| 1301 " 'background': {" | 1149 " 'background': {" |
| 1302 " 'scripts': ['background.js']" | 1150 " 'scripts': ['background.js']" |
| 1303 " }" | 1151 " }" |
| 1304 " }," | 1152 " }," |
| 1305 " 'plugins': [" | 1153 " 'plugins': [" |
| 1306 " { 'path': 'extension_plugin.dll' }" | 1154 " { 'path': 'extension_plugin.dll' }" |
| 1307 " ]" | 1155 " ]" |
| 1308 "}"); | 1156 "}"); |
| 1309 ASSERT_TRUE(CheckManifestProducesPermissions()); | 1157 ASSERT_TRUE(CheckManifestProducesPermissions()); |
| 1310 ASSERT_TRUE(CheckManifestProducesHostPermissions()); | |
| 1311 } | 1158 } |
| 1312 | 1159 |
| 1313 // TODO(sashab): Add a test that checks that messages are generated correctly | 1160 // TODO(sashab): Add a test that checks that messages are generated correctly |
| 1314 // for withheld permissions, when an app is granted the 'all sites' permission. | 1161 // for withheld permissions, when an app is granted the 'all sites' permission. |
| 1315 | 1162 |
| 1316 // TODO(sashab): Add a test that ensures that all permissions that can generate | 1163 // TODO(sashab): Add a test that ensures that all permissions that can generate |
| 1317 // a coalesced message can also generate a message on their own (i.e. ensure | 1164 // a coalesced message can also generate a message on their own (i.e. ensure |
| 1318 // that no permissions only modify other permissions). | 1165 // that no permissions only modify other permissions). |
| 1319 | 1166 |
| 1320 // TODO(sashab): Add a test for every permission message combination that can | 1167 // TODO(sashab): Add a test for every permission message combination that can |
| 1321 // generate a message. | 1168 // generate a message. |
| 1322 | 1169 |
| 1323 // TODO(aboxhall): Add tests for the automation API permission messages. | 1170 // TODO(aboxhall): Add tests for the automation API permission messages. |
| 1324 | 1171 |
| 1325 } // namespace extensions | 1172 } // namespace extensions |
| OLD | NEW |