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

Unified Diff: extensions/common/features/simple_feature_unittest.cc

Issue 265503003: Enable file_handlers and chrome.app.runtime for QuickOffice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback, less hacky Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/features/simple_feature.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/simple_feature_unittest.cc
diff --git a/extensions/common/features/simple_feature_unittest.cc b/extensions/common/features/simple_feature_unittest.cc
index ddcac9ac1b7d83cc9ac9b791def98d7fdc0c327d..8ba5dfa5a57db9e707b52b86eca5b80e73823cab 100644
--- a/extensions/common/features/simple_feature_unittest.cc
+++ b/extensions/common/features/simple_feature_unittest.cc
@@ -172,6 +172,84 @@ TEST_F(ExtensionSimpleFeatureTest, HashedIdWhitelist) {
Feature::UNSPECIFIED_PLATFORM).result());
}
+TEST_F(ExtensionSimpleFeatureTest, Blacklist) {
+ const std::string kIdFoo("fooabbbbccccddddeeeeffffgggghhhh");
+ const std::string kIdBar("barabbbbccccddddeeeeffffgggghhhh");
+ const std::string kIdBaz("bazabbbbccccddddeeeeffffgggghhhh");
+ SimpleFeature feature;
+ feature.blacklist()->insert(kIdFoo);
+ feature.blacklist()->insert(kIdBar);
+
+ EXPECT_EQ(
+ Feature::FOUND_IN_BLACKLIST,
+ feature.IsAvailableToManifest(kIdFoo,
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+ EXPECT_EQ(
+ Feature::FOUND_IN_BLACKLIST,
+ feature.IsAvailableToManifest(kIdBar,
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+
+ EXPECT_EQ(
+ Feature::IS_AVAILABLE,
+ feature.IsAvailableToManifest(kIdBaz,
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+ EXPECT_EQ(
+ Feature::IS_AVAILABLE,
+ feature.IsAvailableToManifest(std::string(),
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+}
+
+TEST_F(ExtensionSimpleFeatureTest, HashedIdBlacklist) {
+ // echo -n "fooabbbbccccddddeeeeffffgggghhhh" |
+ // sha1sum | tr '[:lower:]' '[:upper:]'
+ const std::string kIdFoo("fooabbbbccccddddeeeeffffgggghhhh");
+ const std::string kIdFooHashed("55BC7228A0D502A2A48C9BB16B07062A01E62897");
+ SimpleFeature feature;
+
+ feature.blacklist()->insert(kIdFooHashed);
+
+ EXPECT_EQ(
+ Feature::FOUND_IN_BLACKLIST,
+ feature.IsAvailableToManifest(kIdFoo,
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+ EXPECT_NE(
+ Feature::FOUND_IN_BLACKLIST,
+ feature.IsAvailableToManifest(kIdFooHashed,
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+ EXPECT_EQ(
+ Feature::IS_AVAILABLE,
+ feature.IsAvailableToManifest("slightlytoooolongforanextensionid",
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+ EXPECT_EQ(
+ Feature::IS_AVAILABLE,
+ feature.IsAvailableToManifest("tooshortforanextensionid",
+ Manifest::TYPE_UNKNOWN,
+ Manifest::INVALID_LOCATION,
+ -1,
+ Feature::UNSPECIFIED_PLATFORM).result());
+}
+
TEST_F(ExtensionSimpleFeatureTest, PackageType) {
SimpleFeature feature;
feature.extension_types()->insert(Manifest::TYPE_EXTENSION);
« no previous file with comments | « extensions/common/features/simple_feature.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698