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

Unified Diff: tools/gn/ninja_bundle_data_target_writer_unittest.cc

Issue 2105613003: Fix dependencies rules for create_bundle and bundle_data ninja steps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stamps (to allow using hardlinks) Created 4 years, 6 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/gn/ninja_bundle_data_target_writer.cc ('k') | tools/gn/ninja_create_bundle_target_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_bundle_data_target_writer_unittest.cc
diff --git a/tools/gn/ninja_bundle_data_target_writer_unittest.cc b/tools/gn/ninja_bundle_data_target_writer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b4725c7c57564c27094afd28998ba8e20496ee8e
--- /dev/null
+++ b/tools/gn/ninja_bundle_data_target_writer_unittest.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/ninja_bundle_data_target_writer.h"
+
+#include <algorithm>
+#include <sstream>
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "tools/gn/target.h"
+#include "tools/gn/test_with_scope.h"
+
+TEST(NinjaBundleDataTargetWriter, Run) {
+ Err err;
+
+ TestWithScope setup;
+ setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
+
+ Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data"));
+ bundle_data.set_output_type(Target::BUNDLE_DATA);
+ bundle_data.sources().push_back(SourceFile("//foo/input1.txt"));
+ bundle_data.sources().push_back(SourceFile("//foo/input2.txt"));
+ bundle_data.sources().push_back(
+ SourceFile("//foo/Foo.xcassets/Contents.json"));
+ bundle_data.sources().push_back(
+ SourceFile("//foo/Foo.xcassets/foo.imageset/Contents.json"));
+ bundle_data.sources().push_back(
+ SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29.png"));
+ bundle_data.sources().push_back(
+ SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png"));
+ bundle_data.sources().push_back(
+ SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png"));
+ bundle_data.action_values().outputs() = SubstitutionList::MakeForTest(
+ "{{bundle_resources_dir}}/{{source_file_part}}");
+ bundle_data.SetToolchain(setup.toolchain());
+ bundle_data.visibility().SetPublic();
+ ASSERT_TRUE(bundle_data.OnResolved(&err));
+
+ std::ostringstream out;
+ NinjaBundleDataTargetWriter writer(&bundle_data, out);
+ writer.Run();
+
+ const char expected[] =
+ "build obj/foo/data.stamp: stamp "
+ "../../foo/input1.txt "
+ "../../foo/input2.txt "
+ "../../foo/Foo.xcassets/Contents.json "
+ "../../foo/Foo.xcassets/foo.imageset/Contents.json "
+ "../../foo/Foo.xcassets/foo.imageset/FooIcon-29.png "
+ "../../foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png "
+ "../../foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png\n";
+ std::string out_str = out.str();
+ EXPECT_EQ(expected, out_str);
+}
« no previous file with comments | « tools/gn/ninja_bundle_data_target_writer.cc ('k') | tools/gn/ninja_create_bundle_target_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698