Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: tools/json_schema_compiler/test/features_generation_unittest.cc

Issue 2165023003: [Extensions] Use compiled feature files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/test/BUILD.gn ('k') | tools/json_schema_compiler/test/features_test.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/test/features_generation_unittest.cc
diff --git a/tools/json_schema_compiler/test/features_generation_unittest.cc b/tools/json_schema_compiler/test/features_generation_unittest.cc
index 7a175a05dc97b5cd394067b91760e9c37a333065..087a3442c4644ce8cf59c81935df28b9ed962573 100644
--- a/tools/json_schema_compiler/test/features_generation_unittest.cc
+++ b/tools/json_schema_compiler/test/features_generation_unittest.cc
@@ -7,7 +7,7 @@
#include "extensions/common/features/feature.h"
#include "extensions/common/features/simple_feature.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "tools/json_schema_compiler/test/features_test.h"
+#include "tools/json_schema_compiler/test/features_compiler_test.h"
namespace extensions {
@@ -89,7 +89,7 @@ void FeatureComparator::CompareFeature(SimpleFeature* feature) {
}
TEST(FeaturesGenerationTest, FeaturesTest) {
- TestAPIFeatureProvider provider;
+ CompilerTestFeatureProvider provider;
auto GetAPIFeature = [&provider](const std::string& name) {
Feature* feature = provider.GetFeature(name);
@@ -125,6 +125,7 @@ TEST(FeaturesGenerationTest, FeaturesTest) {
new version_info::Channel(version_info::Channel::BETA));
comparator.platforms = {Feature::WIN_PLATFORM, Feature::MACOSX_PLATFORM};
comparator.contexts = {Feature::BLESSED_EXTENSION_CONTEXT};
+ comparator.dependencies = {"permission:gamma"};
comparator.extension_types = {Manifest::TYPE_EXTENSION};
comparator.internal = true;
comparator.CompareFeature(feature);
@@ -133,9 +134,9 @@ TEST(FeaturesGenerationTest, FeaturesTest) {
// case that it specifies its own value. Thus, we reuse |comparator|.
feature = GetAPIFeature("gamma.child");
comparator.name = "gamma.child";
- comparator.dependencies = {"permission:gamma.child"};
comparator.whitelist = {"ccc"};
comparator.platforms = {Feature::LINUX_PLATFORM};
+ comparator.dependencies.clear();
comparator.CompareFeature(feature);
}
{
@@ -148,6 +149,18 @@ TEST(FeaturesGenerationTest, FeaturesTest) {
comparator.CompareFeature(feature);
}
{
+ ComplexFeature* complex_feature = static_cast<ComplexFeature*>(
+ provider.GetFeature("gamma.complex_unparented"));
+ FeatureComparator comparator("gamma.complex_unparented");
+ comparator.contexts = {Feature::UNBLESSED_EXTENSION_CONTEXT};
+ comparator.channel.reset(
+ new version_info::Channel(version_info::Channel::STABLE));
+ // We cheat and have both children exactly the same for ease of comparing;
+ // complex features are tested more thoroughly below.
+ for (const auto& feature : complex_feature->features_)
+ comparator.CompareFeature(static_cast<SimpleFeature*>(feature.get()));
+ }
+ {
APIFeature* feature = GetAPIFeature("delta");
FeatureComparator comparator("delta");
comparator.contexts = {Feature::BLESSED_EXTENSION_CONTEXT,
« no previous file with comments | « tools/json_schema_compiler/test/BUILD.gn ('k') | tools/json_schema_compiler/test/features_test.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698