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

Side by Side Diff: tools/gn/target_unittest.cc

Issue 1606553002: Add support for Mac/iOS application bundles to GN tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests & support for bundle_data_filter Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "tools/gn/target.h" 5 #include "tools/gn/target.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "tools/gn/build_settings.h" 10 #include "tools/gn/build_settings.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 d.private_deps().push_back(LabelTargetPair(&exe)); 716 d.private_deps().push_back(LabelTargetPair(&exe));
717 d.assert_no_deps().push_back(disallow_a); 717 d.assert_no_deps().push_back(disallow_a);
718 ASSERT_TRUE(d.OnResolved(&err)); 718 ASSERT_TRUE(d.OnResolved(&err));
719 719
720 // A2 disallows depending on anything in its own directory, but the 720 // A2 disallows depending on anything in its own directory, but the
721 // assertions should not match the target itself so this should be OK. 721 // assertions should not match the target itself so this should be OK.
722 TestTarget a2(setup, "//a:a2", Target::EXECUTABLE); 722 TestTarget a2(setup, "//a:a2", Target::EXECUTABLE);
723 a2.assert_no_deps().push_back(disallow_a); 723 a2.assert_no_deps().push_back(disallow_a);
724 ASSERT_TRUE(a2.OnResolved(&err)); 724 ASSERT_TRUE(a2.OnResolved(&err));
725 } 725 }
726
727 TEST(Target, BundleData) {
728 TestWithScope setup;
729 Err err;
730
731 // A target.
732 TestTarget a(setup, "//a", Target::SOURCE_SET);
733 a.bundle_data().insert(SourceFile("//a/a.dat"));
734 a.bundle_data().insert(SourceFile("//a/a.in"));
735 ASSERT_TRUE(a.OnResolved(&err));
736
737 // B target.
738 TestTarget b(setup, "//b", Target::SOURCE_SET);
739 b.bundle_data().insert(SourceFile("//b/b.dat"));
740 b.private_deps().push_back(LabelTargetPair(&a));
741 ASSERT_TRUE(b.OnResolved(&err));
742
743 // C target.
744 TestTarget c(setup, "//c", Target::COPY_BUNDLE_DATA);
745 c.bundle_data_filter().Append(Pattern("*.in"));
746 c.private_deps().push_back(LabelTargetPair(&b));
747 ASSERT_TRUE(c.OnResolved(&err));
748
749 Target::FileList expected_sources;
750 expected_sources.push_back(SourceFile("//a/a.dat"));
751 expected_sources.push_back(SourceFile("//b/b.dat"));
752 ASSERT_EQ(expected_sources, c.sources());
753 }
754
755 TEST(Target, BundleDataStopAtExecutable) {
756 TestWithScope setup;
757 Err err;
758
759 // A target.
760 TestTarget a(setup, "//a", Target::SOURCE_SET);
761 a.bundle_data().insert(SourceFile("//a/a.dat"));
762 a.bundle_data().insert(SourceFile("//a/a.in"));
763 ASSERT_TRUE(a.OnResolved(&err));
764
765 // B target.
766 TestTarget b(setup, "//b", Target::EXECUTABLE);
767 b.private_deps().push_back(LabelTargetPair(&a));
768 ASSERT_TRUE(b.OnResolved(&err));
769
770 // C target.
771 TestTarget c(setup, "//c", Target::COPY_BUNDLE_DATA);
772 c.private_deps().push_back(LabelTargetPair(&b));
773 ASSERT_TRUE(c.OnResolved(&err));
774
775 Target::FileList expected_sources;
776 ASSERT_EQ(expected_sources, c.sources());
777 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698