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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 {SIGXCPU, "SIGXCPU", "XCPU"}, | 62 {SIGXCPU, "SIGXCPU", "XCPU"}, |
63 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
64 {SIGEMT, "SIGEMT", "EMT"}, | 64 {SIGEMT, "SIGEMT", "EMT"}, |
65 {SIGINFO, "SIGINFO", "INFO"}, | 65 {SIGINFO, "SIGINFO", "INFO"}, |
66 #elif defined(OS_LINUX) | 66 #elif defined(OS_LINUX) |
67 {SIGPWR, "SIGPWR", "PWR"}, | 67 {SIGPWR, "SIGPWR", "PWR"}, |
68 {SIGSTKFLT, "SIGSTKFLT", "STKFLT"}, | 68 {SIGSTKFLT, "SIGSTKFLT", "STKFLT"}, |
69 #endif | 69 #endif |
70 }; | 70 }; |
71 | 71 |
72 // If |expect| is NULL, the conversion is expected to fail. If |expect| is | 72 // If |expect| is nullptr, the conversion is expected to fail. If |expect| is |
73 // empty, the conversion is expected to succeed, but the precise returned string | 73 // empty, the conversion is expected to succeed, but the precise returned string |
74 // value is unknown. Otherwise, the conversion is expected to succeed, and | 74 // value is unknown. Otherwise, the conversion is expected to succeed, and |
75 // |expect| contains the precise expected string value to be returned. | 75 // |expect| contains the precise expected string value to be returned. |
76 // | 76 // |
77 // Only set kUseFullName or kUseShortName when calling this. Other options are | 77 // Only set kUseFullName or kUseShortName when calling this. Other options are |
78 // exercised directly by this function. | 78 // exercised directly by this function. |
79 void TestSignalToStringOnce(int value, | 79 void TestSignalToStringOnce(int value, |
80 const char* expect, | 80 const char* expect, |
81 SymbolicConstantToStringOptions options) { | 81 SymbolicConstantToStringOptions options) { |
82 std::string actual = SignalToString(value, options | kUnknownIsEmpty); | 82 std::string actual = SignalToString(value, options | kUnknownIsEmpty); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const int kSignalCount = 32; | 123 const int kSignalCount = 32; |
124 #else | 124 #else |
125 const int kSignalCount = NSIG; | 125 const int kSignalCount = NSIG; |
126 #endif | 126 #endif |
127 | 127 |
128 for (int signal = 0; signal < kSignalCount + 8; ++signal) { | 128 for (int signal = 0; signal < kSignalCount + 8; ++signal) { |
129 SCOPED_TRACE(base::StringPrintf("signal %d", signal)); | 129 SCOPED_TRACE(base::StringPrintf("signal %d", signal)); |
130 if (signal > 0 && signal < kSignalCount) { | 130 if (signal > 0 && signal < kSignalCount) { |
131 TestSignalToString(signal, "", ""); | 131 TestSignalToString(signal, "", ""); |
132 } else { | 132 } else { |
133 TestSignalToString(signal, NULL, NULL); | 133 TestSignalToString(signal, nullptr, nullptr); |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 void TestStringToSignal(const base::StringPiece& string, | 138 void TestStringToSignal(const base::StringPiece& string, |
139 StringToSymbolicConstantOptions options, | 139 StringToSymbolicConstantOptions options, |
140 bool expect_result, | 140 bool expect_result, |
141 int expect_value) { | 141 int expect_value) { |
142 int actual_value; | 142 int actual_value; |
143 bool actual_result = StringToSignal(string, options, &actual_value); | 143 bool actual_result = StringToSignal(string, options, &actual_value); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 { | 247 { |
248 SCOPED_TRACE("trailing_NUL_short"); | 248 SCOPED_TRACE("trailing_NUL_short"); |
249 TestStringToSignal( | 249 TestStringToSignal( |
250 base::StringPiece("BUST", 3), kAllowShortName, true, SIGBUS); | 250 base::StringPiece("BUST", 3), kAllowShortName, true, SIGBUS); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 } // namespace | 254 } // namespace |
255 } // namespace test | 255 } // namespace test |
256 } // namespace crashpad | 256 } // namespace crashpad |
OLD | NEW |