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

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

Issue 323633003: Change tabs + sessions permission warning (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/json/json_file_value_serializer.h" 6 #include "base/json/json_file_value_serializer.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 // Just video present. 967 // Just video present.
968 set->apis_.erase(APIPermission::kAudioCapture); 968 set->apis_.erase(APIPermission::kAudioCapture);
969 set->apis_.insert(APIPermission::kVideoCapture); 969 set->apis_.insert(APIPermission::kVideoCapture);
970 warnings = provider->GetWarningMessages(set, extension->GetType()); 970 warnings = provider->GetWarningMessages(set, extension->GetType());
971 EXPECT_EQ(combined_size, warnings.size()); 971 EXPECT_EQ(combined_size, warnings.size());
972 EXPECT_FALSE(Contains(warnings, "Use your microphone")); 972 EXPECT_FALSE(Contains(warnings, "Use your microphone"));
973 EXPECT_FALSE(Contains(warnings, "Use your microphone and camera")); 973 EXPECT_FALSE(Contains(warnings, "Use your microphone and camera"));
974 EXPECT_TRUE(Contains(warnings, "Use your camera")); 974 EXPECT_TRUE(Contains(warnings, "Use your camera"));
975 } 975 }
976 976
977 TEST(PermissionsTest, GetWarningMessages_SessionsTabs) {
978 APIPermissionSet api_permissions;
979 api_permissions.insert(APIPermission::kTab);
980 api_permissions.insert(APIPermission::kSessions);
981 scoped_refptr<PermissionSet> permissions(
982 new PermissionSet(api_permissions, ManifestPermissionSet(),
983 URLPatternSet(), URLPatternSet()));
984 std::vector<base::string16> messages =
985 PermissionMessageProvider::Get()->GetWarningMessages(
986 permissions, Manifest::TYPE_EXTENSION);
987 EXPECT_EQ(1u, messages.size());
988 EXPECT_EQ(
989 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_TABS_AND_SESSIONS),
990 messages[0]);
991 }
992
977 TEST(PermissionsTest, GetWarningMessages_DeclarativeWebRequest) { 993 TEST(PermissionsTest, GetWarningMessages_DeclarativeWebRequest) {
978 // Test that if the declarativeWebRequest permission is present 994 // Test that if the declarativeWebRequest permission is present
979 // in combination with all hosts permission, then only the warning 995 // in combination with all hosts permission, then only the warning
980 // for host permissions is shown, because that covers the use of 996 // for host permissions is shown, because that covers the use of
981 // declarativeWebRequest. 997 // declarativeWebRequest.
982 998
983 // Until Declarative Web Request is in stable, let's make sure it is enabled 999 // Until Declarative Web Request is in stable, let's make sure it is enabled
984 // on the current channel. 1000 // on the current channel.
985 ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_CANARY); 1001 ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_CANARY);
986 1002
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 scoped_refptr<const PermissionSet> permissions_dwr( 1594 scoped_refptr<const PermissionSet> permissions_dwr(
1579 extension_dwr->GetActivePermissions()); 1595 extension_dwr->GetActivePermissions());
1580 1596
1581 EXPECT_FALSE(PermissionMessageProvider::Get()-> 1597 EXPECT_FALSE(PermissionMessageProvider::Get()->
1582 IsPrivilegeIncrease(permissions.get(), 1598 IsPrivilegeIncrease(permissions.get(),
1583 permissions_dwr.get(), 1599 permissions_dwr.get(),
1584 extension->GetType())); 1600 extension->GetType()));
1585 } 1601 }
1586 1602
1587 } // namespace extensions 1603 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698