| 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/simple_feature.h" | 5 #include "chrome/common/extensions/features/simple_feature.h" | 
| 6 | 6 | 
| 7 #include "chrome/common/extensions/value_builder.h" | 7 #include "chrome/common/extensions/value_builder.h" | 
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" | 
| 9 | 9 | 
| 10 using chrome::VersionInfo; | 10 using chrome::VersionInfo; | 
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 370 } | 370 } | 
| 371 | 371 | 
| 372 TEST_F(ExtensionSimpleFeatureTest, ParsePackageTypes) { | 372 TEST_F(ExtensionSimpleFeatureTest, ParsePackageTypes) { | 
| 373   scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 373   scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 
| 374   base::ListValue* extension_types = new base::ListValue(); | 374   base::ListValue* extension_types = new base::ListValue(); | 
| 375   extension_types->Append(new base::StringValue("extension")); | 375   extension_types->Append(new base::StringValue("extension")); | 
| 376   extension_types->Append(new base::StringValue("theme")); | 376   extension_types->Append(new base::StringValue("theme")); | 
| 377   extension_types->Append(new base::StringValue("packaged_app")); | 377   extension_types->Append(new base::StringValue("packaged_app")); | 
| 378   extension_types->Append(new base::StringValue("hosted_app")); | 378   extension_types->Append(new base::StringValue("hosted_app")); | 
| 379   extension_types->Append(new base::StringValue("platform_app")); | 379   extension_types->Append(new base::StringValue("platform_app")); | 
|  | 380   extension_types->Append(new base::StringValue("shared_module")); | 
| 380   value->Set("extension_types", extension_types); | 381   value->Set("extension_types", extension_types); | 
| 381   scoped_ptr<SimpleFeature> feature(new SimpleFeature()); | 382   scoped_ptr<SimpleFeature> feature(new SimpleFeature()); | 
| 382   feature->Parse(value.get()); | 383   feature->Parse(value.get()); | 
| 383   EXPECT_EQ(5u, feature->extension_types()->size()); | 384   EXPECT_EQ(6u, feature->extension_types()->size()); | 
| 384   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_EXTENSION)); | 385   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_EXTENSION)); | 
| 385   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_THEME)); | 386   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_THEME)); | 
| 386   EXPECT_TRUE(feature->extension_types()->count( | 387   EXPECT_TRUE(feature->extension_types()->count( | 
| 387       Manifest::TYPE_LEGACY_PACKAGED_APP)); | 388       Manifest::TYPE_LEGACY_PACKAGED_APP)); | 
| 388   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_HOSTED_APP)); | 389   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_HOSTED_APP)); | 
| 389   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_PLATFORM_APP)); | 390   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_PLATFORM_APP)); | 
|  | 391   EXPECT_TRUE(feature->extension_types()->count(Manifest::TYPE_SHARED_MODULE)); | 
| 390 | 392 | 
| 391   value->SetString("extension_types", "all"); | 393   value->SetString("extension_types", "all"); | 
| 392   scoped_ptr<SimpleFeature> feature2(new SimpleFeature()); | 394   scoped_ptr<SimpleFeature> feature2(new SimpleFeature()); | 
| 393   feature2->Parse(value.get()); | 395   feature2->Parse(value.get()); | 
| 394   EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types())); | 396   EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types())); | 
| 395 } | 397 } | 
| 396 | 398 | 
| 397 TEST_F(ExtensionSimpleFeatureTest, ParseContexts) { | 399 TEST_F(ExtensionSimpleFeatureTest, ParseContexts) { | 
| 398   scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 400   scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 
| 399   base::ListValue* contexts = new base::ListValue(); | 401   base::ListValue* contexts = new base::ListValue(); | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 617             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_CANARY)); | 619             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_CANARY)); | 
| 618   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 620   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 
| 619             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_DEV)); | 621             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_DEV)); | 
| 620   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 622   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 
| 621             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_BETA)); | 623             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_BETA)); | 
| 622   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 624   EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, | 
| 623             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_STABLE)); | 625             IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_STABLE)); | 
| 624 } | 626 } | 
| 625 | 627 | 
| 626 }  // namespace | 628 }  // namespace | 
| OLD | NEW | 
|---|