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

Side by Side Diff: minidump/minidump_system_info_writer_test.cc

Issue 454073002: Add MinidumpMiscInfoWriter and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Drop unnecessary “using namespace testing” Created 6 years, 4 months 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
« no previous file with comments | « minidump/minidump_string_writer_test.cc ('k') | minidump/minidump_writable_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 minidump_file_writer.AddStream(&system_info_writer); 86 minidump_file_writer.AddStream(&system_info_writer);
87 87
88 StringFileWriter file_writer; 88 StringFileWriter file_writer;
89 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 89 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
90 90
91 const MINIDUMP_SYSTEM_INFO* system_info; 91 const MINIDUMP_SYSTEM_INFO* system_info;
92 const MINIDUMP_STRING* csd_version; 92 const MINIDUMP_STRING* csd_version;
93 93
94 GetSystemInfoStream(file_writer.string(), 0, &system_info, &csd_version); 94 GetSystemInfoStream(file_writer.string(), 0, &system_info, &csd_version);
95 if (Test::HasFatalFailure()) {
96 return;
97 }
95 98
96 EXPECT_EQ(kMinidumpCPUArchitectureUnknown, 99 EXPECT_EQ(kMinidumpCPUArchitectureUnknown,
97 system_info->ProcessorArchitecture); 100 system_info->ProcessorArchitecture);
98 EXPECT_EQ(0u, system_info->ProcessorLevel); 101 EXPECT_EQ(0u, system_info->ProcessorLevel);
99 EXPECT_EQ(0u, system_info->ProcessorRevision); 102 EXPECT_EQ(0u, system_info->ProcessorRevision);
100 EXPECT_EQ(0u, system_info->NumberOfProcessors); 103 EXPECT_EQ(0u, system_info->NumberOfProcessors);
101 EXPECT_EQ(0u, system_info->ProductType); 104 EXPECT_EQ(0u, system_info->ProductType);
102 EXPECT_EQ(0u, system_info->MajorVersion); 105 EXPECT_EQ(0u, system_info->MajorVersion);
103 EXPECT_EQ(0u, system_info->MinorVersion); 106 EXPECT_EQ(0u, system_info->MinorVersion);
104 EXPECT_EQ(0u, system_info->BuildNumber); 107 EXPECT_EQ(0u, system_info->BuildNumber);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 minidump_file_writer.AddStream(&system_info_writer); 159 minidump_file_writer.AddStream(&system_info_writer);
157 160
158 StringFileWriter file_writer; 161 StringFileWriter file_writer;
159 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 162 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
160 163
161 const MINIDUMP_SYSTEM_INFO* system_info; 164 const MINIDUMP_SYSTEM_INFO* system_info;
162 const MINIDUMP_STRING* csd_version; 165 const MINIDUMP_STRING* csd_version;
163 166
164 GetSystemInfoStream( 167 GetSystemInfoStream(
165 file_writer.string(), strlen(kCSDVersion), &system_info, &csd_version); 168 file_writer.string(), strlen(kCSDVersion), &system_info, &csd_version);
169 if (Test::HasFatalFailure()) {
170 return;
171 }
166 172
167 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture); 173 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture);
168 EXPECT_EQ(kCPULevel, system_info->ProcessorLevel); 174 EXPECT_EQ(kCPULevel, system_info->ProcessorLevel);
169 EXPECT_EQ(kCPURevision, system_info->ProcessorRevision); 175 EXPECT_EQ(kCPURevision, system_info->ProcessorRevision);
170 EXPECT_EQ(kCPUCount, system_info->NumberOfProcessors); 176 EXPECT_EQ(kCPUCount, system_info->NumberOfProcessors);
171 EXPECT_EQ(kOSType, system_info->ProductType); 177 EXPECT_EQ(kOSType, system_info->ProductType);
172 EXPECT_EQ(kOSVersionMajor, system_info->MajorVersion); 178 EXPECT_EQ(kOSVersionMajor, system_info->MajorVersion);
173 EXPECT_EQ(kOSVersionMinor, system_info->MinorVersion); 179 EXPECT_EQ(kOSVersionMinor, system_info->MinorVersion);
174 EXPECT_EQ(kOSVersionBuild, system_info->BuildNumber); 180 EXPECT_EQ(kOSVersionBuild, system_info->BuildNumber);
175 EXPECT_EQ(kOS, system_info->PlatformId); 181 EXPECT_EQ(kOS, system_info->PlatformId);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 minidump_file_writer.AddStream(&system_info_writer); 222 minidump_file_writer.AddStream(&system_info_writer);
217 223
218 StringFileWriter file_writer; 224 StringFileWriter file_writer;
219 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 225 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
220 226
221 const MINIDUMP_SYSTEM_INFO* system_info; 227 const MINIDUMP_SYSTEM_INFO* system_info;
222 const MINIDUMP_STRING* csd_version; 228 const MINIDUMP_STRING* csd_version;
223 229
224 GetSystemInfoStream( 230 GetSystemInfoStream(
225 file_writer.string(), strlen(kCSDVersion), &system_info, &csd_version); 231 file_writer.string(), strlen(kCSDVersion), &system_info, &csd_version);
232 if (Test::HasFatalFailure()) {
233 return;
234 }
226 235
227 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture); 236 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture);
228 EXPECT_EQ(kCPULevel, system_info->ProcessorLevel); 237 EXPECT_EQ(kCPULevel, system_info->ProcessorLevel);
229 EXPECT_EQ(kCPURevision, system_info->ProcessorRevision); 238 EXPECT_EQ(kCPURevision, system_info->ProcessorRevision);
230 EXPECT_EQ(kCPUCount, system_info->NumberOfProcessors); 239 EXPECT_EQ(kCPUCount, system_info->NumberOfProcessors);
231 EXPECT_EQ(kOSType, system_info->ProductType); 240 EXPECT_EQ(kOSType, system_info->ProductType);
232 EXPECT_EQ(kOSVersionMajor, system_info->MajorVersion); 241 EXPECT_EQ(kOSVersionMajor, system_info->MajorVersion);
233 EXPECT_EQ(kOSVersionMinor, system_info->MinorVersion); 242 EXPECT_EQ(kOSVersionMinor, system_info->MinorVersion);
234 EXPECT_EQ(kOSVersionBuild, system_info->BuildNumber); 243 EXPECT_EQ(kOSVersionBuild, system_info->BuildNumber);
235 EXPECT_EQ(kOS, system_info->PlatformId); 244 EXPECT_EQ(kOS, system_info->PlatformId);
(...skipping 21 matching lines...) Expand all
257 266
258 minidump_file_writer.AddStream(&system_info_writer); 267 minidump_file_writer.AddStream(&system_info_writer);
259 268
260 StringFileWriter file_writer; 269 StringFileWriter file_writer;
261 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 270 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
262 271
263 const MINIDUMP_SYSTEM_INFO* system_info; 272 const MINIDUMP_SYSTEM_INFO* system_info;
264 const MINIDUMP_STRING* csd_version; 273 const MINIDUMP_STRING* csd_version;
265 274
266 GetSystemInfoStream(file_writer.string(), 0, &system_info, &csd_version); 275 GetSystemInfoStream(file_writer.string(), 0, &system_info, &csd_version);
276 if (Test::HasFatalFailure()) {
277 return;
278 }
267 279
268 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture); 280 EXPECT_EQ(kCPUArchitecture, system_info->ProcessorArchitecture);
269 EXPECT_EQ(0u, system_info->ProcessorLevel); 281 EXPECT_EQ(0u, system_info->ProcessorLevel);
270 EXPECT_EQ(kCPUVendor[0], system_info->Cpu.X86CpuInfo.VendorId[0]); 282 EXPECT_EQ(kCPUVendor[0], system_info->Cpu.X86CpuInfo.VendorId[0]);
271 EXPECT_EQ(kCPUVendor[1], system_info->Cpu.X86CpuInfo.VendorId[1]); 283 EXPECT_EQ(kCPUVendor[1], system_info->Cpu.X86CpuInfo.VendorId[1]);
272 EXPECT_EQ(kCPUVendor[2], system_info->Cpu.X86CpuInfo.VendorId[2]); 284 EXPECT_EQ(kCPUVendor[2], system_info->Cpu.X86CpuInfo.VendorId[2]);
273 EXPECT_EQ(0u, system_info->Cpu.X86CpuInfo.VersionInformation); 285 EXPECT_EQ(0u, system_info->Cpu.X86CpuInfo.VersionInformation);
274 } 286 }
275 287
276 TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) { 288 TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) {
277 MinidumpFileWriter minidump_file_writer; 289 MinidumpFileWriter minidump_file_writer;
278 MinidumpSystemInfoWriter system_info_writer; 290 MinidumpSystemInfoWriter system_info_writer;
279 minidump_file_writer.AddStream(&system_info_writer); 291 minidump_file_writer.AddStream(&system_info_writer);
280 292
281 StringFileWriter file_writer; 293 StringFileWriter file_writer;
282 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), 294 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer),
283 "csd_version_"); 295 "csd_version_");
284 } 296 }
285 297
286 } // namespace 298 } // namespace
OLDNEW
« no previous file with comments | « minidump/minidump_string_writer_test.cc ('k') | minidump/minidump_writable_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698