Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / tools / gn / target_unittest.cc
index ef213b5..860dcaf 100644 (file)
@@ -169,3 +169,33 @@ TEST_F(TargetTest, DependentConfigs) {
   ASSERT_EQ(1u, a_fwd.all_dependent_configs().size());
   EXPECT_EQ(&all, a_fwd.all_dependent_configs()[0].ptr);
 }
+
+// Tests that forward_dependent_configs_from works for groups, forwarding the
+// group's deps' dependent configs.
+TEST_F(TargetTest, ForwardDependentConfigsFromGroups) {
+  Target a(&settings_, Label(SourceDir("//foo/"), "a"));
+  a.set_output_type(Target::EXECUTABLE);
+  Target b(&settings_, Label(SourceDir("//foo/"), "b"));
+  b.set_output_type(Target::GROUP);
+  Target c(&settings_, Label(SourceDir("//foo/"), "c"));
+  c.set_output_type(Target::STATIC_LIBRARY);
+  a.deps().push_back(LabelTargetPair(&b));
+  b.deps().push_back(LabelTargetPair(&c));
+
+  // Direct dependent config on C.
+  Config direct(&settings_, Label(SourceDir("//foo/"), "direct"));
+  c.direct_dependent_configs().push_back(LabelConfigPair(&direct));
+
+  // A forwards the dependent configs from B.
+  a.forward_dependent_configs().push_back(LabelTargetPair(&b));
+
+  c.OnResolved();
+  b.OnResolved();
+  a.OnResolved();
+
+  // The config should now be on A, and in A's direct dependent configs.
+  ASSERT_EQ(1u, a.configs().size());
+  ASSERT_EQ(&direct, a.configs()[0].ptr);
+  ASSERT_EQ(1u, a.direct_dependent_configs().size());
+  ASSERT_EQ(&direct, a.direct_dependent_configs()[0].ptr);
+}