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 #ifndef TOOLS_GN_TEST_WITH_SCOPE_H_ | 5 #ifndef TOOLS_GN_TEST_WITH_SCOPE_H_ |
6 #define TOOLS_GN_TEST_WITH_SCOPE_H_ | 6 #define TOOLS_GN_TEST_WITH_SCOPE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // threadsafe so don't write tests that call print from multiple threads. | 36 // threadsafe so don't write tests that call print from multiple threads. |
37 std::string& print_output() { return print_output_; } | 37 std::string& print_output() { return print_output_; } |
38 | 38 |
39 // Parse the given string into a label in the default toolchain. This will | 39 // Parse the given string into a label in the default toolchain. This will |
40 // assert if the label isn't valid (this is intended for hardcoded labels). | 40 // assert if the label isn't valid (this is intended for hardcoded labels). |
41 Label ParseLabel(const std::string& str) const; | 41 Label ParseLabel(const std::string& str) const; |
42 | 42 |
43 // Fills in the tools for the given toolchain with reasonable default values. | 43 // Fills in the tools for the given toolchain with reasonable default values. |
44 // The toolchain in this object will be automatically set up with this | 44 // The toolchain in this object will be automatically set up with this |
45 // function, it is exposed to allow tests to get the same functionality for | 45 // function, it is exposed to allow tests to get the same functionality for |
46 // other toolchains they make | 46 // other toolchains they make. |
47 static void SetupToolchain(Toolchain* toolchain); | 47 static void SetupToolchain(Toolchain* toolchain); |
48 | 48 |
| 49 // Sets the given text command on the given tool, parsing it as a |
| 50 // substitution pattern. This will assert if the input is malformed. This is |
| 51 // designed to help setting up Tools for tests. |
| 52 static void SetCommandForTool(const std::string& cmd, Tool* tool); |
| 53 |
49 private: | 54 private: |
50 void AppendPrintOutput(const std::string& str); | 55 void AppendPrintOutput(const std::string& str); |
51 | 56 |
52 BuildSettings build_settings_; | 57 BuildSettings build_settings_; |
53 Settings settings_; | 58 Settings settings_; |
54 Toolchain toolchain_; | 59 Toolchain toolchain_; |
55 Scope scope_; | 60 Scope scope_; |
56 | 61 |
57 std::string print_output_; | 62 std::string print_output_; |
58 | 63 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // default to public visibility. | 97 // default to public visibility. |
93 class TestTarget : public Target { | 98 class TestTarget : public Target { |
94 public: | 99 public: |
95 TestTarget(TestWithScope& setup, | 100 TestTarget(TestWithScope& setup, |
96 const std::string& label_string, | 101 const std::string& label_string, |
97 Target::OutputType type); | 102 Target::OutputType type); |
98 ~TestTarget() override; | 103 ~TestTarget() override; |
99 }; | 104 }; |
100 | 105 |
101 #endif // TOOLS_GN_TEST_WITH_SCOPE_H_ | 106 #endif // TOOLS_GN_TEST_WITH_SCOPE_H_ |
OLD | NEW |