OLD | NEW |
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 "chrome/common/extensions/simple_feature_provider.h" | 5 #include "chrome/common/extensions/simple_feature_provider.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
| 9 using extensions::Extension; |
9 using extensions::Feature; | 10 using extensions::Feature; |
10 using extensions::SimpleFeatureProvider; | 11 using extensions::SimpleFeatureProvider; |
11 | 12 |
12 TEST(SimpleFeatureProvider, ManifestFeatures) { | 13 TEST(SimpleFeatureProvider, ManifestFeatures) { |
13 SimpleFeatureProvider* provider = | 14 SimpleFeatureProvider* provider = |
14 SimpleFeatureProvider::GetManifestFeatures(); | 15 SimpleFeatureProvider::GetManifestFeatures(); |
15 Feature* feature = provider->GetFeature("description"); | 16 Feature* feature = provider->GetFeature("description"); |
16 ASSERT_TRUE(feature); | 17 ASSERT_TRUE(feature); |
17 EXPECT_EQ(5u, feature->extension_types()->size()); | 18 EXPECT_EQ(5u, feature->extension_types()->size()); |
18 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION)); | 19 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 EXPECT_TRUE(provider->GetFeature("feature1")); | 115 EXPECT_TRUE(provider->GetFeature("feature1")); |
115 | 116 |
116 // feature2 won't validate because of the presence of "contexts". | 117 // feature2 won't validate because of the presence of "contexts". |
117 EXPECT_FALSE(provider->GetFeature("feature2")); | 118 EXPECT_FALSE(provider->GetFeature("feature2")); |
118 | 119 |
119 // If we remove it, it works. | 120 // If we remove it, it works. |
120 feature2->Remove("contexts", NULL); | 121 feature2->Remove("contexts", NULL); |
121 provider.reset(new SimpleFeatureProvider(value.get(), NULL)); | 122 provider.reset(new SimpleFeatureProvider(value.get(), NULL)); |
122 EXPECT_TRUE(provider->GetFeature("feature2")); | 123 EXPECT_TRUE(provider->GetFeature("feature2")); |
123 } | 124 } |
OLD | NEW |