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 23 matching lines...) Expand all Loading... |
34 0, | 34 0, |
35 kAllowFullName, | 35 kAllowFullName, |
36 kAllowShortName, | 36 kAllowShortName, |
37 kAllowFullName | kAllowShortName, | 37 kAllowFullName | kAllowShortName, |
38 kAllowNumber, | 38 kAllowNumber, |
39 kAllowFullName | kAllowNumber, | 39 kAllowFullName | kAllowNumber, |
40 kAllowShortName | kAllowNumber, | 40 kAllowShortName | kAllowNumber, |
41 kAllowFullName | kAllowShortName | kAllowNumber, | 41 kAllowFullName | kAllowShortName | kAllowNumber, |
42 }; | 42 }; |
43 | 43 |
44 // If |expect| is NULL, the conversion is expected to fail. If |expect| is | 44 // If |expect| is nullptr, the conversion is expected to fail. If |expect| is |
45 // empty, the conversion is expected to succeed, but the precise returned string | 45 // empty, the conversion is expected to succeed, but the precise returned string |
46 // value is unknown. Otherwise, the conversion is expected to succeed, and | 46 // value is unknown. Otherwise, the conversion is expected to succeed, and |
47 // |expect| contains the precise expected string value to be returned. If | 47 // |expect| contains the precise expected string value to be returned. If |
48 // |expect| contains the substring "0x1", the conversion is expected only to | 48 // |expect| contains the substring "0x1", the conversion is expected only to |
49 // succeed when kUnknownIsNumeric is set. | 49 // succeed when kUnknownIsNumeric is set. |
50 // | 50 // |
51 // Only set kUseFullName or kUseShortName when calling this. Other options are | 51 // Only set kUseFullName or kUseShortName when calling this. Other options are |
52 // exercised directly by this function. | 52 // exercised directly by this function. |
53 template <typename Traits> | 53 template <typename Traits> |
54 void TestSomethingToStringOnce(typename Traits::ValueType value, | 54 void TestSomethingToStringOnce(typename Traits::ValueType value, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 kExceptionTestData[index].short_name); | 164 kExceptionTestData[index].short_name); |
165 } | 165 } |
166 | 166 |
167 for (exception_type_t exception = 0; | 167 for (exception_type_t exception = 0; |
168 exception < EXC_TYPES_COUNT + 8; | 168 exception < EXC_TYPES_COUNT + 8; |
169 ++exception) { | 169 ++exception) { |
170 SCOPED_TRACE(base::StringPrintf("exception %d", exception)); | 170 SCOPED_TRACE(base::StringPrintf("exception %d", exception)); |
171 if (exception > 0 && exception < EXC_TYPES_COUNT) { | 171 if (exception > 0 && exception < EXC_TYPES_COUNT) { |
172 TestExceptionToString(exception, "", ""); | 172 TestExceptionToString(exception, "", ""); |
173 } else { | 173 } else { |
174 TestExceptionToString(exception, NULL, NULL); | 174 TestExceptionToString(exception, nullptr, nullptr); |
175 } | 175 } |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 void TestStringToException(const base::StringPiece& string, | 179 void TestStringToException(const base::StringPiece& string, |
180 StringToSymbolicConstantOptions options, | 180 StringToSymbolicConstantOptions options, |
181 bool expect_result, | 181 bool expect_result, |
182 exception_type_t expect_value) { | 182 exception_type_t expect_value) { |
183 return TestStringToSomething<ConvertExceptionTraits>( | 183 return TestStringToSomething<ConvertExceptionTraits>( |
184 string, options, expect_result, expect_value); | 184 string, options, expect_result, expect_value); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 kExceptionBehaviorTestData[index].short_name); | 584 kExceptionBehaviorTestData[index].short_name); |
585 } | 585 } |
586 | 586 |
587 for (exception_behavior_t behavior = 0; behavior < 8; ++behavior) { | 587 for (exception_behavior_t behavior = 0; behavior < 8; ++behavior) { |
588 SCOPED_TRACE(base::StringPrintf("behavior %d", behavior)); | 588 SCOPED_TRACE(base::StringPrintf("behavior %d", behavior)); |
589 exception_behavior_t behavior_mach = behavior | MACH_EXCEPTION_CODES; | 589 exception_behavior_t behavior_mach = behavior | MACH_EXCEPTION_CODES; |
590 if (behavior > 0 && behavior <= EXCEPTION_STATE_IDENTITY) { | 590 if (behavior > 0 && behavior <= EXCEPTION_STATE_IDENTITY) { |
591 TestExceptionBehaviorToString(behavior, "", ""); | 591 TestExceptionBehaviorToString(behavior, "", ""); |
592 TestExceptionBehaviorToString(behavior_mach, "", ""); | 592 TestExceptionBehaviorToString(behavior_mach, "", ""); |
593 } else { | 593 } else { |
594 TestExceptionBehaviorToString(behavior, NULL, NULL); | 594 TestExceptionBehaviorToString(behavior, nullptr, nullptr); |
595 TestExceptionBehaviorToString(behavior_mach, NULL, NULL); | 595 TestExceptionBehaviorToString(behavior_mach, nullptr, nullptr); |
596 } | 596 } |
597 } | 597 } |
598 } | 598 } |
599 | 599 |
600 void TestStringToExceptionBehavior(const base::StringPiece& string, | 600 void TestStringToExceptionBehavior(const base::StringPiece& string, |
601 StringToSymbolicConstantOptions options, | 601 StringToSymbolicConstantOptions options, |
602 bool expect_result, | 602 bool expect_result, |
603 exception_behavior_t expect_value) { | 603 exception_behavior_t expect_value) { |
604 return TestStringToSomething<ConvertExceptionBehaviorTraits>( | 604 return TestStringToSomething<ConvertExceptionBehaviorTraits>( |
605 string, options, expect_result, expect_value); | 605 string, options, expect_result, expect_value); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 flavor <= THREAD_STATE_NONE | 860 flavor <= THREAD_STATE_NONE |
861 #elif defined(__arm__) || defined(__arm64__) | 861 #elif defined(__arm__) || defined(__arm64__) |
862 (flavor <= ARM_EXCEPTION_STATE64 || flavor == ARM_THREAD_STATE32 || | 862 (flavor <= ARM_EXCEPTION_STATE64 || flavor == ARM_THREAD_STATE32 || |
863 (flavor >= ARM_DEBUG_STATE32 && flavor <= ARM_NEON_STATE64)) | 863 (flavor >= ARM_DEBUG_STATE32 && flavor <= ARM_NEON_STATE64)) |
864 #endif | 864 #endif |
865 || | 865 || |
866 flavor == THREAD_STATE_FLAVOR_LIST_NEW || | 866 flavor == THREAD_STATE_FLAVOR_LIST_NEW || |
867 flavor == THREAD_STATE_FLAVOR_LIST_10_9) { | 867 flavor == THREAD_STATE_FLAVOR_LIST_10_9) { |
868 TestThreadStateFlavorToString(flavor, "", ""); | 868 TestThreadStateFlavorToString(flavor, "", ""); |
869 } else { | 869 } else { |
870 TestThreadStateFlavorToString(flavor, NULL, NULL); | 870 TestThreadStateFlavorToString(flavor, nullptr, nullptr); |
871 } | 871 } |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
875 void TestStringToThreadStateFlavor(const base::StringPiece& string, | 875 void TestStringToThreadStateFlavor(const base::StringPiece& string, |
876 StringToSymbolicConstantOptions options, | 876 StringToSymbolicConstantOptions options, |
877 bool expect_result, | 877 bool expect_result, |
878 thread_state_flavor_t expect_value) { | 878 thread_state_flavor_t expect_value) { |
879 return TestStringToSomething<ConvertThreadStateFlavorTraits>( | 879 return TestStringToSomething<ConvertThreadStateFlavorTraits>( |
880 string, options, expect_result, expect_value); | 880 string, options, expect_result, expect_value); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 TestStringToThreadStateFlavor(base::StringPiece("FLAVOR_LIST_NEWS", 15), | 1057 TestStringToThreadStateFlavor(base::StringPiece("FLAVOR_LIST_NEWS", 15), |
1058 kAllowShortName, | 1058 kAllowShortName, |
1059 true, | 1059 true, |
1060 THREAD_STATE_FLAVOR_LIST_NEW); | 1060 THREAD_STATE_FLAVOR_LIST_NEW); |
1061 } | 1061 } |
1062 } | 1062 } |
1063 | 1063 |
1064 } // namespace | 1064 } // namespace |
1065 } // namespace test | 1065 } // namespace test |
1066 } // namespace crashpad | 1066 } // namespace crashpad |
OLD | NEW |