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 <memory> |
| 6 |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/macros.h" | 8 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
9 #include "chrome/browser/extensions/test_extension_environment.h" | 10 #include "chrome/browser/extensions/test_extension_environment.h" |
10 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 11 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
12 #include "extensions/common/features/simple_feature.h" | 13 #include "extensions/common/features/simple_feature.h" |
13 #include "extensions/common/permissions/permission_message_test_util.h" | 14 #include "extensions/common/permissions/permission_message_test_util.h" |
14 #include "extensions/common/permissions/permissions_data.h" | 15 #include "extensions/common/permissions/permissions_data.h" |
15 #include "extensions/common/switches.h" | 16 #include "extensions/common/switches.h" |
16 #include "testing/gmock/include/gmock/gmock-matchers.h" | 17 #include "testing/gmock/include/gmock/gmock-matchers.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 expected_submessages.push_back(expected_submessages_3); | 190 expected_submessages.push_back(expected_submessages_3); |
190 expected_submessages.push_back(expected_submessages_4); | 191 expected_submessages.push_back(expected_submessages_4); |
191 expected_submessages.push_back(expected_submessages_5); | 192 expected_submessages.push_back(expected_submessages_5); |
192 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), | 193 return VerifyPermissionMessagesWithSubmessages(app_->permissions_data(), |
193 expected_messages, | 194 expected_messages, |
194 expected_submessages, false); | 195 expected_submessages, false); |
195 } | 196 } |
196 | 197 |
197 private: | 198 private: |
198 extensions::TestExtensionEnvironment env_; | 199 extensions::TestExtensionEnvironment env_; |
199 scoped_ptr<ChromePermissionMessageProvider> message_provider_; | 200 std::unique_ptr<ChromePermissionMessageProvider> message_provider_; |
200 scoped_refptr<const Extension> app_; | 201 scoped_refptr<const Extension> app_; |
201 // Whitelist a known extension id so we can test all permissions. This ID | 202 // Whitelist a known extension id so we can test all permissions. This ID |
202 // will be used for each test app. | 203 // will be used for each test app. |
203 extensions::SimpleFeature::ScopedWhitelistForTest whitelisted_extension_id_; | 204 extensions::SimpleFeature::ScopedWhitelistForTest whitelisted_extension_id_; |
204 | 205 |
205 DISALLOW_COPY_AND_ASSIGN(PermissionMessageCombinationsUnittest); | 206 DISALLOW_COPY_AND_ASSIGN(PermissionMessageCombinationsUnittest); |
206 }; | 207 }; |
207 | 208 |
208 // Test that the USB, Bluetooth and Serial permissions do not coalesce on their | 209 // Test that the USB, Bluetooth and Serial permissions do not coalesce on their |
209 // own, but do coalesce when more than 1 is present. | 210 // own, but do coalesce when more than 1 is present. |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 // TODO(sashab): Add a test that ensures that all permissions that can generate | 1168 // TODO(sashab): Add a test that ensures that all permissions that can generate |
1168 // a coalesced message can also generate a message on their own (i.e. ensure | 1169 // a coalesced message can also generate a message on their own (i.e. ensure |
1169 // that no permissions only modify other permissions). | 1170 // that no permissions only modify other permissions). |
1170 | 1171 |
1171 // TODO(sashab): Add a test for every permission message combination that can | 1172 // TODO(sashab): Add a test for every permission message combination that can |
1172 // generate a message. | 1173 // generate a message. |
1173 | 1174 |
1174 // TODO(aboxhall): Add tests for the automation API permission messages. | 1175 // TODO(aboxhall): Add tests for the automation API permission messages. |
1175 | 1176 |
1176 } // namespace extensions | 1177 } // namespace extensions |
OLD | NEW |