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

Unified Diff: third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc
diff --git a/third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc b/third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc
index aff773f33506a4a4e7c079562916a99998ffc45d..f21d9a27e8782f6b5855185dd4bf21a7fdd84b96 100644
--- a/third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc
+++ b/third_party/crashpad/crashpad/snapshot/mac/system_snapshot_mac_test.cc
@@ -52,7 +52,7 @@ class SystemSnapshotMacTest : public testing::Test {
// testing::Test:
void SetUp() override {
ASSERT_TRUE(process_reader_.Initialize(mach_task_self()));
- ASSERT_EQ(0, gettimeofday(&snapshot_time_, nullptr))
+ ASSERT_EQ(gettimeofday(&snapshot_time_, nullptr), 0)
<< ErrnoMessage("gettimeofday");
system_snapshot_.Initialize(&process_reader_, &snapshot_time_);
}
@@ -69,9 +69,9 @@ TEST_F(SystemSnapshotMacTest, GetCPUArchitecture) {
CPUArchitecture cpu_architecture = system_snapshot().GetCPUArchitecture();
#if defined(ARCH_CPU_X86)
- EXPECT_EQ(kCPUArchitectureX86, cpu_architecture);
+ EXPECT_EQ(cpu_architecture, kCPUArchitectureX86);
#elif defined(ARCH_CPU_X86_64)
- EXPECT_EQ(kCPUArchitectureX86_64, cpu_architecture);
+ EXPECT_EQ(cpu_architecture, kCPUArchitectureX86_64);
#else
#error port to your architecture
#endif
@@ -105,8 +105,8 @@ TEST_F(SystemSnapshotMacTest, CPUX86SupportsDAZ) {
#endif
TEST_F(SystemSnapshotMacTest, GetOperatingSystem) {
- EXPECT_EQ(SystemSnapshot::kOperatingSystemMacOSX,
- system_snapshot().GetOperatingSystem());
+ EXPECT_EQ(system_snapshot().GetOperatingSystem(),
+ SystemSnapshot::kOperatingSystemMacOSX);
}
TEST_F(SystemSnapshotMacTest, OSVersion) {
@@ -116,8 +116,8 @@ TEST_F(SystemSnapshotMacTest, OSVersion) {
std::string build;
system_snapshot().OSVersion(&major, &minor, &bugfix, &build);
- EXPECT_EQ(10, major);
- EXPECT_EQ(MacOSXMinorVersion(), minor);
+ EXPECT_EQ(major, 10);
+ EXPECT_EQ(minor, MacOSXMinorVersion());
EXPECT_FALSE(build.empty());
}
@@ -138,15 +138,15 @@ class ScopedSetTZ {
old_tz_.assign(old_tz);
}
- EXPECT_EQ(0, setenv(kTZ, tz.c_str(), 1)) << ErrnoMessage("setenv");
+ EXPECT_EQ(setenv(kTZ, tz.c_str(), 1), 0) << ErrnoMessage("setenv");
tzset();
}
~ScopedSetTZ() {
if (old_tz_set_) {
- EXPECT_EQ(0, setenv(kTZ, old_tz_.c_str(), 1)) << ErrnoMessage("setenv");
+ EXPECT_EQ(setenv(kTZ, old_tz_.c_str(), 1), 0) << ErrnoMessage("setenv");
} else {
- EXPECT_EQ(0, unsetenv(kTZ)) << ErrnoMessage("unsetenv");
+ EXPECT_EQ(unsetenv(kTZ), 0) << ErrnoMessage("unsetenv");
}
tzset();
}
@@ -177,20 +177,20 @@ TEST_F(SystemSnapshotMacTest, TimeZone) {
// |standard_offset_seconds| gives seconds east of UTC, and |timezone| gives
// seconds west of UTC.
- EXPECT_EQ(-timezone, standard_offset_seconds);
+ EXPECT_EQ(standard_offset_seconds, -timezone);
// In contemporary usage, most time zones have an integer hour offset from
// UTC, although several are at a half-hour offset, and two are at 15-minute
// offsets. Throughout history, other variations existed. See
// http://www.timeanddate.com/time/time-zones-interesting.html.
- EXPECT_EQ(0, standard_offset_seconds % (15 * 60))
+ EXPECT_EQ(standard_offset_seconds % (15 * 60), 0)
<< "standard_offset_seconds " << standard_offset_seconds;
if (dst_status == SystemSnapshot::kDoesNotObserveDaylightSavingTime) {
- EXPECT_EQ(standard_offset_seconds, daylight_offset_seconds);
- EXPECT_EQ(standard_name, daylight_name);
+ EXPECT_EQ(daylight_offset_seconds, standard_offset_seconds);
+ EXPECT_EQ(daylight_name, standard_name);
} else {
- EXPECT_EQ(0, daylight_offset_seconds % (15 * 60))
+ EXPECT_EQ(daylight_offset_seconds % (15 * 60), 0)
<< "daylight_offset_seconds " << daylight_offset_seconds;
// In contemporary usage, dst_delta_seconds will almost always be one hour,
@@ -207,6 +207,9 @@ TEST_F(SystemSnapshotMacTest, TimeZone) {
// Test a variety of time zones. Some of these observe daylight saving time,
// some don’t. Some used to but no longer do. Some have uncommon UTC offsets.
+ // standard_name and daylight_name can be nullptr where no name exists to
+ // verify, as may happen when some versions of the timezone database carry
+ // invented names and others do not.
const struct {
const char* tz;
bool observes_dst;
@@ -229,8 +232,8 @@ TEST_F(SystemSnapshotMacTest, TimeZone) {
{"Australia/Adelaide", true, 9.5, 10.5, "ACST", "ACDT"},
{"Australia/Brisbane", false, 10, 10, "AEST", "AEST"},
{"Australia/Darwin", false, 9.5, 9.5, "ACST", "ACST"},
- {"Australia/Eucla", false, 8.75, 8.75, "ACWST", "ACWST"},
- {"Australia/Lord_Howe", true, 10.5, 11, "LHST", "LHDT"},
+ {"Australia/Eucla", false, 8.75, 8.75, nullptr, nullptr},
+ {"Australia/Lord_Howe", true, 10.5, 11, nullptr, nullptr},
{"Australia/Perth", false, 8, 8, "AWST", "AWST"},
{"Australia/Sydney", true, 10, 11, "AEST", "AEDT"},
{"Europe/Bucharest", true, 2, 3, "EET", "EEST"},
@@ -257,14 +260,18 @@ TEST_F(SystemSnapshotMacTest, TimeZone) {
&daylight_name);
}
- EXPECT_EQ(test_time_zone.observes_dst,
- dst_status != SystemSnapshot::kDoesNotObserveDaylightSavingTime);
- EXPECT_EQ(test_time_zone.standard_offset_hours * 60 * 60,
- standard_offset_seconds);
- EXPECT_EQ(test_time_zone.daylight_offset_hours * 60 * 60,
- daylight_offset_seconds);
- EXPECT_EQ(test_time_zone.standard_name, standard_name);
- EXPECT_EQ(test_time_zone.daylight_name, daylight_name);
+ EXPECT_EQ(dst_status != SystemSnapshot::kDoesNotObserveDaylightSavingTime,
+ test_time_zone.observes_dst);
+ EXPECT_EQ(standard_offset_seconds,
+ test_time_zone.standard_offset_hours * 60 * 60);
+ EXPECT_EQ(daylight_offset_seconds,
+ test_time_zone.daylight_offset_hours * 60 * 60);
+ if (test_time_zone.standard_name) {
+ EXPECT_EQ(standard_name, test_time_zone.standard_name);
+ }
+ if (test_time_zone.daylight_name) {
+ EXPECT_EQ(daylight_name, test_time_zone.daylight_name);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698