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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 | 531 |
532 const struct { | 532 const struct { |
533 exception_behavior_t behavior; | 533 exception_behavior_t behavior; |
534 const char* full_name; | 534 const char* full_name; |
535 const char* short_name; | 535 const char* short_name; |
536 } kExceptionBehaviorTestData[] = { | 536 } kExceptionBehaviorTestData[] = { |
537 {EXCEPTION_DEFAULT, "EXCEPTION_DEFAULT", "DEFAULT"}, | 537 {EXCEPTION_DEFAULT, "EXCEPTION_DEFAULT", "DEFAULT"}, |
538 {EXCEPTION_STATE, "EXCEPTION_STATE", "STATE"}, | 538 {EXCEPTION_STATE, "EXCEPTION_STATE", "STATE"}, |
539 {EXCEPTION_STATE_IDENTITY, "EXCEPTION_STATE_IDENTITY", "STATE_IDENTITY"}, | 539 {EXCEPTION_STATE_IDENTITY, "EXCEPTION_STATE_IDENTITY", "STATE_IDENTITY"}, |
540 {static_cast<exception_behavior_t>(EXCEPTION_DEFAULT | | 540 {implicit_cast<exception_behavior_t>(EXCEPTION_DEFAULT | |
541 MACH_EXCEPTION_CODES), | 541 MACH_EXCEPTION_CODES), |
542 "EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES", | 542 "EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES", |
543 "DEFAULT|MACH"}, | 543 "DEFAULT|MACH"}, |
544 {static_cast<exception_behavior_t>(EXCEPTION_STATE | | 544 {implicit_cast<exception_behavior_t>(EXCEPTION_STATE | |
545 MACH_EXCEPTION_CODES), | 545 MACH_EXCEPTION_CODES), |
546 "EXCEPTION_STATE|MACH_EXCEPTION_CODES", | 546 "EXCEPTION_STATE|MACH_EXCEPTION_CODES", |
547 "STATE|MACH"}, | 547 "STATE|MACH"}, |
548 {static_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | | 548 {implicit_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | |
549 MACH_EXCEPTION_CODES), | 549 MACH_EXCEPTION_CODES), |
550 "EXCEPTION_STATE_IDENTITY|MACH_EXCEPTION_CODES", | 550 "EXCEPTION_STATE_IDENTITY|MACH_EXCEPTION_CODES", |
551 "STATE_IDENTITY|MACH"}, | 551 "STATE_IDENTITY|MACH"}, |
552 }; | 552 }; |
553 | 553 |
554 struct ConvertExceptionBehaviorTraits { | 554 struct ConvertExceptionBehaviorTraits { |
555 using ValueType = exception_behavior_t; | 555 using ValueType = exception_behavior_t; |
556 static std::string SomethingToString( | 556 static std::string SomethingToString( |
557 ValueType value, | 557 ValueType value, |
558 SymbolicConstantToStringOptions options) { | 558 SymbolicConstantToStringOptions options) { |
559 return ExceptionBehaviorToString(value, options); | 559 return ExceptionBehaviorToString(value, options); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 } | 692 } |
693 } | 693 } |
694 | 694 |
695 const struct { | 695 const struct { |
696 const char* string; | 696 const char* string; |
697 StringToSymbolicConstantOptions options; | 697 StringToSymbolicConstantOptions options; |
698 exception_behavior_t behavior; | 698 exception_behavior_t behavior; |
699 } kNonCanonicalTestData[] = { | 699 } kNonCanonicalTestData[] = { |
700 {"MACH_EXCEPTION_CODES|EXCEPTION_STATE_IDENTITY", | 700 {"MACH_EXCEPTION_CODES|EXCEPTION_STATE_IDENTITY", |
701 kAllowFullName, | 701 kAllowFullName, |
702 static_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | | 702 implicit_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | |
703 MACH_EXCEPTION_CODES)}, | 703 MACH_EXCEPTION_CODES)}, |
704 {"MACH|STATE_IDENTITY", | 704 {"MACH|STATE_IDENTITY", |
705 kAllowShortName, | 705 kAllowShortName, |
706 static_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | | 706 implicit_cast<exception_behavior_t>(EXCEPTION_STATE_IDENTITY | |
707 MACH_EXCEPTION_CODES)}, | 707 MACH_EXCEPTION_CODES)}, |
708 {"MACH_EXCEPTION_CODES|STATE", | 708 {"MACH_EXCEPTION_CODES|STATE", |
709 kAllowFullName | kAllowShortName, | 709 kAllowFullName | kAllowShortName, |
710 static_cast<exception_behavior_t>(EXCEPTION_STATE | | 710 implicit_cast<exception_behavior_t>(EXCEPTION_STATE | |
711 MACH_EXCEPTION_CODES)}, | 711 MACH_EXCEPTION_CODES)}, |
712 {"MACH|EXCEPTION_STATE", | 712 {"MACH|EXCEPTION_STATE", |
713 kAllowFullName | kAllowShortName, | 713 kAllowFullName | kAllowShortName, |
714 static_cast<exception_behavior_t>(EXCEPTION_STATE | | 714 implicit_cast<exception_behavior_t>(EXCEPTION_STATE | |
715 MACH_EXCEPTION_CODES)}, | 715 MACH_EXCEPTION_CODES)}, |
716 {"3|MACH_EXCEPTION_CODES", | 716 {"3|MACH_EXCEPTION_CODES", |
717 kAllowFullName | kAllowNumber, | 717 kAllowFullName | kAllowNumber, |
718 static_cast<exception_behavior_t>(MACH_EXCEPTION_CODES | 3)}, | 718 implicit_cast<exception_behavior_t>(MACH_EXCEPTION_CODES | 3)}, |
719 {"MACH|0x2", | 719 {"MACH|0x2", |
720 kAllowShortName | kAllowNumber, | 720 kAllowShortName | kAllowNumber, |
721 static_cast<exception_behavior_t>(MACH_EXCEPTION_CODES | 0x2)}, | 721 implicit_cast<exception_behavior_t>(MACH_EXCEPTION_CODES | 0x2)}, |
722 }; | 722 }; |
723 | 723 |
724 for (size_t index = 0; index < arraysize(kNonCanonicalTestData); ++index) { | 724 for (size_t index = 0; index < arraysize(kNonCanonicalTestData); ++index) { |
725 SCOPED_TRACE(base::StringPrintf("index %zu", index)); | 725 SCOPED_TRACE(base::StringPrintf("index %zu", index)); |
726 TestStringToExceptionBehavior(kNonCanonicalTestData[index].string, | 726 TestStringToExceptionBehavior(kNonCanonicalTestData[index].string, |
727 kNonCanonicalTestData[index].options, | 727 kNonCanonicalTestData[index].options, |
728 true, | 728 true, |
729 kNonCanonicalTestData[index].behavior); | 729 kNonCanonicalTestData[index].behavior); |
730 } | 730 } |
731 | 731 |
(...skipping 325 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 |