Index: chrome/common/extensions/api/common_extension_api_unittest.cc |
diff --git a/chrome/common/extensions/api/common_extension_api_unittest.cc b/chrome/common/extensions/api/common_extension_api_unittest.cc |
index edcb0b37c76c747d645bbf6873ad59e00e246da1..e16ecdf8de638f2e17010178230794498bec875f 100644 |
--- a/chrome/common/extensions/api/common_extension_api_unittest.cc |
+++ b/chrome/common/extensions/api/common_extension_api_unittest.cc |
@@ -676,36 +676,16 @@ TEST(ExtensionAPITest, DefaultConfigurationFeatures) { |
} |
} |
-TEST(ExtensionAPITest, FeaturesRequireContexts) { |
- // TODO(cduvall): Make this check API featues. |
- std::unique_ptr<base::DictionaryValue> api_features1( |
+TEST(ExtensionAPITest, JSONFeatureProviderDoesNotStoreInvalidFeatures) { |
+ base::DictionaryValue features; |
+ std::unique_ptr<base::DictionaryValue> feature_value( |
new base::DictionaryValue()); |
- std::unique_ptr<base::DictionaryValue> api_features2( |
- new base::DictionaryValue()); |
- base::DictionaryValue* test1 = new base::DictionaryValue(); |
- base::DictionaryValue* test2 = new base::DictionaryValue(); |
- base::ListValue* contexts = new base::ListValue(); |
- contexts->AppendString("content_script"); |
- test1->Set("contexts", contexts); |
- test1->SetString("channel", "stable"); |
- test2->SetString("channel", "stable"); |
- api_features1->Set("test", test1); |
- api_features2->Set("test", test2); |
- |
- struct { |
- base::DictionaryValue* api_features; |
- bool expect_success; |
- } test_data[] = { |
- { api_features1.get(), true }, |
- { api_features2.get(), false } |
- }; |
- |
- for (size_t i = 0; i < arraysize(test_data); ++i) { |
- JSONFeatureProvider api_feature_provider(*test_data[i].api_features, |
- CreateAPIFeature); |
- Feature* feature = api_feature_provider.GetFeature("test"); |
- EXPECT_EQ(test_data[i].expect_success, feature != NULL) << i; |
- } |
+ // This feature is invalid (it needs an extension context), so the |
+ // JSONFeatureProvider should not store it. |
+ feature_value->SetString("channel", "stable"); |
+ features.Set("test", std::move(feature_value)); |
+ JSONFeatureProvider api_feature_provider(features, CreateAPIFeature); |
+ EXPECT_FALSE(api_feature_provider.GetFeature("test")); |
} |
static void GetDictionaryFromList(const base::DictionaryValue* schema, |