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

Side by Side Diff: chrome/common/extensions/permissions/permissions_data_unittest.cc

Issue 23591040: Use ICU for string pluralization in the extension permission dialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@gtk-extension-install-dialog
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/common/extensions/permissions/permission_message.cc ('k') | ui/base/l10n/l10n_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 TEST(ExtensionPermissionsTest, GetPermissionMessages_ManyHostsPermissions) { 169 TEST(ExtensionPermissionsTest, GetPermissionMessages_ManyHostsPermissions) {
170 scoped_refptr<Extension> extension; 170 scoped_refptr<Extension> extension;
171 extension = LoadManifest("permissions", "more-than-3-hosts.json"); 171 extension = LoadManifest("permissions", "more-than-3-hosts.json");
172 std::vector<string16> warnings = 172 std::vector<string16> warnings =
173 PermissionsData::GetPermissionMessageStrings(extension.get()); 173 PermissionsData::GetPermissionMessageStrings(extension.get());
174 std::vector<string16> warnings_details = 174 std::vector<string16> warnings_details =
175 PermissionsData::GetPermissionMessageDetailsStrings(extension.get()); 175 PermissionsData::GetPermissionMessageDetailsStrings(extension.get());
176 ASSERT_EQ(1u, warnings.size()); 176 ASSERT_EQ(1u, warnings.size());
177 ASSERT_EQ(1u, warnings_details.size()); 177 ASSERT_EQ(1u, warnings_details.size());
178 EXPECT_EQ("Access your data on 5 website(s)", UTF16ToUTF8(warnings[0])); 178 EXPECT_EQ("Access your data on 5 websites", UTF16ToUTF8(warnings[0]));
179 EXPECT_EQ("- www.a.com\n- www.b.com\n- www.c.com\n- www.d.com\n- www.e.com", 179 EXPECT_EQ("- www.a.com\n- www.b.com\n- www.c.com\n- www.d.com\n- www.e.com",
180 UTF16ToUTF8(warnings_details[0])); 180 UTF16ToUTF8(warnings_details[0]));
181 } 181 }
182 182
183 TEST(ExtensionPermissionsTest, GetPermissionMessages_LocationApiPermission) { 183 TEST(ExtensionPermissionsTest, GetPermissionMessages_LocationApiPermission) {
184 scoped_refptr<Extension> extension; 184 scoped_refptr<Extension> extension;
185 extension = LoadManifest("permissions", 185 extension = LoadManifest("permissions",
186 "location-api.json", 186 "location-api.json",
187 Manifest::COMPONENT, 187 Manifest::COMPONENT,
188 Extension::NO_FLAGS); 188 Extension::NO_FLAGS);
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 PermissionsData::ClearTabSpecificPermissions(extension.get(), 1); 608 PermissionsData::ClearTabSpecificPermissions(extension.get(), 1);
609 EXPECT_FALSE(PermissionsData::GetTabSpecificPermissions(extension.get(), 1) 609 EXPECT_FALSE(PermissionsData::GetTabSpecificPermissions(extension.get(), 1)
610 .get()); 610 .get());
611 611
612 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 0)); 612 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 0));
613 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 1)); 613 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 1));
614 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 2)); 614 EXPECT_TRUE(AllowedExclusivelyOnTab(extension.get(), no_urls, 2));
615 } 615 }
616 616
617 } // namespace extensions 617 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_message.cc ('k') | ui/base/l10n/l10n_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698