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