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

Unified Diff: chrome/common/extensions/manifest_handlers/automation_unittest.cc

Issue 410023002: Show read-only messages for non-interact non-desktop Automation extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_handlers/automation_unittest.cc
diff --git a/chrome/common/extensions/manifest_handlers/automation_unittest.cc b/chrome/common/extensions/manifest_handlers/automation_unittest.cc
index 96c13e43aacc083f1d33da8d68088549b79cb4f3..4d8c7ba568e25649a8867e77475a809c18f33e10 100644
--- a/chrome/common/extensions/manifest_handlers/automation_unittest.cc
+++ b/chrome/common/extensions/manifest_handlers/automation_unittest.cc
@@ -93,7 +93,7 @@ TEST_F(AutomationManifestTest, Matches) {
std::vector<base::string16> warnings =
extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
- EXPECT_EQ("Read and change your data on www.google.com and www.twitter.com",
+ EXPECT_EQ("Read your data on www.google.com and www.twitter.com",
base::UTF16ToUTF8(warnings[0]));
const AutomationInfo* info = AutomationInfo::Get(extension.get());
@@ -122,7 +122,7 @@ TEST_F(AutomationManifestTest, MatchesAndPermissions) {
ASSERT_EQ(2u, warnings.size());
EXPECT_EQ("Read and change your data on www.google.com",
base::UTF16ToUTF8(warnings[0]));
- EXPECT_EQ("Read and change your data on www.twitter.com",
+ EXPECT_EQ("Read your data on www.twitter.com",
base::UTF16ToUTF8(warnings[1]));
const AutomationInfo* info = AutomationInfo::Get(extension.get());
@@ -278,4 +278,44 @@ TEST_F(AutomationManifestTest, Desktop_MatchesSpecified) {
EXPECT_TRUE(info->matches.is_empty());
}
+TEST_F(AutomationManifestTest, AllHostsInteractFalse) {
+ scoped_refptr<Extension> extension =
+ LoadAndExpectSuccess("automation_all_hosts_interact_false.json");
+ ASSERT_TRUE(extension.get());
+
+ std::vector<base::string16> warnings =
+ extension->permissions_data()->GetPermissionMessageStrings();
+ ASSERT_EQ(1u, warnings.size());
+ EXPECT_EQ(l10n_util::GetStringUTF16(
+ IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS_READ_ONLY),
+ warnings[0]);
+
+ const AutomationInfo* info = AutomationInfo::Get(extension.get());
+ ASSERT_TRUE(info);
+
+ EXPECT_FALSE(info->desktop);
+ EXPECT_FALSE(info->interact);
+ EXPECT_FALSE(info->matches.is_empty());
+ EXPECT_TRUE(info->matches.MatchesAllURLs());
+}
+
+TEST_F(AutomationManifestTest, AllHostsInteractTrue) {
+ scoped_refptr<Extension> extension =
+ LoadAndExpectSuccess("automation_all_hosts_interact_true.json");
+ ASSERT_TRUE(extension.get());
+
+ std::vector<base::string16> warnings =
+ extension->permissions_data()->GetPermissionMessageStrings();
+ ASSERT_EQ(1u, warnings.size());
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS),
+ warnings[0]);
+
+ const AutomationInfo* info = AutomationInfo::Get(extension.get());
+ ASSERT_TRUE(info);
+
+ EXPECT_FALSE(info->desktop);
+ EXPECT_TRUE(info->interact);
+ EXPECT_FALSE(info->matches.is_empty());
+ EXPECT_TRUE(info->matches.MatchesAllURLs());
+}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698