OLD | NEW |
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/test_with_scope.h" | 5 #include "tools/gn/test_with_scope.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "tools/gn/parser.h" | 10 #include "tools/gn/parser.h" |
11 #include "tools/gn/tokenizer.h" | 11 #include "tools/gn/tokenizer.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 BuildSettings CreateBuildSettingsForTest() { | 15 BuildSettings CreateBuildSettingsForTest() { |
16 BuildSettings build_settings; | 16 BuildSettings build_settings; |
17 build_settings.SetBuildDir(SourceDir("//out/Debug/")); | 17 build_settings.SetBuildDir(SourceDir("//out/Debug/")); |
18 return build_settings; | 18 return build_settings; |
19 } | 19 } |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 TestWithScope::TestWithScope() | 23 TestWithScope::TestWithScope() |
24 : build_settings_(CreateBuildSettingsForTest()), | 24 : build_settings_(CreateBuildSettingsForTest()), |
25 settings_(&build_settings_, std::string()), | 25 settings_(&build_settings_, std::string()), |
26 toolchain_(&settings_, Label(SourceDir("//toolchain/"), "default")), | 26 toolchain_(&settings_, Label(SourceDir("//toolchain/"), "default"), {}), |
27 scope_(&settings_), | 27 scope_(&settings_, {}), |
28 scope_progammatic_provider_(&scope_, true) { | 28 scope_progammatic_provider_(&scope_, true) { |
29 build_settings_.set_print_callback( | 29 build_settings_.set_print_callback( |
30 base::Bind(&TestWithScope::AppendPrintOutput, base::Unretained(this))); | 30 base::Bind(&TestWithScope::AppendPrintOutput, base::Unretained(this))); |
31 | 31 |
32 settings_.set_toolchain_label(toolchain_.label()); | 32 settings_.set_toolchain_label(toolchain_.label()); |
33 settings_.set_default_toolchain_label(toolchain_.label()); | 33 settings_.set_default_toolchain_label(toolchain_.label()); |
34 | 34 |
35 SetupToolchain(&toolchain_); | 35 SetupToolchain(&toolchain_); |
36 scope_.set_item_collector(&items_); | 36 scope_.set_item_collector(&items_); |
37 } | 37 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!parse_err_.has_error()) | 207 if (!parse_err_.has_error()) |
208 parsed_ = Parser::Parse(tokens_, &parse_err_); | 208 parsed_ = Parser::Parse(tokens_, &parse_err_); |
209 } | 209 } |
210 | 210 |
211 TestParseInput::~TestParseInput() { | 211 TestParseInput::~TestParseInput() { |
212 } | 212 } |
213 | 213 |
214 TestTarget::TestTarget(const TestWithScope& setup, | 214 TestTarget::TestTarget(const TestWithScope& setup, |
215 const std::string& label_string, | 215 const std::string& label_string, |
216 Target::OutputType type) | 216 Target::OutputType type) |
217 : Target(setup.settings(), setup.ParseLabel(label_string)) { | 217 : Target(setup.settings(), setup.ParseLabel(label_string), {}) { |
218 visibility().SetPublic(); | 218 visibility().SetPublic(); |
219 set_output_type(type); | 219 set_output_type(type); |
220 SetToolchain(setup.toolchain()); | 220 SetToolchain(setup.toolchain()); |
221 } | 221 } |
222 | 222 |
223 TestTarget::~TestTarget() { | 223 TestTarget::~TestTarget() { |
224 } | 224 } |
OLD | NEW |