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 "extensions/common/extension_api.h" | 5 #include "extensions/common/extension_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 // TODO(aa): More stuff to test over time. | 659 // TODO(aa): More stuff to test over time. |
660 } test_data[] = { | 660 } test_data[] = { |
661 { bookmarks }, | 661 { bookmarks }, |
662 { bookmarks_create } | 662 { bookmarks_create } |
663 }; | 663 }; |
664 | 664 |
665 for (size_t i = 0; i < arraysize(test_data); ++i) { | 665 for (size_t i = 0; i < arraysize(test_data); ++i) { |
666 SimpleFeature* feature = test_data[i].feature; | 666 SimpleFeature* feature = test_data[i].feature; |
667 ASSERT_TRUE(feature) << i; | 667 ASSERT_TRUE(feature) << i; |
668 | 668 |
669 EXPECT_TRUE(feature->whitelist()->empty()); | 669 EXPECT_TRUE(feature->whitelist().empty()); |
670 EXPECT_TRUE(feature->extension_types()->empty()); | 670 EXPECT_TRUE(feature->extension_types().empty()); |
671 | 671 |
672 EXPECT_EQ(SimpleFeature::UNSPECIFIED_LOCATION, feature->location()); | 672 EXPECT_EQ(SimpleFeature::UNSPECIFIED_LOCATION, feature->location()); |
673 EXPECT_TRUE(feature->platforms()->empty()); | 673 EXPECT_TRUE(feature->platforms().empty()); |
674 EXPECT_EQ(0, feature->min_manifest_version()); | 674 EXPECT_EQ(0, feature->min_manifest_version()); |
675 EXPECT_EQ(0, feature->max_manifest_version()); | 675 EXPECT_EQ(0, feature->max_manifest_version()); |
676 } | 676 } |
677 } | 677 } |
678 | 678 |
679 TEST(ExtensionAPITest, JSONFeatureProviderDoesNotStoreInvalidFeatures) { | 679 TEST(ExtensionAPITest, JSONFeatureProviderDoesNotStoreInvalidFeatures) { |
680 base::DictionaryValue features; | 680 base::DictionaryValue features; |
681 std::unique_ptr<base::DictionaryValue> feature_value( | 681 std::unique_ptr<base::DictionaryValue> feature_value( |
682 new base::DictionaryValue()); | 682 new base::DictionaryValue()); |
683 // This feature is invalid (it needs an extension context), so the | 683 // This feature is invalid (it needs an extension context), so the |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 extension.get(), | 835 extension.get(), |
836 Feature::BLESSED_EXTENSION_CONTEXT, | 836 Feature::BLESSED_EXTENSION_CONTEXT, |
837 GURL()).is_available()); | 837 GURL()).is_available()); |
838 EXPECT_FALSE(extension_api->IsAvailable("pageAction", | 838 EXPECT_FALSE(extension_api->IsAvailable("pageAction", |
839 extension.get(), | 839 extension.get(), |
840 Feature::BLESSED_EXTENSION_CONTEXT, | 840 Feature::BLESSED_EXTENSION_CONTEXT, |
841 GURL()).is_available()); | 841 GURL()).is_available()); |
842 } | 842 } |
843 | 843 |
844 } // namespace extensions | 844 } // namespace extensions |
OLD | NEW |