Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: third_party/crashpad/crashpad/util/posix/symbolic_constants_posix_test.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/posix/symbolic_constants_posix.h" 15 #include "util/posix/symbolic_constants_posix.h"
16 16
17 #include <sys/signal.h> 17 #include <signal.h>
18 #include <sys/types.h> 18 #include <sys/types.h>
19 19
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/strings/string_piece.h" 21 #include "base/strings/string_piece.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "gtest/gtest.h" 24 #include "gtest/gtest.h"
25 25
26 #define NUL_TEST_DATA(string) { string, arraysize(string) - 1 } 26 #define NUL_TEST_DATA(string) { string, arraysize(string) - 1 }
27 27
(...skipping 30 matching lines...) Expand all
58 {SIGTTOU, "SIGTTOU", "TTOU"}, 58 {SIGTTOU, "SIGTTOU", "TTOU"},
59 {SIGURG, "SIGURG", "URG"}, 59 {SIGURG, "SIGURG", "URG"},
60 {SIGUSR1, "SIGUSR1", "USR1"}, 60 {SIGUSR1, "SIGUSR1", "USR1"},
61 {SIGUSR2, "SIGUSR2", "USR2"}, 61 {SIGUSR2, "SIGUSR2", "USR2"},
62 {SIGVTALRM, "SIGVTALRM", "VTALRM"}, 62 {SIGVTALRM, "SIGVTALRM", "VTALRM"},
63 {SIGWINCH, "SIGWINCH", "WINCH"}, 63 {SIGWINCH, "SIGWINCH", "WINCH"},
64 {SIGXCPU, "SIGXCPU", "XCPU"}, 64 {SIGXCPU, "SIGXCPU", "XCPU"},
65 #if defined(OS_MACOSX) 65 #if defined(OS_MACOSX)
66 {SIGEMT, "SIGEMT", "EMT"}, 66 {SIGEMT, "SIGEMT", "EMT"},
67 {SIGINFO, "SIGINFO", "INFO"}, 67 {SIGINFO, "SIGINFO", "INFO"},
68 #elif defined(OS_LINUX) 68 #elif defined(OS_LINUX) || defined(OS_ANDROID)
69 {SIGPWR, "SIGPWR", "PWR"}, 69 {SIGPWR, "SIGPWR", "PWR"},
70 {SIGSTKFLT, "SIGSTKFLT", "STKFLT"}, 70 {SIGSTKFLT, "SIGSTKFLT", "STKFLT"},
71 #endif 71 #endif
72 }; 72 };
73 73
74 // If |expect| is nullptr, the conversion is expected to fail. If |expect| is 74 // If |expect| is nullptr, the conversion is expected to fail. If |expect| is
75 // empty, the conversion is expected to succeed, but the precise returned string 75 // empty, the conversion is expected to succeed, but the precise returned string
76 // value is unknown. Otherwise, the conversion is expected to succeed, and 76 // value is unknown. Otherwise, the conversion is expected to succeed, and
77 // |expect| contains the precise expected string value to be returned. 77 // |expect| contains the precise expected string value to be returned.
78 // 78 //
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 TEST(SymbolicConstantsPOSIX, SignalToString) { 115 TEST(SymbolicConstantsPOSIX, SignalToString) {
116 for (size_t index = 0; index < arraysize(kSignalTestData); ++index) { 116 for (size_t index = 0; index < arraysize(kSignalTestData); ++index) {
117 SCOPED_TRACE(base::StringPrintf("index %zu", index)); 117 SCOPED_TRACE(base::StringPrintf("index %zu", index));
118 TestSignalToString(kSignalTestData[index].signal, 118 TestSignalToString(kSignalTestData[index].signal,
119 kSignalTestData[index].full_name, 119 kSignalTestData[index].full_name,
120 kSignalTestData[index].short_name); 120 kSignalTestData[index].short_name);
121 } 121 }
122 122
123 #if defined(OS_LINUX) 123 #if defined(OS_LINUX) || defined(OS_ANDROID)
124 // NSIG is 64 to account for real-time signals. 124 // NSIG is 64 to account for real-time signals.
125 const int kSignalCount = 32; 125 const int kSignalCount = 32;
126 #else 126 #else
127 const int kSignalCount = NSIG; 127 const int kSignalCount = NSIG;
128 #endif 128 #endif
129 129
130 for (int signal = 0; signal < kSignalCount + 8; ++signal) { 130 for (int signal = 0; signal < kSignalCount + 8; ++signal) {
131 SCOPED_TRACE(base::StringPrintf("signal %d", signal)); 131 SCOPED_TRACE(base::StringPrintf("signal %d", signal));
132 if (signal > 0 && signal < kSignalCount) { 132 if (signal > 0 && signal < kSignalCount) {
133 TestSignalToString(signal, "", ""); 133 TestSignalToString(signal, "", "");
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 249 {
250 SCOPED_TRACE("trailing_NUL_short"); 250 SCOPED_TRACE("trailing_NUL_short");
251 TestStringToSignal( 251 TestStringToSignal(
252 base::StringPiece("BUST", 3), kAllowShortName, true, SIGBUS); 252 base::StringPiece("BUST", 3), kAllowShortName, true, SIGBUS);
253 } 253 }
254 } 254 }
255 255
256 } // namespace 256 } // namespace
257 } // namespace test 257 } // namespace test
258 } // namespace crashpad 258 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698