| 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/features/base_feature_provider.h" | 5 #include "chrome/common/extensions/features/base_feature_provider.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/features/feature_channel.h" |
| 7 #include "chrome/common/extensions/features/permission_feature.h" | 8 #include "chrome/common/extensions/features/permission_feature.h" |
| 8 #include "chrome/common/extensions/value_builder.h" | 9 #include "chrome/common/extensions/value_builder.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 using chrome::VersionInfo; | 12 using chrome::VersionInfo; |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 | 15 |
| 15 TEST(BaseFeatureProviderTest, ManifestFeatures) { | 16 TEST(BaseFeatureProviderTest, ManifestFeatures) { |
| 16 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); | 17 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 .Build()); | 158 .Build()); |
| 158 | 159 |
| 159 scoped_ptr<BaseFeatureProvider> provider( | 160 scoped_ptr<BaseFeatureProvider> provider( |
| 160 new BaseFeatureProvider(*rule, NULL)); | 161 new BaseFeatureProvider(*rule, NULL)); |
| 161 | 162 |
| 162 Feature* feature = provider->GetFeature("feature1"); | 163 Feature* feature = provider->GetFeature("feature1"); |
| 163 EXPECT_TRUE(feature); | 164 EXPECT_TRUE(feature); |
| 164 | 165 |
| 165 // Make sure both rules are applied correctly. | 166 // Make sure both rules are applied correctly. |
| 166 { | 167 { |
| 167 Feature::ScopedCurrentChannel current_channel(VersionInfo::CHANNEL_BETA); | 168 ScopedCurrentChannel current_channel(VersionInfo::CHANNEL_BETA); |
| 168 EXPECT_EQ(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( | 169 EXPECT_EQ(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( |
| 169 "1", | 170 "1", |
| 170 Manifest::TYPE_EXTENSION, | 171 Manifest::TYPE_EXTENSION, |
| 171 Feature::UNSPECIFIED_LOCATION, | 172 Feature::UNSPECIFIED_LOCATION, |
| 172 Feature::UNSPECIFIED_PLATFORM).result()); | 173 Feature::UNSPECIFIED_PLATFORM).result()); |
| 173 EXPECT_EQ(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( | 174 EXPECT_EQ(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( |
| 174 "2", | 175 "2", |
| 175 Manifest::TYPE_LEGACY_PACKAGED_APP, | 176 Manifest::TYPE_LEGACY_PACKAGED_APP, |
| 176 Feature::UNSPECIFIED_LOCATION, | 177 Feature::UNSPECIFIED_LOCATION, |
| 177 Feature::UNSPECIFIED_PLATFORM).result()); | 178 Feature::UNSPECIFIED_PLATFORM).result()); |
| 178 } | 179 } |
| 179 { | 180 { |
| 180 Feature::ScopedCurrentChannel current_channel(VersionInfo::CHANNEL_STABLE); | 181 ScopedCurrentChannel current_channel(VersionInfo::CHANNEL_STABLE); |
| 181 EXPECT_NE(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( | 182 EXPECT_NE(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( |
| 182 "1", | 183 "1", |
| 183 Manifest::TYPE_EXTENSION, | 184 Manifest::TYPE_EXTENSION, |
| 184 Feature::UNSPECIFIED_LOCATION, | 185 Feature::UNSPECIFIED_LOCATION, |
| 185 Feature::UNSPECIFIED_PLATFORM).result()); | 186 Feature::UNSPECIFIED_PLATFORM).result()); |
| 186 EXPECT_NE(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( | 187 EXPECT_NE(Feature::IS_AVAILABLE, feature->IsAvailableToManifest( |
| 187 "2", | 188 "2", |
| 188 Manifest::TYPE_LEGACY_PACKAGED_APP, | 189 Manifest::TYPE_LEGACY_PACKAGED_APP, |
| 189 Feature::UNSPECIFIED_LOCATION, | 190 Feature::UNSPECIFIED_LOCATION, |
| 190 Feature::UNSPECIFIED_PLATFORM).result()); | 191 Feature::UNSPECIFIED_PLATFORM).result()); |
| 191 } | 192 } |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace extensions | 195 } // namespace extensions |
| OLD | NEW |