OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/features/simple_feature.h" | 5 #include "extensions/common/features/simple_feature.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 std::string extension_id; | 29 std::string extension_id; |
30 Manifest::Type extension_type; | 30 Manifest::Type extension_type; |
31 Manifest::Location location; | 31 Manifest::Location location; |
32 Feature::Platform platform; | 32 Feature::Platform platform; |
33 int manifest_version; | 33 int manifest_version; |
34 Feature::AvailabilityResult expected_result; | 34 Feature::AvailabilityResult expected_result; |
35 }; | 35 }; |
36 | 36 |
37 template <class FeatureClass> | 37 template <class FeatureClass> |
38 SimpleFeature* CreateFeature() { | 38 SimpleFeature* CreateFeature() { |
39 SimpleFeature* feature = new FeatureClass(); | 39 return new FeatureClass(); |
40 feature->set_check_channel(true); | |
41 return feature; | |
42 } | 40 } |
43 | 41 |
44 Feature::AvailabilityResult IsAvailableInChannel( | 42 Feature::AvailabilityResult IsAvailableInChannel( |
45 const std::string& channel, | 43 const std::string& channel, |
46 version_info::Channel channel_for_testing) { | 44 version_info::Channel channel_for_testing) { |
47 ScopedCurrentChannel current_channel(channel_for_testing); | 45 ScopedCurrentChannel current_channel(channel_for_testing); |
48 | 46 |
49 SimpleFeature feature; | 47 SimpleFeature feature; |
50 | 48 |
51 base::DictionaryValue feature_value; | 49 base::DictionaryValue feature_value; |
52 feature_value.SetString("channel", channel); | 50 feature_value.SetString("channel", channel); |
53 feature.set_check_channel(true); | |
54 feature.Parse(&feature_value); | 51 feature.Parse(&feature_value); |
55 | 52 |
56 return feature | 53 return feature |
57 .IsAvailableToManifest("random-extension", Manifest::TYPE_UNKNOWN, | 54 .IsAvailableToManifest("random-extension", Manifest::TYPE_UNKNOWN, |
58 Manifest::INVALID_LOCATION, -1, | 55 Manifest::INVALID_LOCATION, -1, |
59 Feature::GetCurrentPlatform()) | 56 Feature::GetCurrentPlatform()) |
60 .result(); | 57 .result(); |
61 } | 58 } |
62 | 59 |
63 } // namespace | 60 } // namespace |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 Feature::IS_AVAILABLE, | 1004 Feature::IS_AVAILABLE, |
1008 feature->IsAvailableToManifest("1", | 1005 feature->IsAvailableToManifest("1", |
1009 Manifest::TYPE_EXTENSION, | 1006 Manifest::TYPE_EXTENSION, |
1010 Manifest::INVALID_LOCATION, | 1007 Manifest::INVALID_LOCATION, |
1011 Feature::UNSPECIFIED_PLATFORM, | 1008 Feature::UNSPECIFIED_PLATFORM, |
1012 Feature::GetCurrentPlatform()).result()); | 1009 Feature::GetCurrentPlatform()).result()); |
1013 } | 1010 } |
1014 } | 1011 } |
1015 | 1012 |
1016 } // namespace extensions | 1013 } // namespace extensions |
OLD | NEW |