| 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 "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 ChromePermissionMessageProviderUnittest() | 30 ChromePermissionMessageProviderUnittest() |
| 31 : message_provider_(new ChromePermissionMessageProvider()) {} | 31 : message_provider_(new ChromePermissionMessageProvider()) {} |
| 32 ~ChromePermissionMessageProviderUnittest() override {} | 32 ~ChromePermissionMessageProviderUnittest() override {} |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 std::vector<base::string16> GetMessages(const APIPermissionSet& permissions, | 35 std::vector<base::string16> GetMessages(const APIPermissionSet& permissions, |
| 36 Manifest::Type type) { | 36 Manifest::Type type) { |
| 37 scoped_refptr<const PermissionSet> permission_set = new PermissionSet( | 37 scoped_refptr<const PermissionSet> permission_set = new PermissionSet( |
| 38 permissions, ManifestPermissionSet(), URLPatternSet(), URLPatternSet()); | 38 permissions, ManifestPermissionSet(), URLPatternSet(), URLPatternSet()); |
| 39 return message_provider_->GetWarningMessages(permission_set.get(), type); | 39 return message_provider_->GetLegacyWarningMessages(permission_set.get(), |
| 40 type); |
| 40 } | 41 } |
| 41 | 42 |
| 42 std::vector<base::string16> GetDetails(const APIPermissionSet& permissions, | 43 std::vector<base::string16> GetDetails(const APIPermissionSet& permissions, |
| 43 Manifest::Type type) { | 44 Manifest::Type type) { |
| 44 scoped_refptr<const PermissionSet> permission_set = new PermissionSet( | 45 scoped_refptr<const PermissionSet> permission_set = new PermissionSet( |
| 45 permissions, ManifestPermissionSet(), URLPatternSet(), URLPatternSet()); | 46 permissions, ManifestPermissionSet(), URLPatternSet(), URLPatternSet()); |
| 46 return message_provider_->GetWarningMessagesDetails(permission_set.get(), | 47 return message_provider_->GetLegacyWarningMessagesDetails( |
| 47 type); | 48 permission_set.get(), type); |
| 48 } | 49 } |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 scoped_ptr<ChromePermissionMessageProvider> message_provider_; | 52 scoped_ptr<ChromePermissionMessageProvider> message_provider_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProviderUnittest); | 54 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProviderUnittest); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Checks that if an app has a superset and a subset permission, only the | 57 // Checks that if an app has a superset and a subset permission, only the |
| 57 // superset permission message is displayed if they are both present. | 58 // superset permission message is displayed if they are both present. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ), | 116 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ), |
| 116 messages[0]); | 117 messages[0]); |
| 117 EXPECT_TRUE(details[0].empty()); | 118 EXPECT_TRUE(details[0].empty()); |
| 118 EXPECT_EQ( | 119 EXPECT_EQ( |
| 119 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_USB_DEVICE_LIST), | 120 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_USB_DEVICE_LIST), |
| 120 messages[1]); | 121 messages[1]); |
| 121 EXPECT_FALSE(details[1].empty()); | 122 EXPECT_FALSE(details[1].empty()); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |