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

Side by Side Diff: minidump/minidump_system_info_writer_test.cc

Issue 700383007: Use implicit_cast<> instead of static_cast<> whenever possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 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,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 273
274 TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) { 274 TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) {
275 MINIDUMP_SYSTEM_INFO expect_system_info = {}; 275 MINIDUMP_SYSTEM_INFO expect_system_info = {};
276 276
277 const uint16_t kCPUFamily = 6; 277 const uint16_t kCPUFamily = 6;
278 const uint8_t kCPUModel = 70; 278 const uint8_t kCPUModel = 70;
279 const uint8_t kCPUStepping = 1; 279 const uint8_t kCPUStepping = 1;
280 280
281 const uint8_t kCPUBasicFamily = 281 const uint8_t kCPUBasicFamily =
282 std::min(kCPUFamily, static_cast<uint16_t>(15)); 282 std::min(kCPUFamily, implicit_cast<uint16_t>(15));
283 const uint8_t kCPUExtendedFamily = kCPUFamily - kCPUBasicFamily; 283 const uint8_t kCPUExtendedFamily = kCPUFamily - kCPUBasicFamily;
284 284
285 // These checks ensure that even if the constants above change, they represent 285 // These checks ensure that even if the constants above change, they represent
286 // something that can legitimately be encoded in the form used by cpuid 1 eax. 286 // something that can legitimately be encoded in the form used by cpuid 1 eax.
287 EXPECT_LE(kCPUFamily, 270); 287 EXPECT_LE(kCPUFamily, 270);
288 EXPECT_LE(kCPUStepping, 15); 288 EXPECT_LE(kCPUStepping, 15);
289 EXPECT_TRUE(kCPUBasicFamily == 6 || kCPUBasicFamily == 15 || kCPUModel <= 15); 289 EXPECT_TRUE(kCPUBasicFamily == 6 || kCPUBasicFamily == 15 || kCPUModel <= 15);
290 290
291 const uint8_t kCPUBasicModel = kCPUModel & 0xf; 291 const uint8_t kCPUBasicModel = kCPUModel & 0xf;
292 const uint8_t kCPUExtendedModel = kCPUModel >> 4; 292 const uint8_t kCPUExtendedModel = kCPUModel >> 4;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 minidump_file_writer.AddStream(system_info_writer.Pass()); 468 minidump_file_writer.AddStream(system_info_writer.Pass());
469 469
470 StringFileWriter file_writer; 470 StringFileWriter file_writer;
471 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), 471 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer),
472 "csd_version_"); 472 "csd_version_");
473 } 473 }
474 474
475 } // namespace 475 } // namespace
476 } // namespace test 476 } // namespace test
477 } // namespace crashpad 477 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698