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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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
« no previous file with comments | « tools/gn/target_generator.cc ('k') | tools/gn/template.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 ASSERT_TRUE(forward.OnResolved(&err)); 424 ASSERT_TRUE(forward.OnResolved(&err));
425 } 425 }
426 426
427 // Tests that different link/depend outputs work for solink tools. 427 // Tests that different link/depend outputs work for solink tools.
428 TEST(Target, LinkAndDepOutputs) { 428 TEST(Target, LinkAndDepOutputs) {
429 TestWithScope setup; 429 TestWithScope setup;
430 Err err; 430 Err err;
431 431
432 Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc")); 432 Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
433 433
434 scoped_ptr<Tool> solink_tool(new Tool()); 434 std::unique_ptr<Tool> solink_tool(new Tool());
435 solink_tool->set_output_prefix("lib"); 435 solink_tool->set_output_prefix("lib");
436 solink_tool->set_default_output_extension(".so"); 436 solink_tool->set_default_output_extension(".so");
437 437
438 const char kLinkPattern[] = 438 const char kLinkPattern[] =
439 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"; 439 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}";
440 SubstitutionPattern link_output = SubstitutionPattern::MakeForTest( 440 SubstitutionPattern link_output = SubstitutionPattern::MakeForTest(
441 kLinkPattern); 441 kLinkPattern);
442 solink_tool->set_link_output(link_output); 442 solink_tool->set_link_output(link_output);
443 443
444 const char kDependPattern[] = 444 const char kDependPattern[] =
(...skipping 18 matching lines...) Expand all
463 } 463 }
464 464
465 // Tests that runtime_link output works without an explicit link_output for 465 // Tests that runtime_link output works without an explicit link_output for
466 // solink tools. 466 // solink tools.
467 TEST(Target, RuntimeLinkOuput) { 467 TEST(Target, RuntimeLinkOuput) {
468 TestWithScope setup; 468 TestWithScope setup;
469 Err err; 469 Err err;
470 470
471 Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc")); 471 Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
472 472
473 scoped_ptr<Tool> solink_tool(new Tool()); 473 std::unique_ptr<Tool> solink_tool(new Tool());
474 solink_tool->set_output_prefix(""); 474 solink_tool->set_output_prefix("");
475 solink_tool->set_default_output_extension(".dll"); 475 solink_tool->set_default_output_extension(".dll");
476 476
477 const char kLibPattern[] = 477 const char kLibPattern[] =
478 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib"; 478 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib";
479 SubstitutionPattern lib_output = 479 SubstitutionPattern lib_output =
480 SubstitutionPattern::MakeForTest(kLibPattern); 480 SubstitutionPattern::MakeForTest(kLibPattern);
481 481
482 const char kDllPattern[] = 482 const char kDllPattern[] =
483 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"; 483 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}";
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 ASSERT_EQ(c.bundle_data().file_rules().size(), 1u); 876 ASSERT_EQ(c.bundle_data().file_rules().size(), 1u);
877 ASSERT_EQ(c.bundle_data().file_rules()[0].sources().size(), 1u); 877 ASSERT_EQ(c.bundle_data().file_rules()[0].sources().size(), 1u);
878 ASSERT_EQ(c.bundle_data().bundle_deps().size(), 1u); 878 ASSERT_EQ(c.bundle_data().bundle_deps().size(), 1u);
879 879
880 // E does not have any bundle_data information but gets a list of 880 // E does not have any bundle_data information but gets a list of
881 // bundle_deps to propagate them during target resolution. 881 // bundle_deps to propagate them during target resolution.
882 ASSERT_TRUE(e.bundle_data().file_rules().empty()); 882 ASSERT_TRUE(e.bundle_data().file_rules().empty());
883 ASSERT_TRUE(e.bundle_data().asset_catalog_sources().empty()); 883 ASSERT_TRUE(e.bundle_data().asset_catalog_sources().empty());
884 ASSERT_EQ(e.bundle_data().bundle_deps().size(), 2u); 884 ASSERT_EQ(e.bundle_data().bundle_deps().size(), 2u);
885 } 885 }
OLDNEW
« no previous file with comments | « tools/gn/target_generator.cc ('k') | tools/gn/template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698