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 17 matching lines...) Expand all Loading... |
28 BuildSettings* build_settings() { return &build_settings_; } | 28 BuildSettings* build_settings() { return &build_settings_; } |
29 Settings* settings() { return &settings_; } | 29 Settings* settings() { return &settings_; } |
30 Toolchain* toolchain() { return &toolchain_; } | 30 Toolchain* toolchain() { return &toolchain_; } |
31 Scope* scope() { return &scope_; } | 31 Scope* scope() { return &scope_; } |
32 | 32 |
33 // This buffer accumulates output from any print() commands executed in the | 33 // This buffer accumulates output from any print() commands executed in the |
34 // context of this test. Note that the implementation of this is not | 34 // context of this test. Note that the implementation of this is not |
35 // threadsafe so don't write tests that call print from multiple threads. | 35 // threadsafe so don't write tests that call print from multiple threads. |
36 std::string& print_output() { return print_output_; } | 36 std::string& print_output() { return print_output_; } |
37 | 37 |
| 38 // Fills in the tools for the given toolchain with reasonable default values. |
| 39 // The toolchain in this object will be automatically set up with this |
| 40 // function, it is exposed to allow tests to get the same functionality for |
| 41 // other toolchains they make |
| 42 static void SetupToolchain(Toolchain* toolchain); |
| 43 |
38 private: | 44 private: |
39 void AppendPrintOutput(const std::string& str); | 45 void AppendPrintOutput(const std::string& str); |
40 | 46 |
41 BuildSettings build_settings_; | 47 BuildSettings build_settings_; |
42 Settings settings_; | 48 Settings settings_; |
43 Toolchain toolchain_; | 49 Toolchain toolchain_; |
44 Scope scope_; | 50 Scope scope_; |
45 | 51 |
46 std::string print_output_; | 52 std::string print_output_; |
47 | 53 |
(...skipping 22 matching lines...) Expand all Loading... |
70 | 76 |
71 std::vector<Token> tokens_; | 77 std::vector<Token> tokens_; |
72 scoped_ptr<ParseNode> parsed_; | 78 scoped_ptr<ParseNode> parsed_; |
73 | 79 |
74 Err parse_err_; | 80 Err parse_err_; |
75 | 81 |
76 DISALLOW_COPY_AND_ASSIGN(TestParseInput); | 82 DISALLOW_COPY_AND_ASSIGN(TestParseInput); |
77 }; | 83 }; |
78 | 84 |
79 #endif // TOOLS_GN_TEST_WITH_SCOPE_H_ | 85 #endif // TOOLS_GN_TEST_WITH_SCOPE_H_ |
OLD | NEW |