OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 16 matching lines...) Expand all Loading... |
27 // When C++ exceptions are disabled, libstdc++ from GCC 4.2 defines |try| and | 27 // When C++ exceptions are disabled, libstdc++ from GCC 4.2 defines |try| and |
28 // |catch| so as to allow exception-expecting C++ code to build properly when | 28 // |catch| so as to allow exception-expecting C++ code to build properly when |
29 // language support for exceptions is not present. These macros interfere with | 29 // language support for exceptions is not present. These macros interfere with |
30 // the use of |@try| and |@catch| in Objective-C files such as this one. | 30 // the use of |@try| and |@catch| in Objective-C files such as this one. |
31 // Undefine these macros here, after everything has been #included, since there | 31 // Undefine these macros here, after everything has been #included, since there |
32 // will be no C++ uses and only Objective-C uses from this point on. | 32 // will be no C++ uses and only Objective-C uses from this point on. |
33 #undef try | 33 #undef try |
34 #undef catch | 34 #undef catch |
35 #endif | 35 #endif |
36 | 36 |
| 37 namespace crashpad { |
| 38 namespace test { |
37 namespace { | 39 namespace { |
38 | 40 |
39 using namespace crashpad; | |
40 | |
41 // Runs /usr/bin/sw_vers with a single argument, |argument|, and places the | 41 // Runs /usr/bin/sw_vers with a single argument, |argument|, and places the |
42 // command’s standard output into |output| after stripping the trailing newline. | 42 // command’s standard output into |output| after stripping the trailing newline. |
43 // Fatal gtest assertions report tool failures, which the caller should check | 43 // Fatal gtest assertions report tool failures, which the caller should check |
44 // for with testing::Test::HasFatalFailure(). | 44 // for with testing::Test::HasFatalFailure(). |
45 void SwVers(NSString* argument, std::string* output) { | 45 void SwVers(NSString* argument, std::string* output) { |
46 @autoreleasepool { | 46 @autoreleasepool { |
47 base::scoped_nsobject<NSPipe> pipe([[NSPipe alloc] init]); | 47 base::scoped_nsobject<NSPipe> pipe([[NSPipe alloc] init]); |
48 base::scoped_nsobject<NSTask> task([[NSTask alloc] init]); | 48 base::scoped_nsobject<NSTask> task([[NSTask alloc] init]); |
49 [task setStandardOutput:pipe]; | 49 [task setStandardOutput:pipe]; |
50 [task setLaunchPath:@"/usr/bin/sw_vers"]; | 50 [task setLaunchPath:@"/usr/bin/sw_vers"]; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // MacModelAndBoard() gets the data, so it wouldn’t be a very useful test. | 140 // MacModelAndBoard() gets the data, so it wouldn’t be a very useful test. |
141 std::string model; | 141 std::string model; |
142 std::string board; | 142 std::string board; |
143 MacModelAndBoard(&model, &board); | 143 MacModelAndBoard(&model, &board); |
144 | 144 |
145 EXPECT_FALSE(model.empty()); | 145 EXPECT_FALSE(model.empty()); |
146 EXPECT_FALSE(board.empty()); | 146 EXPECT_FALSE(board.empty()); |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
| 150 } // namespace test |
| 151 } // namespace crashpad |
OLD | NEW |