Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/extensions/permission_messages_unittest.cc

Issue 1006453002: Extensions: Prepare switch to new permission message system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/permissions_updater.h" 7 #include "chrome/browser/extensions/permissions_updater.h"
8 #include "chrome/browser/extensions/test_extension_environment.h" 8 #include "chrome/browser/extensions/test_extension_environment.h"
9 #include "chrome/common/extensions/permissions/chrome_permission_message_provide r.h" 9 #include "chrome/common/extensions/permissions/chrome_permission_message_provide r.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return GetMessages(PermissionsParser::GetRequiredPermissions(app_.get())); 106 return GetMessages(PermissionsParser::GetRequiredPermissions(app_.get()));
107 } 107 }
108 108
109 std::vector<base::string16> optional_permissions() { 109 std::vector<base::string16> optional_permissions() {
110 return GetMessages(PermissionsParser::GetOptionalPermissions(app_.get())); 110 return GetMessages(PermissionsParser::GetOptionalPermissions(app_.get()));
111 } 111 }
112 112
113 private: 113 private:
114 std::vector<base::string16> GetMessages( 114 std::vector<base::string16> GetMessages(
115 scoped_refptr<const PermissionSet> permissions) { 115 scoped_refptr<const PermissionSet> permissions) {
116 return message_provider_->GetWarningMessages(permissions.get(), 116 return message_provider_->GetLegacyWarningMessages(permissions.get(),
117 app_->GetType()); 117 app_->GetType());
118 } 118 }
119 119
120 extensions::TestExtensionEnvironment env_; 120 extensions::TestExtensionEnvironment env_;
121 scoped_ptr<ChromePermissionMessageProvider> message_provider_; 121 scoped_ptr<ChromePermissionMessageProvider> message_provider_;
122 scoped_refptr<const Extension> app_; 122 scoped_refptr<const Extension> app_;
123 123
124 DISALLOW_COPY_AND_ASSIGN(PermissionMessagesUnittest); 124 DISALLOW_COPY_AND_ASSIGN(PermissionMessagesUnittest);
125 }; 125 };
126 126
127 // If an app has both the 'history' and 'tabs' permission, one should hide the 127 // If an app has both the 'history' and 'tabs' permission, one should hide the
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 GrantOptionalPermissions(); 245 GrantOptionalPermissions();
246 246
247 ASSERT_EQ(1U, active_permissions().size()); 247 ASSERT_EQ(1U, active_permissions().size());
248 EXPECT_EQ(l10n_util::GetStringUTF16( 248 EXPECT_EQ(l10n_util::GetStringUTF16(
249 IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ_AND_SESSIONS), 249 IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ_AND_SESSIONS),
250 active_permissions()[0]); 250 active_permissions()[0]);
251 } 251 }
252 252
253 } // namespace extensions 253 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698