mirror of
https://github.com/encounter/crashpad.git
synced 2026-03-30 11:04:28 -07:00
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify each side as “expected” or “actual.” Tests in Crashpad adhered to this traditional ordering. After a gtest change in February 2016, it is now agnostic with respect to the order of these arguments. This change mechanically updates all uses of these macros to (actual, expected) by reversing them. This provides consistency with our use of the logging CHECK_EQ and DCHECK_EQ macros, and makes for better readability by ordinary native speakers. The rough (but working!) conversion tool is https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py, and “git cl format” cleaned up its output. EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made a judgment that one side or the other needed to provide an “unexpected” value. Consequently, some code used (unexpected, actual) while other code used (actual, unexpected). For consistency with the new EXPECT_EQ and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE, this change also updates these use sites to (actual, unexpected) where one side can be called “unexpected” as, for example, std::string::npos can be. Unfortunately, this portion was a manual conversion. References: https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65 https://github.com/google/googletest/pull/713 Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3 Reviewed-on: https://chromium-review.googlesource.com/466727 Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
@@ -35,11 +35,11 @@ namespace {
|
||||
// gtest assertions.
|
||||
void SanityCheckContext(const NativeCPUContext& context) {
|
||||
#if defined(ARCH_CPU_X86)
|
||||
ASSERT_EQ(x86_THREAD_STATE32, context.tsh.flavor);
|
||||
ASSERT_EQ(implicit_cast<int>(x86_THREAD_STATE32_COUNT), context.tsh.count);
|
||||
ASSERT_EQ(context.tsh.flavor, x86_THREAD_STATE32);
|
||||
ASSERT_EQ(context.tsh.count, implicit_cast<int>(x86_THREAD_STATE32_COUNT));
|
||||
#elif defined(ARCH_CPU_X86_64)
|
||||
ASSERT_EQ(x86_THREAD_STATE64, context.tsh.flavor);
|
||||
ASSERT_EQ(implicit_cast<int>(x86_THREAD_STATE64_COUNT), context.tsh.count);
|
||||
ASSERT_EQ(context.tsh.flavor, x86_THREAD_STATE64);
|
||||
ASSERT_EQ(context.tsh.count, implicit_cast<int>(x86_THREAD_STATE64_COUNT));
|
||||
#endif
|
||||
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
@@ -57,18 +57,18 @@ void SanityCheckContext(const NativeCPUContext& context) {
|
||||
// 3.4.3 “EFLAGS Register”, and AMD Architecture Programmer’s Manual, Volume
|
||||
// 2: System Programming (24593-3.24), 3.1.6 “RFLAGS Register”.
|
||||
#if defined(ARCH_CPU_X86)
|
||||
EXPECT_EQ(0u, context.uts.ts32.__cs & ~0xffff);
|
||||
EXPECT_EQ(0u, context.uts.ts32.__ds & ~0xffff);
|
||||
EXPECT_EQ(0u, context.uts.ts32.__es & ~0xffff);
|
||||
EXPECT_EQ(0u, context.uts.ts32.__fs & ~0xffff);
|
||||
EXPECT_EQ(0u, context.uts.ts32.__gs & ~0xffff);
|
||||
EXPECT_EQ(0u, context.uts.ts32.__ss & ~0xffff);
|
||||
EXPECT_EQ(2u, context.uts.ts32.__eflags & 0xffc0802a);
|
||||
EXPECT_EQ(context.uts.ts32.__cs & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__ds & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__es & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__fs & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__gs & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__ss & ~0xffff, 0u);
|
||||
EXPECT_EQ(context.uts.ts32.__eflags & 0xffc0802a, 2u);
|
||||
#elif defined(ARCH_CPU_X86_64)
|
||||
EXPECT_EQ(0u, context.uts.ts64.__cs & ~UINT64_C(0xffff));
|
||||
EXPECT_EQ(0u, context.uts.ts64.__fs & ~UINT64_C(0xffff));
|
||||
EXPECT_EQ(0u, context.uts.ts64.__gs & ~UINT64_C(0xffff));
|
||||
EXPECT_EQ(2u, context.uts.ts64.__rflags & UINT64_C(0xffffffffffc0802a));
|
||||
EXPECT_EQ(context.uts.ts64.__cs & ~UINT64_C(0xffff), 0u);
|
||||
EXPECT_EQ(context.uts.ts64.__fs & ~UINT64_C(0xffff), 0u);
|
||||
EXPECT_EQ(context.uts.ts64.__gs & ~UINT64_C(0xffff), 0u);
|
||||
EXPECT_EQ(context.uts.ts64.__rflags & UINT64_C(0xffffffffffc0802a), 2u);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void TestCaptureContext() {
|
||||
ASSERT_NO_FATAL_FAILURE(SanityCheckContext(context_2));
|
||||
}
|
||||
|
||||
EXPECT_EQ(sp, StackPointerFromContext(context_2));
|
||||
EXPECT_EQ(StackPointerFromContext(context_2), sp);
|
||||
EXPECT_GT(ProgramCounterFromContext(context_2), pc);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -185,9 +185,9 @@ TEST(PruneCrashReports, BinaryCondition) {
|
||||
auto rhs = new StaticCondition(test.rhs_value);
|
||||
BinaryPruneCondition condition(test.op, lhs, rhs);
|
||||
CrashReportDatabase::Report report;
|
||||
EXPECT_EQ(test.cond_result, condition.ShouldPruneReport(report));
|
||||
EXPECT_EQ(test.lhs_executed, lhs->did_execute());
|
||||
EXPECT_EQ(test.rhs_executed, rhs->did_execute());
|
||||
EXPECT_EQ(condition.ShouldPruneReport(report), test.cond_result);
|
||||
EXPECT_EQ(lhs->did_execute(), test.lhs_executed);
|
||||
EXPECT_EQ(rhs->did_execute(), test.rhs_executed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -62,13 +62,13 @@ class SettingsTest : public testing::Test {
|
||||
TEST_F(SettingsTest, ClientID) {
|
||||
UUID client_id;
|
||||
EXPECT_TRUE(settings()->GetClientID(&client_id));
|
||||
EXPECT_NE(UUID(), client_id);
|
||||
EXPECT_NE(client_id, UUID());
|
||||
|
||||
Settings local_settings(settings_path());
|
||||
EXPECT_TRUE(local_settings.Initialize());
|
||||
UUID actual;
|
||||
EXPECT_TRUE(local_settings.GetClientID(&actual));
|
||||
EXPECT_EQ(client_id, actual);
|
||||
EXPECT_EQ(actual, client_id);
|
||||
}
|
||||
|
||||
TEST_F(SettingsTest, UploadsEnabled) {
|
||||
@@ -100,18 +100,18 @@ TEST_F(SettingsTest, LastUploadAttemptTime) {
|
||||
time_t actual = -1;
|
||||
EXPECT_TRUE(settings()->GetLastUploadAttemptTime(&actual));
|
||||
// Default value is 0.
|
||||
EXPECT_EQ(0, actual);
|
||||
EXPECT_EQ(actual, 0);
|
||||
|
||||
const time_t expected = time(nullptr);
|
||||
EXPECT_TRUE(settings()->SetLastUploadAttemptTime(expected));
|
||||
EXPECT_TRUE(settings()->GetLastUploadAttemptTime(&actual));
|
||||
EXPECT_EQ(expected, actual);
|
||||
EXPECT_EQ(actual, expected);
|
||||
|
||||
Settings local_settings(settings_path());
|
||||
EXPECT_TRUE(local_settings.Initialize());
|
||||
actual = -1;
|
||||
EXPECT_TRUE(local_settings.GetLastUploadAttemptTime(&actual));
|
||||
EXPECT_EQ(expected, actual);
|
||||
EXPECT_EQ(actual, expected);
|
||||
}
|
||||
|
||||
// The following tests write a corrupt settings file and test the recovery
|
||||
@@ -129,13 +129,13 @@ TEST_F(SettingsTest, BadFileOnGet) {
|
||||
|
||||
UUID client_id;
|
||||
EXPECT_TRUE(settings()->GetClientID(&client_id));
|
||||
EXPECT_NE(UUID(), client_id);
|
||||
EXPECT_NE(client_id, UUID());
|
||||
|
||||
Settings local_settings(settings_path());
|
||||
EXPECT_TRUE(local_settings.Initialize());
|
||||
UUID actual;
|
||||
EXPECT_TRUE(local_settings.GetClientID(&actual));
|
||||
EXPECT_EQ(client_id, actual);
|
||||
EXPECT_EQ(actual, client_id);
|
||||
}
|
||||
|
||||
TEST_F(SettingsTest, BadFileOnSet) {
|
||||
@@ -154,10 +154,10 @@ TEST_F(SettingsTest, UnlinkFile) {
|
||||
EXPECT_TRUE(settings()->SetLastUploadAttemptTime(time(nullptr)));
|
||||
|
||||
#if defined(OS_WIN)
|
||||
EXPECT_EQ(0, _wunlink(settings_path().value().c_str()))
|
||||
EXPECT_EQ(_wunlink(settings_path().value().c_str()), 0)
|
||||
<< ErrnoMessage("_wunlink");
|
||||
#else
|
||||
EXPECT_EQ(0, unlink(settings_path().value().c_str()))
|
||||
EXPECT_EQ(unlink(settings_path().value().c_str()), 0)
|
||||
<< ErrnoMessage("unlink");
|
||||
#endif
|
||||
|
||||
@@ -165,7 +165,7 @@ TEST_F(SettingsTest, UnlinkFile) {
|
||||
EXPECT_TRUE(local_settings.Initialize());
|
||||
UUID new_client_id;
|
||||
EXPECT_TRUE(local_settings.GetClientID(&new_client_id));
|
||||
EXPECT_NE(client_id, new_client_id);
|
||||
EXPECT_NE(new_client_id, client_id);
|
||||
|
||||
// Check that all values are reset.
|
||||
bool enabled = true;
|
||||
@@ -174,7 +174,7 @@ TEST_F(SettingsTest, UnlinkFile) {
|
||||
|
||||
time_t time = -1;
|
||||
EXPECT_TRUE(local_settings.GetLastUploadAttemptTime(&time));
|
||||
EXPECT_EQ(0, time);
|
||||
EXPECT_EQ(time, 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -32,13 +32,13 @@ TEST(SimpleAddressRangeBag, Entry) {
|
||||
bag.Insert(reinterpret_cast<void*>(0x1000), 200);
|
||||
entry = TestBag::Iterator(bag).Next();
|
||||
ASSERT_TRUE(entry);
|
||||
EXPECT_EQ(entry->base, 0x1000u);
|
||||
EXPECT_EQ(entry->size, 200u);
|
||||
EXPECT_EQ(0x1000u, entry->base);
|
||||
EXPECT_EQ(200u, entry->size);
|
||||
|
||||
bag.Remove(reinterpret_cast<void*>(0x1000), 200);
|
||||
EXPECT_FALSE(entry->is_active());
|
||||
EXPECT_EQ(entry->base, 0u);
|
||||
EXPECT_EQ(entry->size, 0u);
|
||||
EXPECT_EQ(0u, entry->base);
|
||||
EXPECT_EQ(0u, entry->size);
|
||||
}
|
||||
|
||||
TEST(SimpleAddressRangeBag, SimpleAddressRangeBag) {
|
||||
@@ -48,24 +48,24 @@ TEST(SimpleAddressRangeBag, SimpleAddressRangeBag) {
|
||||
EXPECT_TRUE(bag.Insert(reinterpret_cast<void*>(0x2000), 20));
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
|
||||
EXPECT_EQ(bag.GetCount(), 3u);
|
||||
EXPECT_EQ(3u, bag.GetCount());
|
||||
|
||||
// Duplicates added too.
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_EQ(bag.GetCount(), 5u);
|
||||
EXPECT_EQ(5u, bag.GetCount());
|
||||
|
||||
// Can be removed 3 times, but not the 4th time.
|
||||
EXPECT_TRUE(bag.Remove(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_TRUE(bag.Remove(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_TRUE(bag.Remove(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
EXPECT_FALSE(bag.Remove(CheckedRange<uint64_t>(0x3000, 30)));
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
|
||||
EXPECT_TRUE(bag.Remove(reinterpret_cast<void*>(0x1000), 10));
|
||||
EXPECT_TRUE(bag.Remove(reinterpret_cast<void*>(0x2000), 20));
|
||||
EXPECT_EQ(bag.GetCount(), 0u);
|
||||
EXPECT_EQ(0u, bag.GetCount());
|
||||
}
|
||||
|
||||
TEST(SimpleAddressRangeBag, CopyAndAssign) {
|
||||
@@ -74,24 +74,24 @@ TEST(SimpleAddressRangeBag, CopyAndAssign) {
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(3, 4)));
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(5, 6)));
|
||||
EXPECT_TRUE(bag.Remove(CheckedRange<uint64_t>(3, 4)));
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
|
||||
// Test copy.
|
||||
TSimpleAddressRangeBag<10> bag_copy(bag);
|
||||
EXPECT_EQ(2u, bag_copy.GetCount());
|
||||
EXPECT_EQ(bag_copy.GetCount(), 2u);
|
||||
EXPECT_TRUE(bag_copy.Remove(CheckedRange<uint64_t>(1, 2)));
|
||||
EXPECT_TRUE(bag_copy.Remove(CheckedRange<uint64_t>(5, 6)));
|
||||
EXPECT_EQ(0u, bag_copy.GetCount());
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
EXPECT_EQ(bag_copy.GetCount(), 0u);
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
|
||||
// Test assign.
|
||||
TSimpleAddressRangeBag<10> bag_assign;
|
||||
bag_assign = bag;
|
||||
EXPECT_EQ(2u, bag_assign.GetCount());
|
||||
EXPECT_EQ(bag_assign.GetCount(), 2u);
|
||||
EXPECT_TRUE(bag_assign.Remove(CheckedRange<uint64_t>(1, 2)));
|
||||
EXPECT_TRUE(bag_assign.Remove(CheckedRange<uint64_t>(5, 6)));
|
||||
EXPECT_EQ(0u, bag_assign.GetCount());
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
EXPECT_EQ(bag_assign.GetCount(), 0u);
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
}
|
||||
|
||||
// Running out of space shouldn't crash.
|
||||
@@ -100,7 +100,7 @@ TEST(SimpleAddressRangeBag, OutOfSpace) {
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(1, 2)));
|
||||
EXPECT_TRUE(bag.Insert(CheckedRange<uint64_t>(3, 4)));
|
||||
EXPECT_FALSE(bag.Insert(CheckedRange<uint64_t>(5, 6)));
|
||||
EXPECT_EQ(2u, bag.GetCount());
|
||||
EXPECT_EQ(bag.GetCount(), 2u);
|
||||
EXPECT_FALSE(bag.Remove(CheckedRange<uint64_t>(5, 6)));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ TEST(SimpleStringDictionary, Entry) {
|
||||
// Clear the entry and verify the key and value are empty strings.
|
||||
map.RemoveKey("key1");
|
||||
EXPECT_FALSE(entry->is_active());
|
||||
EXPECT_EQ(strlen(entry->key), 0u);
|
||||
EXPECT_EQ(strlen(entry->value), 0u);
|
||||
EXPECT_EQ(0u, strlen(entry->key));
|
||||
EXPECT_EQ(0u, strlen(entry->value));
|
||||
}
|
||||
|
||||
TEST(SimpleStringDictionary, SimpleStringDictionary) {
|
||||
@@ -62,7 +62,7 @@ TEST(SimpleStringDictionary, SimpleStringDictionary) {
|
||||
EXPECT_NE(dict.GetValueForKey("key1"), "value1");
|
||||
EXPECT_NE(dict.GetValueForKey("key2"), "value2");
|
||||
EXPECT_NE(dict.GetValueForKey("key3"), "value3");
|
||||
EXPECT_EQ(dict.GetCount(), 3u);
|
||||
EXPECT_EQ(3u, dict.GetCount());
|
||||
// try an unknown key
|
||||
EXPECT_FALSE(dict.GetValueForKey("key4"));
|
||||
|
||||
@@ -85,11 +85,11 @@ TEST(SimpleStringDictionary, CopyAndAssign) {
|
||||
map.SetKeyValue("two", "b");
|
||||
map.SetKeyValue("three", "c");
|
||||
map.RemoveKey("two");
|
||||
EXPECT_EQ(2u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 2u);
|
||||
|
||||
// Test copy.
|
||||
TSimpleStringDictionary<10, 10, 10> map_copy(map);
|
||||
EXPECT_EQ(2u, map_copy.GetCount());
|
||||
EXPECT_EQ(map_copy.GetCount(), 2u);
|
||||
EXPECT_STREQ("a", map_copy.GetValueForKey("one"));
|
||||
EXPECT_STREQ("c", map_copy.GetValueForKey("three"));
|
||||
map_copy.SetKeyValue("four", "d");
|
||||
@@ -99,7 +99,7 @@ TEST(SimpleStringDictionary, CopyAndAssign) {
|
||||
// Test assign.
|
||||
TSimpleStringDictionary<10, 10, 10> map_assign;
|
||||
map_assign = map;
|
||||
EXPECT_EQ(2u, map_assign.GetCount());
|
||||
EXPECT_EQ(map_assign.GetCount(), 2u);
|
||||
EXPECT_STREQ("a", map_assign.GetValueForKey("one"));
|
||||
EXPECT_STREQ("c", map_assign.GetValueForKey("three"));
|
||||
map_assign.SetKeyValue("four", "d");
|
||||
@@ -129,7 +129,7 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
|
||||
// We'll keep track of the number of key/value pairs we think should be in the
|
||||
// dictionary
|
||||
int expectedDictionarySize = 0;
|
||||
int expected_dictionary_size = 0;
|
||||
|
||||
// Set a bunch of key/value pairs like key0/value0, key1/value1, ...
|
||||
for (int i = 0; i < kPartitionIndex; ++i) {
|
||||
@@ -137,7 +137,7 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
sprintf(value, "value%d", i);
|
||||
dict->SetKeyValue(key, value);
|
||||
}
|
||||
expectedDictionarySize = kPartitionIndex;
|
||||
expected_dictionary_size = kPartitionIndex;
|
||||
|
||||
// set a couple of the keys twice (with the same value) - should be nop
|
||||
dict->SetKeyValue("key2", "value2");
|
||||
@@ -149,7 +149,7 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
dict->RemoveKey("key18");
|
||||
dict->RemoveKey("key23");
|
||||
dict->RemoveKey("key31");
|
||||
expectedDictionarySize -= 4; // we just removed four key/value pairs
|
||||
expected_dictionary_size -= 4; // we just removed four key/value pairs
|
||||
|
||||
// Set some more key/value pairs like key59/value59, key60/value60, ...
|
||||
for (int i = kPartitionIndex; i < kDictionaryCapacity; ++i) {
|
||||
@@ -157,7 +157,7 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
sprintf(value, "value%d", i);
|
||||
dict->SetKeyValue(key, value);
|
||||
}
|
||||
expectedDictionarySize += kDictionaryCapacity - kPartitionIndex;
|
||||
expected_dictionary_size += kDictionaryCapacity - kPartitionIndex;
|
||||
|
||||
// Now create an iterator on the dictionary
|
||||
SimpleStringDictionary::Iterator iter(*dict);
|
||||
@@ -170,35 +170,36 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
int count[kDictionaryCapacity];
|
||||
memset(count, 0, sizeof(count));
|
||||
|
||||
int totalCount = 0;
|
||||
int total_count = 0;
|
||||
|
||||
for (;;) {
|
||||
const SimpleStringDictionary::Entry* entry = iter.Next();
|
||||
if (!entry)
|
||||
break;
|
||||
totalCount++;
|
||||
total_count++;
|
||||
|
||||
// Extract keyNumber from a string of the form key<keyNumber>
|
||||
int keyNumber;
|
||||
sscanf(entry->key, "key%d", &keyNumber);
|
||||
// Extract key_number from a string of the form key<key_number>
|
||||
int key_number;
|
||||
sscanf(entry->key, "key%d", &key_number);
|
||||
|
||||
// Extract valueNumber from a string of the form value<valueNumber>
|
||||
int valueNumber;
|
||||
sscanf(entry->value, "value%d", &valueNumber);
|
||||
// Extract value_number from a string of the form value<value_number>
|
||||
int value_number;
|
||||
sscanf(entry->value, "value%d", &value_number);
|
||||
|
||||
// The value number should equal the key number since that's how we set them
|
||||
EXPECT_EQ(keyNumber, valueNumber);
|
||||
EXPECT_EQ(value_number, key_number);
|
||||
|
||||
// Key and value numbers should be in proper range: 0 <= keyNumber <
|
||||
// Key and value numbers should be in proper range: 0 <= key_number <
|
||||
// kDictionaryCapacity
|
||||
bool isKeyInGoodRange = (keyNumber >= 0 && keyNumber < kDictionaryCapacity);
|
||||
bool isValueInGoodRange =
|
||||
(valueNumber >= 0 && valueNumber < kDictionaryCapacity);
|
||||
EXPECT_TRUE(isKeyInGoodRange);
|
||||
EXPECT_TRUE(isValueInGoodRange);
|
||||
bool key_in_good_range =
|
||||
key_number >= 0 && key_number < kDictionaryCapacity;
|
||||
bool value_in_good_range =
|
||||
value_number >= 0 && value_number < kDictionaryCapacity;
|
||||
EXPECT_TRUE(key_in_good_range);
|
||||
EXPECT_TRUE(value_in_good_range);
|
||||
|
||||
if (isKeyInGoodRange && isValueInGoodRange) {
|
||||
++count[keyNumber];
|
||||
if (key_in_good_range && value_in_good_range) {
|
||||
++count[key_number];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,12 +208,12 @@ TEST(SimpleStringDictionary, Iterator) {
|
||||
for (size_t i = 0; i < kDictionaryCapacity; ++i) {
|
||||
// Skip over key7, key18, key23, and key31, since we removed them
|
||||
if (!(i == 7 || i == 18 || i == 23 || i == 31)) {
|
||||
EXPECT_EQ(count[i], 1);
|
||||
EXPECT_EQ(1, count[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the number of iterations matches the expected dictionary size.
|
||||
EXPECT_EQ(totalCount, expectedDictionarySize);
|
||||
EXPECT_EQ(total_count, expected_dictionary_size);
|
||||
}
|
||||
|
||||
TEST(SimpleStringDictionary, AddRemove) {
|
||||
@@ -221,22 +222,22 @@ TEST(SimpleStringDictionary, AddRemove) {
|
||||
map.SetKeyValue("mike", "pink");
|
||||
map.SetKeyValue("mark", "allays");
|
||||
|
||||
EXPECT_EQ(3u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 3u);
|
||||
EXPECT_STREQ("ert", map.GetValueForKey("rob"));
|
||||
EXPECT_STREQ("pink", map.GetValueForKey("mike"));
|
||||
EXPECT_STREQ("allays", map.GetValueForKey("mark"));
|
||||
|
||||
map.RemoveKey("mike");
|
||||
|
||||
EXPECT_EQ(2u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 2u);
|
||||
EXPECT_FALSE(map.GetValueForKey("mike"));
|
||||
|
||||
map.SetKeyValue("mark", "mal");
|
||||
EXPECT_EQ(2u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 2u);
|
||||
EXPECT_STREQ("mal", map.GetValueForKey("mark"));
|
||||
|
||||
map.RemoveKey("mark");
|
||||
EXPECT_EQ(1u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 1u);
|
||||
EXPECT_FALSE(map.GetValueForKey("mark"));
|
||||
}
|
||||
|
||||
@@ -246,7 +247,7 @@ TEST(SimpleStringDictionary, OutOfSpace) {
|
||||
map.SetKeyValue("a", "1");
|
||||
map.SetKeyValue("b", "2");
|
||||
map.SetKeyValue("c", "3");
|
||||
EXPECT_EQ(2u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 2u);
|
||||
EXPECT_FALSE(map.GetValueForKey("c"));
|
||||
}
|
||||
|
||||
@@ -262,7 +263,7 @@ TEST(SimpleStringDictionaryDeathTest, NullKey) {
|
||||
|
||||
ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
|
||||
map.RemoveKey("hi");
|
||||
EXPECT_EQ(0u, map.GetCount());
|
||||
EXPECT_EQ(map.GetCount(), 0u);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -101,41 +101,41 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
// Check the entire exception message, because most or all of it was
|
||||
// generated by SimulateCrash() instead of the kernel.
|
||||
|
||||
EXPECT_EQ(behavior_, behavior);
|
||||
EXPECT_EQ(LocalPort(), exception_port);
|
||||
EXPECT_EQ(behavior, behavior_);
|
||||
EXPECT_EQ(exception_port, LocalPort());
|
||||
if (ExceptionBehaviorHasIdentity(behavior)) {
|
||||
EXPECT_NE(THREAD_NULL, thread);
|
||||
EXPECT_EQ(ChildTask(), task);
|
||||
EXPECT_NE(thread, THREAD_NULL);
|
||||
EXPECT_EQ(task, ChildTask());
|
||||
} else {
|
||||
EXPECT_EQ(THREAD_NULL, thread);
|
||||
EXPECT_EQ(TASK_NULL, task);
|
||||
EXPECT_EQ(thread, THREAD_NULL);
|
||||
EXPECT_EQ(task, TASK_NULL);
|
||||
}
|
||||
EXPECT_EQ(kMachExceptionSimulated, exception);
|
||||
EXPECT_EQ(2u, code_count);
|
||||
EXPECT_EQ(exception, kMachExceptionSimulated);
|
||||
EXPECT_EQ(code_count, 2u);
|
||||
if (code_count >= 1) {
|
||||
EXPECT_EQ(0, code[0]);
|
||||
EXPECT_EQ(code[0], 0);
|
||||
}
|
||||
if (code_count >= 2) {
|
||||
EXPECT_EQ(0, code[1]);
|
||||
EXPECT_EQ(code[1], 0);
|
||||
}
|
||||
if (!ExceptionBehaviorHasState(behavior)) {
|
||||
EXPECT_EQ(THREAD_STATE_NONE, *flavor);
|
||||
EXPECT_EQ(*flavor, THREAD_STATE_NONE);
|
||||
} else {
|
||||
EXPECT_EQ(flavor_, *flavor);
|
||||
EXPECT_EQ(*flavor, flavor_);
|
||||
switch (*flavor) {
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
case x86_THREAD_STATE: {
|
||||
EXPECT_EQ(x86_THREAD_STATE_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_THREAD_STATE_COUNT);
|
||||
const x86_thread_state* state =
|
||||
reinterpret_cast<const x86_thread_state*>(old_state);
|
||||
switch (state->tsh.flavor) {
|
||||
case x86_THREAD_STATE32:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_THREAD_STATE32_COUNT),
|
||||
state->tsh.count);
|
||||
EXPECT_EQ(state->tsh.count,
|
||||
implicit_cast<int>(x86_THREAD_STATE32_COUNT));
|
||||
break;
|
||||
case x86_THREAD_STATE64:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_THREAD_STATE64_COUNT),
|
||||
state->tsh.count);
|
||||
EXPECT_EQ(state->tsh.count,
|
||||
implicit_cast<int>(x86_THREAD_STATE64_COUNT));
|
||||
break;
|
||||
default:
|
||||
ADD_FAILURE() << "unexpected tsh.flavor " << state->tsh.flavor;
|
||||
@@ -144,17 +144,17 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
break;
|
||||
}
|
||||
case x86_FLOAT_STATE: {
|
||||
EXPECT_EQ(x86_FLOAT_STATE_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_FLOAT_STATE_COUNT);
|
||||
const x86_float_state* state =
|
||||
reinterpret_cast<const x86_float_state*>(old_state);
|
||||
switch (state->fsh.flavor) {
|
||||
case x86_FLOAT_STATE32:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_FLOAT_STATE32_COUNT),
|
||||
state->fsh.count);
|
||||
EXPECT_EQ(state->fsh.count,
|
||||
implicit_cast<int>(x86_FLOAT_STATE32_COUNT));
|
||||
break;
|
||||
case x86_FLOAT_STATE64:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_FLOAT_STATE64_COUNT),
|
||||
state->fsh.count);
|
||||
EXPECT_EQ(state->fsh.count,
|
||||
implicit_cast<int>(x86_FLOAT_STATE64_COUNT));
|
||||
break;
|
||||
default:
|
||||
ADD_FAILURE() << "unexpected fsh.flavor " << state->fsh.flavor;
|
||||
@@ -163,17 +163,17 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
break;
|
||||
}
|
||||
case x86_DEBUG_STATE: {
|
||||
EXPECT_EQ(x86_DEBUG_STATE_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_DEBUG_STATE_COUNT);
|
||||
const x86_debug_state* state =
|
||||
reinterpret_cast<const x86_debug_state*>(old_state);
|
||||
switch (state->dsh.flavor) {
|
||||
case x86_DEBUG_STATE32:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_DEBUG_STATE32_COUNT),
|
||||
state->dsh.count);
|
||||
EXPECT_EQ(state->dsh.count,
|
||||
implicit_cast<int>(x86_DEBUG_STATE32_COUNT));
|
||||
break;
|
||||
case x86_DEBUG_STATE64:
|
||||
EXPECT_EQ(implicit_cast<int>(x86_DEBUG_STATE64_COUNT),
|
||||
state->dsh.count);
|
||||
EXPECT_EQ(state->dsh.count,
|
||||
implicit_cast<int>(x86_DEBUG_STATE64_COUNT));
|
||||
break;
|
||||
default:
|
||||
ADD_FAILURE() << "unexpected dsh.flavor " << state->dsh.flavor;
|
||||
@@ -182,22 +182,22 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
break;
|
||||
}
|
||||
case x86_THREAD_STATE32:
|
||||
EXPECT_EQ(x86_THREAD_STATE32_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_THREAD_STATE32_COUNT);
|
||||
break;
|
||||
case x86_FLOAT_STATE32:
|
||||
EXPECT_EQ(x86_FLOAT_STATE32_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_FLOAT_STATE32_COUNT);
|
||||
break;
|
||||
case x86_DEBUG_STATE32:
|
||||
EXPECT_EQ(x86_DEBUG_STATE32_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_DEBUG_STATE32_COUNT);
|
||||
break;
|
||||
case x86_THREAD_STATE64:
|
||||
EXPECT_EQ(x86_THREAD_STATE64_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_THREAD_STATE64_COUNT);
|
||||
break;
|
||||
case x86_FLOAT_STATE64:
|
||||
EXPECT_EQ(x86_FLOAT_STATE64_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_FLOAT_STATE64_COUNT);
|
||||
break;
|
||||
case x86_DEBUG_STATE64:
|
||||
EXPECT_EQ(x86_DEBUG_STATE64_COUNT, old_state_count);
|
||||
EXPECT_EQ(old_state_count, x86_DEBUG_STATE64_COUNT);
|
||||
break;
|
||||
#else
|
||||
#error Port to your CPU architecture
|
||||
@@ -223,7 +223,7 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
// thread-level EXC_CRASH handler. To test that it will fall back to
|
||||
// trying the task-level EXC_CRASH handler, return a failure code, which
|
||||
// should cause SimulateCrash() to try the next target.
|
||||
EXPECT_EQ(kExceptionPortsTargetBoth, target_);
|
||||
EXPECT_EQ(target_, kExceptionPortsTargetBoth);
|
||||
return KERN_ABORTED;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
MachMessageServer::kOneShot,
|
||||
MachMessageServer::kReceiveLargeError,
|
||||
kMachMessageTimeoutWaitIndefinitely);
|
||||
EXPECT_EQ(MACH_MSG_SUCCESS, mr)
|
||||
EXPECT_EQ(mr, MACH_MSG_SUCCESS)
|
||||
<< MachErrorMessage(mr, "MachMessageServer::Run");
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
MachMessageServer::kOneShot,
|
||||
MachMessageServer::kReceiveLargeError,
|
||||
kMachMessageTimeoutWaitIndefinitely);
|
||||
EXPECT_EQ(MACH_MSG_SUCCESS, mr)
|
||||
EXPECT_EQ(mr, MACH_MSG_SUCCESS)
|
||||
<< MachErrorMessage(mr, "MachMessageServer::Run");
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(MinidumpContextWriter, MinidumpContextX86Writer) {
|
||||
MinidumpContextX86Writer context_writer;
|
||||
|
||||
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpContextX86), string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextX86));
|
||||
|
||||
const MinidumpContextX86* observed =
|
||||
MinidumpWritableAtRVA<MinidumpContextX86>(string_file.string(), 0);
|
||||
@@ -58,7 +58,7 @@ TEST(MinidumpContextWriter, MinidumpContextX86Writer) {
|
||||
InitializeMinidumpContextX86(context_writer.context(), kSeed);
|
||||
|
||||
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpContextX86), string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextX86));
|
||||
|
||||
const MinidumpContextX86* observed =
|
||||
MinidumpWritableAtRVA<MinidumpContextX86>(string_file.string(), 0);
|
||||
@@ -79,7 +79,7 @@ TEST(MinidumpContextWriter, MinidumpContextAMD64Writer) {
|
||||
MinidumpContextAMD64Writer context_writer;
|
||||
|
||||
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpContextAMD64), string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextAMD64));
|
||||
|
||||
const MinidumpContextAMD64* observed =
|
||||
MinidumpWritableAtRVA<MinidumpContextAMD64>(string_file.string(), 0);
|
||||
@@ -98,7 +98,7 @@ TEST(MinidumpContextWriter, MinidumpContextAMD64Writer) {
|
||||
InitializeMinidumpContextAMD64(context_writer.context(), kSeed);
|
||||
|
||||
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpContextAMD64), string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextAMD64));
|
||||
|
||||
const MinidumpContextAMD64* observed =
|
||||
MinidumpWritableAtRVA<MinidumpContextAMD64>(string_file.string(), 0);
|
||||
|
||||
@@ -49,7 +49,7 @@ void GetCrashpadInfoStream(
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeCrashpadInfo, directory[0].StreamType);
|
||||
ASSERT_EQ(directory[0].StreamType, kMinidumpStreamTypeCrashpadInfo);
|
||||
|
||||
*crashpad_info = MinidumpWritableAtLocationDescriptor<MinidumpCrashpadInfo>(
|
||||
file_contents, directory[0].Location);
|
||||
@@ -82,9 +82,9 @@ TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||
ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
|
||||
string_file.string(), &crashpad_info, &simple_annotations, &module_list));
|
||||
|
||||
EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
|
||||
EXPECT_EQ(UUID(), crashpad_info->report_id);
|
||||
EXPECT_EQ(UUID(), crashpad_info->client_id);
|
||||
EXPECT_EQ(crashpad_info->version, MinidumpCrashpadInfo::kVersion);
|
||||
EXPECT_EQ(crashpad_info->report_id, UUID());
|
||||
EXPECT_EQ(crashpad_info->client_id, UUID());
|
||||
EXPECT_FALSE(simple_annotations);
|
||||
EXPECT_FALSE(module_list);
|
||||
}
|
||||
@@ -118,9 +118,9 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||
ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
|
||||
string_file.string(), &crashpad_info, &simple_annotations, &module_list));
|
||||
|
||||
EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
|
||||
EXPECT_EQ(report_id, crashpad_info->report_id);
|
||||
EXPECT_EQ(client_id, crashpad_info->client_id);
|
||||
EXPECT_EQ(crashpad_info->version, MinidumpCrashpadInfo::kVersion);
|
||||
EXPECT_EQ(crashpad_info->report_id, report_id);
|
||||
EXPECT_EQ(crashpad_info->client_id, client_id);
|
||||
EXPECT_FALSE(simple_annotations);
|
||||
EXPECT_FALSE(module_list);
|
||||
}
|
||||
@@ -160,17 +160,17 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||
ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
|
||||
string_file.string(), &crashpad_info, &simple_annotations, &module_list));
|
||||
|
||||
EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
|
||||
EXPECT_EQ(crashpad_info->version, MinidumpCrashpadInfo::kVersion);
|
||||
EXPECT_FALSE(module_list);
|
||||
|
||||
ASSERT_TRUE(simple_annotations);
|
||||
ASSERT_EQ(1u, simple_annotations->count);
|
||||
EXPECT_EQ(kKey,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].key));
|
||||
EXPECT_EQ(kValue,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value));
|
||||
ASSERT_EQ(simple_annotations->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
simple_annotations->entries[0].key),
|
||||
kKey);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value),
|
||||
kValue);
|
||||
}
|
||||
|
||||
TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
||||
@@ -201,24 +201,24 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
||||
ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
|
||||
string_file.string(), &crashpad_info, &simple_annotations, &module_list));
|
||||
|
||||
EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
|
||||
EXPECT_EQ(crashpad_info->version, MinidumpCrashpadInfo::kVersion);
|
||||
EXPECT_FALSE(simple_annotations);
|
||||
|
||||
ASSERT_TRUE(module_list);
|
||||
ASSERT_EQ(1u, module_list->count);
|
||||
ASSERT_EQ(module_list->count, 1u);
|
||||
|
||||
EXPECT_EQ(kMinidumpModuleListIndex,
|
||||
module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index,
|
||||
kMinidumpModuleListIndex);
|
||||
const MinidumpModuleCrashpadInfo* module =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version);
|
||||
EXPECT_EQ(0u, module->list_annotations.DataSize);
|
||||
EXPECT_EQ(0u, module->list_annotations.Rva);
|
||||
EXPECT_EQ(0u, module->simple_annotations.DataSize);
|
||||
EXPECT_EQ(0u, module->simple_annotations.Rva);
|
||||
EXPECT_EQ(module->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
EXPECT_EQ(module->list_annotations.DataSize, 0u);
|
||||
EXPECT_EQ(module->list_annotations.Rva, 0u);
|
||||
EXPECT_EQ(module->simple_annotations.DataSize, 0u);
|
||||
EXPECT_EQ(module->simple_annotations.Rva, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
@@ -276,40 +276,40 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
|
||||
string_file.string(), &info, &simple_annotations, &module_list));
|
||||
|
||||
EXPECT_EQ(MinidumpCrashpadInfo::kVersion, info->version);
|
||||
EXPECT_EQ(info->version, MinidumpCrashpadInfo::kVersion);
|
||||
|
||||
EXPECT_EQ(report_id, info->report_id);
|
||||
EXPECT_EQ(client_id, info->client_id);
|
||||
EXPECT_EQ(info->report_id, report_id);
|
||||
EXPECT_EQ(info->client_id, client_id);
|
||||
|
||||
ASSERT_TRUE(simple_annotations);
|
||||
ASSERT_EQ(1u, simple_annotations->count);
|
||||
EXPECT_EQ(kKey,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].key));
|
||||
EXPECT_EQ(kValue,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value));
|
||||
ASSERT_EQ(simple_annotations->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
simple_annotations->entries[0].key),
|
||||
kKey);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value),
|
||||
kValue);
|
||||
|
||||
ASSERT_TRUE(module_list);
|
||||
ASSERT_EQ(1u, module_list->count);
|
||||
ASSERT_EQ(module_list->count, 1u);
|
||||
|
||||
EXPECT_EQ(0u, module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index, 0u);
|
||||
const MinidumpModuleCrashpadInfo* module =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version);
|
||||
EXPECT_EQ(module->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
string_file.string(), module->list_annotations);
|
||||
ASSERT_TRUE(list_annotations);
|
||||
|
||||
ASSERT_EQ(1u, list_annotations->count);
|
||||
EXPECT_EQ(kEntry,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations->children[0]));
|
||||
ASSERT_EQ(list_annotations->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations->children[0]),
|
||||
kEntry);
|
||||
|
||||
const MinidumpSimpleStringDictionary* module_simple_annotations =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>(
|
||||
|
||||
@@ -45,15 +45,15 @@ void GetExceptionStream(const std::string& file_contents,
|
||||
const size_t kContextOffset =
|
||||
kExceptionStreamOffset + sizeof(MINIDUMP_EXCEPTION_STREAM);
|
||||
const size_t kFileSize = kContextOffset + sizeof(MinidumpContextX86);
|
||||
ASSERT_EQ(file_contents.size(), kFileSize);
|
||||
ASSERT_EQ(kFileSize, file_contents.size());
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
MinidumpHeaderAtStart(file_contents, &directory);
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeException, directory[0].StreamType);
|
||||
EXPECT_EQ(kExceptionStreamOffset, directory[0].Location.Rva);
|
||||
ASSERT_EQ(directory[0].StreamType, kMinidumpStreamTypeException);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kExceptionStreamOffset);
|
||||
|
||||
*exception_stream =
|
||||
MinidumpWritableAtLocationDescriptor<MINIDUMP_EXCEPTION_STREAM>(
|
||||
@@ -68,24 +68,24 @@ void ExpectExceptionStream(const MINIDUMP_EXCEPTION_STREAM* expected,
|
||||
const MINIDUMP_EXCEPTION_STREAM* observed,
|
||||
const std::string& file_contents,
|
||||
const MinidumpContextX86** context) {
|
||||
EXPECT_EQ(expected->ThreadId, observed->ThreadId);
|
||||
EXPECT_EQ(0u, observed->__alignment);
|
||||
EXPECT_EQ(expected->ExceptionRecord.ExceptionCode,
|
||||
observed->ExceptionRecord.ExceptionCode);
|
||||
EXPECT_EQ(expected->ExceptionRecord.ExceptionFlags,
|
||||
observed->ExceptionRecord.ExceptionFlags);
|
||||
EXPECT_EQ(expected->ExceptionRecord.ExceptionRecord,
|
||||
observed->ExceptionRecord.ExceptionRecord);
|
||||
EXPECT_EQ(expected->ExceptionRecord.ExceptionAddress,
|
||||
observed->ExceptionRecord.ExceptionAddress);
|
||||
EXPECT_EQ(expected->ExceptionRecord.NumberParameters,
|
||||
observed->ExceptionRecord.NumberParameters);
|
||||
EXPECT_EQ(0u, observed->ExceptionRecord.__unusedAlignment);
|
||||
EXPECT_EQ(observed->ThreadId, expected->ThreadId);
|
||||
EXPECT_EQ(observed->__alignment, 0u);
|
||||
EXPECT_EQ(observed->ExceptionRecord.ExceptionCode,
|
||||
expected->ExceptionRecord.ExceptionCode);
|
||||
EXPECT_EQ(observed->ExceptionRecord.ExceptionFlags,
|
||||
expected->ExceptionRecord.ExceptionFlags);
|
||||
EXPECT_EQ(observed->ExceptionRecord.ExceptionRecord,
|
||||
expected->ExceptionRecord.ExceptionRecord);
|
||||
EXPECT_EQ(observed->ExceptionRecord.ExceptionAddress,
|
||||
expected->ExceptionRecord.ExceptionAddress);
|
||||
EXPECT_EQ(observed->ExceptionRecord.NumberParameters,
|
||||
expected->ExceptionRecord.NumberParameters);
|
||||
EXPECT_EQ(observed->ExceptionRecord.__unusedAlignment, 0u);
|
||||
for (size_t index = 0;
|
||||
index < arraysize(observed->ExceptionRecord.ExceptionInformation);
|
||||
++index) {
|
||||
EXPECT_EQ(expected->ExceptionRecord.ExceptionInformation[index],
|
||||
observed->ExceptionRecord.ExceptionInformation[index]);
|
||||
EXPECT_EQ(observed->ExceptionRecord.ExceptionInformation[index],
|
||||
expected->ExceptionRecord.ExceptionInformation[index]);
|
||||
}
|
||||
*context = MinidumpWritableAtLocationDescriptor<MinidumpContextX86>(
|
||||
file_contents, observed->ThreadContext);
|
||||
|
||||
@@ -47,7 +47,7 @@ TEST(MinidumpFileWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file;
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER), string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(MINIDUMP_HEADER));
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -78,7 +78,7 @@ class TestStream final : public internal::MinidumpStreamWriter {
|
||||
}
|
||||
|
||||
bool WriteObject(FileWriterInterface* file_writer) override {
|
||||
EXPECT_EQ(state(), kStateWritable);
|
||||
EXPECT_EQ(kStateWritable, state());
|
||||
return file_writer->Write(&stream_data_[0], stream_data_.size());
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST(MinidumpFileWriter, OneStream) {
|
||||
const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
|
||||
const size_t kFileSize = kStreamOffset + kStreamSize;
|
||||
|
||||
ASSERT_EQ(kFileSize, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -116,16 +116,16 @@ TEST(MinidumpFileWriter, OneStream) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, kTimestamp));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kStreamType, directory[0].StreamType);
|
||||
EXPECT_EQ(kStreamSize, directory[0].Location.DataSize);
|
||||
EXPECT_EQ(kStreamOffset, directory[0].Location.Rva);
|
||||
EXPECT_EQ(directory[0].StreamType, kStreamType);
|
||||
EXPECT_EQ(directory[0].Location.DataSize, kStreamSize);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kStreamOffset);
|
||||
|
||||
const uint8_t* stream_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[0].Location);
|
||||
ASSERT_TRUE(stream_data);
|
||||
|
||||
std::string expected_stream(kStreamSize, kStreamValue);
|
||||
EXPECT_EQ(0, memcmp(stream_data, expected_stream.c_str(), kStreamSize));
|
||||
EXPECT_EQ(memcmp(stream_data, expected_stream.c_str(), kStreamSize), 0);
|
||||
}
|
||||
|
||||
TEST(MinidumpFileWriter, AddUserExtensionStream) {
|
||||
@@ -153,7 +153,7 @@ TEST(MinidumpFileWriter, AddUserExtensionStream) {
|
||||
const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
|
||||
const size_t kFileSize = kStreamOffset + kStreamSize;
|
||||
|
||||
ASSERT_EQ(kFileSize, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -161,15 +161,15 @@ TEST(MinidumpFileWriter, AddUserExtensionStream) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, kTimestamp));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kStreamType, directory[0].StreamType);
|
||||
EXPECT_EQ(kStreamSize, directory[0].Location.DataSize);
|
||||
EXPECT_EQ(kStreamOffset, directory[0].Location.Rva);
|
||||
EXPECT_EQ(directory[0].StreamType, kStreamType);
|
||||
EXPECT_EQ(directory[0].Location.DataSize, kStreamSize);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kStreamOffset);
|
||||
|
||||
const uint8_t* stream_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[0].Location);
|
||||
ASSERT_TRUE(stream_data);
|
||||
|
||||
EXPECT_EQ(0, memcmp(stream_data, kStreamData, kStreamSize));
|
||||
EXPECT_EQ(memcmp(stream_data, kStreamData, kStreamSize), 0);
|
||||
}
|
||||
|
||||
TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
@@ -213,7 +213,7 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
const size_t kStream2Offset = kStream1Offset + kStream1Size + kStream2Padding;
|
||||
const size_t kFileSize = kStream2Offset + kStream2Size;
|
||||
|
||||
ASSERT_EQ(kFileSize, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -221,43 +221,43 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 3, kTimestamp));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kStream0Type, directory[0].StreamType);
|
||||
EXPECT_EQ(kStream0Size, directory[0].Location.DataSize);
|
||||
EXPECT_EQ(kStream0Offset, directory[0].Location.Rva);
|
||||
EXPECT_EQ(kStream1Type, directory[1].StreamType);
|
||||
EXPECT_EQ(kStream1Size, directory[1].Location.DataSize);
|
||||
EXPECT_EQ(kStream1Offset, directory[1].Location.Rva);
|
||||
EXPECT_EQ(kStream2Type, directory[2].StreamType);
|
||||
EXPECT_EQ(kStream2Size, directory[2].Location.DataSize);
|
||||
EXPECT_EQ(kStream2Offset, directory[2].Location.Rva);
|
||||
EXPECT_EQ(directory[0].StreamType, kStream0Type);
|
||||
EXPECT_EQ(directory[0].Location.DataSize, kStream0Size);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kStream0Offset);
|
||||
EXPECT_EQ(directory[1].StreamType, kStream1Type);
|
||||
EXPECT_EQ(directory[1].Location.DataSize, kStream1Size);
|
||||
EXPECT_EQ(directory[1].Location.Rva, kStream1Offset);
|
||||
EXPECT_EQ(directory[2].StreamType, kStream2Type);
|
||||
EXPECT_EQ(directory[2].Location.DataSize, kStream2Size);
|
||||
EXPECT_EQ(directory[2].Location.Rva, kStream2Offset);
|
||||
|
||||
const uint8_t* stream0_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[0].Location);
|
||||
ASSERT_TRUE(stream0_data);
|
||||
|
||||
std::string expected_stream0(kStream0Size, kStream0Value);
|
||||
EXPECT_EQ(0, memcmp(stream0_data, expected_stream0.c_str(), kStream0Size));
|
||||
EXPECT_EQ(memcmp(stream0_data, expected_stream0.c_str(), kStream0Size), 0);
|
||||
|
||||
const int kZeroes[16] = {};
|
||||
ASSERT_GE(sizeof(kZeroes), kStream1Padding);
|
||||
EXPECT_EQ(0, memcmp(stream0_data + kStream0Size, kZeroes, kStream1Padding));
|
||||
EXPECT_EQ(memcmp(stream0_data + kStream0Size, kZeroes, kStream1Padding), 0);
|
||||
|
||||
const uint8_t* stream1_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[1].Location);
|
||||
ASSERT_TRUE(stream1_data);
|
||||
|
||||
std::string expected_stream1(kStream1Size, kStream1Value);
|
||||
EXPECT_EQ(0, memcmp(stream1_data, expected_stream1.c_str(), kStream1Size));
|
||||
EXPECT_EQ(memcmp(stream1_data, expected_stream1.c_str(), kStream1Size), 0);
|
||||
|
||||
ASSERT_GE(sizeof(kZeroes), kStream2Padding);
|
||||
EXPECT_EQ(0, memcmp(stream1_data + kStream1Size, kZeroes, kStream2Padding));
|
||||
EXPECT_EQ(memcmp(stream1_data + kStream1Size, kZeroes, kStream2Padding), 0);
|
||||
|
||||
const uint8_t* stream2_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[2].Location);
|
||||
ASSERT_TRUE(stream2_data);
|
||||
|
||||
std::string expected_stream2(kStream2Size, kStream2Value);
|
||||
EXPECT_EQ(0, memcmp(stream2_data, expected_stream2.c_str(), kStream2Size));
|
||||
EXPECT_EQ(memcmp(stream2_data, expected_stream2.c_str(), kStream2Size), 0);
|
||||
}
|
||||
|
||||
TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||
@@ -275,7 +275,7 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||
const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
|
||||
const size_t kFileSize = kStreamOffset + kStreamSize;
|
||||
|
||||
ASSERT_EQ(kFileSize, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -283,9 +283,9 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kStreamType, directory[0].StreamType);
|
||||
EXPECT_EQ(kStreamSize, directory[0].Location.DataSize);
|
||||
EXPECT_EQ(kStreamOffset, directory[0].Location.Rva);
|
||||
EXPECT_EQ(directory[0].StreamType, kStreamType);
|
||||
EXPECT_EQ(directory[0].Location.DataSize, kStreamSize);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kStreamOffset);
|
||||
}
|
||||
|
||||
TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||
@@ -320,32 +320,32 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 5, kSnapshotTime));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeSystemInfo, directory[0].StreamType);
|
||||
EXPECT_EQ(directory[0].StreamType, kMinidumpStreamTypeSystemInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_SYSTEM_INFO>(
|
||||
string_file.string(), directory[0].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMiscInfo, directory[1].StreamType);
|
||||
EXPECT_EQ(directory[1].StreamType, kMinidumpStreamTypeMiscInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MISC_INFO_4>(
|
||||
string_file.string(), directory[1].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeThreadList, directory[2].StreamType);
|
||||
EXPECT_EQ(directory[2].StreamType, kMinidumpStreamTypeThreadList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_LIST>(
|
||||
string_file.string(), directory[2].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeModuleList, directory[3].StreamType);
|
||||
EXPECT_EQ(directory[3].StreamType, kMinidumpStreamTypeModuleList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
|
||||
string_file.string(), directory[3].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[4].StreamType);
|
||||
EXPECT_EQ(directory[4].StreamType, kMinidumpStreamTypeMemoryList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
|
||||
string_file.string(), directory[4].Location));
|
||||
|
||||
const MINIDUMP_MEMORY_LIST* memory_list =
|
||||
MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
|
||||
string_file.string(), directory[4].Location);
|
||||
EXPECT_EQ(1u, memory_list->NumberOfMemoryRanges);
|
||||
EXPECT_EQ(kPebAddress, memory_list->MemoryRanges[0].StartOfMemoryRange);
|
||||
EXPECT_EQ(kPebSize, memory_list->MemoryRanges[0].Memory.DataSize);
|
||||
EXPECT_EQ(memory_list->NumberOfMemoryRanges, 1u);
|
||||
EXPECT_EQ(memory_list->MemoryRanges[0].StartOfMemoryRange, kPebAddress);
|
||||
EXPECT_EQ(memory_list->MemoryRanges[0].Memory.DataSize, kPebSize);
|
||||
}
|
||||
|
||||
TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||
@@ -391,27 +391,27 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 6, kSnapshotTime));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeSystemInfo, directory[0].StreamType);
|
||||
EXPECT_EQ(directory[0].StreamType, kMinidumpStreamTypeSystemInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_SYSTEM_INFO>(
|
||||
string_file.string(), directory[0].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMiscInfo, directory[1].StreamType);
|
||||
EXPECT_EQ(directory[1].StreamType, kMinidumpStreamTypeMiscInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MISC_INFO_4>(
|
||||
string_file.string(), directory[1].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeThreadList, directory[2].StreamType);
|
||||
EXPECT_EQ(directory[2].StreamType, kMinidumpStreamTypeThreadList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_LIST>(
|
||||
string_file.string(), directory[2].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeException, directory[3].StreamType);
|
||||
EXPECT_EQ(directory[3].StreamType, kMinidumpStreamTypeException);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_EXCEPTION_STREAM>(
|
||||
string_file.string(), directory[3].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeModuleList, directory[4].StreamType);
|
||||
EXPECT_EQ(directory[4].StreamType, kMinidumpStreamTypeModuleList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
|
||||
string_file.string(), directory[4].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[5].StreamType);
|
||||
EXPECT_EQ(directory[5].StreamType, kMinidumpStreamTypeMemoryList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
|
||||
string_file.string(), directory[5].Location));
|
||||
}
|
||||
@@ -455,31 +455,31 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 7, kSnapshotTime));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeSystemInfo, directory[0].StreamType);
|
||||
EXPECT_EQ(directory[0].StreamType, kMinidumpStreamTypeSystemInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_SYSTEM_INFO>(
|
||||
string_file.string(), directory[0].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMiscInfo, directory[1].StreamType);
|
||||
EXPECT_EQ(directory[1].StreamType, kMinidumpStreamTypeMiscInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MISC_INFO_4>(
|
||||
string_file.string(), directory[1].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeThreadList, directory[2].StreamType);
|
||||
EXPECT_EQ(directory[2].StreamType, kMinidumpStreamTypeThreadList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_LIST>(
|
||||
string_file.string(), directory[2].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeException, directory[3].StreamType);
|
||||
EXPECT_EQ(directory[3].StreamType, kMinidumpStreamTypeException);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_EXCEPTION_STREAM>(
|
||||
string_file.string(), directory[3].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeModuleList, directory[4].StreamType);
|
||||
EXPECT_EQ(directory[4].StreamType, kMinidumpStreamTypeModuleList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
|
||||
string_file.string(), directory[4].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeCrashpadInfo, directory[5].StreamType);
|
||||
EXPECT_EQ(directory[5].StreamType, kMinidumpStreamTypeCrashpadInfo);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MinidumpCrashpadInfo>(
|
||||
string_file.string(), directory[5].Location));
|
||||
|
||||
EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[6].StreamType);
|
||||
EXPECT_EQ(directory[6].StreamType, kMinidumpStreamTypeMemoryList);
|
||||
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
|
||||
string_file.string(), directory[6].Location));
|
||||
}
|
||||
@@ -508,7 +508,7 @@ TEST(MinidumpFileWriter, SameStreamType) {
|
||||
const size_t kStream0Offset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
|
||||
const size_t kFileSize = kStream0Offset + kStream0Size;
|
||||
|
||||
ASSERT_EQ(kFileSize, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -516,16 +516,16 @@ TEST(MinidumpFileWriter, SameStreamType) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
EXPECT_EQ(kStreamType, directory[0].StreamType);
|
||||
EXPECT_EQ(kStream0Size, directory[0].Location.DataSize);
|
||||
EXPECT_EQ(kStream0Offset, directory[0].Location.Rva);
|
||||
EXPECT_EQ(directory[0].StreamType, kStreamType);
|
||||
EXPECT_EQ(directory[0].Location.DataSize, kStream0Size);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kStream0Offset);
|
||||
|
||||
const uint8_t* stream_data = MinidumpWritableAtLocationDescriptor<uint8_t>(
|
||||
string_file.string(), directory[0].Location);
|
||||
ASSERT_TRUE(stream_data);
|
||||
|
||||
std::string expected_stream(kStream0Size, kStream0Value);
|
||||
EXPECT_EQ(0, memcmp(stream_data, expected_stream.c_str(), kStream0Size));
|
||||
EXPECT_EQ(memcmp(stream_data, expected_stream.c_str(), kStream0Size), 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -46,9 +46,9 @@ void GetHandleDataStream(
|
||||
|
||||
const size_t kDirectoryIndex = 0;
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeHandleData,
|
||||
directory[kDirectoryIndex].StreamType);
|
||||
EXPECT_EQ(kHandleDataStreamOffset, directory[kDirectoryIndex].Location.Rva);
|
||||
ASSERT_EQ(directory[kDirectoryIndex].StreamType,
|
||||
kMinidumpStreamTypeHandleData);
|
||||
EXPECT_EQ(directory[kDirectoryIndex].Location.Rva, kHandleDataStreamOffset);
|
||||
|
||||
*handle_data_stream =
|
||||
MinidumpWritableAtLocationDescriptor<MINIDUMP_HANDLE_DATA_STREAM>(
|
||||
@@ -64,15 +64,15 @@ TEST(MinidumpHandleDataWriter, Empty) {
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_HANDLE_DATA_STREAM),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_HANDLE_DATA_STREAM));
|
||||
|
||||
const MINIDUMP_HANDLE_DATA_STREAM* handle_data_stream = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetHandleDataStream(string_file.string(), &handle_data_stream));
|
||||
|
||||
EXPECT_EQ(0u, handle_data_stream->NumberOfDescriptors);
|
||||
EXPECT_EQ(handle_data_stream->NumberOfDescriptors, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||
@@ -99,29 +99,29 @@ TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||
|
||||
const size_t kTypeNameStringDataLength =
|
||||
(handle_snapshot.type_name.size() + 1) * sizeof(base::char16);
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_HANDLE_DATA_STREAM) +
|
||||
sizeof(MINIDUMP_HANDLE_DESCRIPTOR) + sizeof(MINIDUMP_STRING) +
|
||||
kTypeNameStringDataLength,
|
||||
string_file.string().size());
|
||||
kTypeNameStringDataLength);
|
||||
|
||||
const MINIDUMP_HANDLE_DATA_STREAM* handle_data_stream = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetHandleDataStream(string_file.string(), &handle_data_stream));
|
||||
|
||||
EXPECT_EQ(1u, handle_data_stream->NumberOfDescriptors);
|
||||
EXPECT_EQ(handle_data_stream->NumberOfDescriptors, 1u);
|
||||
const MINIDUMP_HANDLE_DESCRIPTOR* handle_descriptor =
|
||||
reinterpret_cast<const MINIDUMP_HANDLE_DESCRIPTOR*>(
|
||||
&handle_data_stream[1]);
|
||||
EXPECT_EQ(handle_snapshot.handle, handle_descriptor->Handle);
|
||||
EXPECT_EQ(handle_snapshot.type_name,
|
||||
base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor->TypeNameRva)));
|
||||
EXPECT_EQ(0u, handle_descriptor->ObjectNameRva);
|
||||
EXPECT_EQ(handle_snapshot.attributes, handle_descriptor->Attributes);
|
||||
EXPECT_EQ(handle_snapshot.granted_access, handle_descriptor->GrantedAccess);
|
||||
EXPECT_EQ(handle_snapshot.handle_count, handle_descriptor->HandleCount);
|
||||
EXPECT_EQ(handle_snapshot.pointer_count, handle_descriptor->PointerCount);
|
||||
EXPECT_EQ(handle_descriptor->Handle, handle_snapshot.handle);
|
||||
EXPECT_EQ(base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor->TypeNameRva)),
|
||||
handle_snapshot.type_name);
|
||||
EXPECT_EQ(handle_descriptor->ObjectNameRva, 0u);
|
||||
EXPECT_EQ(handle_descriptor->Attributes, handle_snapshot.attributes);
|
||||
EXPECT_EQ(handle_descriptor->GrantedAccess, handle_snapshot.granted_access);
|
||||
EXPECT_EQ(handle_descriptor->HandleCount, handle_snapshot.handle_count);
|
||||
EXPECT_EQ(handle_descriptor->PointerCount, handle_snapshot.pointer_count);
|
||||
}
|
||||
|
||||
TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||
@@ -157,45 +157,45 @@ TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||
|
||||
const size_t kTypeNameStringDataLength =
|
||||
(handle_snapshot.type_name.size() + 1) * sizeof(base::char16);
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_HANDLE_DATA_STREAM) +
|
||||
(sizeof(MINIDUMP_HANDLE_DESCRIPTOR) * 2) +
|
||||
sizeof(MINIDUMP_STRING) + kTypeNameStringDataLength,
|
||||
string_file.string().size());
|
||||
sizeof(MINIDUMP_STRING) + kTypeNameStringDataLength);
|
||||
|
||||
const MINIDUMP_HANDLE_DATA_STREAM* handle_data_stream = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetHandleDataStream(string_file.string(), &handle_data_stream));
|
||||
|
||||
EXPECT_EQ(2u, handle_data_stream->NumberOfDescriptors);
|
||||
EXPECT_EQ(handle_data_stream->NumberOfDescriptors, 2u);
|
||||
const MINIDUMP_HANDLE_DESCRIPTOR* handle_descriptor =
|
||||
reinterpret_cast<const MINIDUMP_HANDLE_DESCRIPTOR*>(
|
||||
&handle_data_stream[1]);
|
||||
EXPECT_EQ(handle_snapshot.handle, handle_descriptor->Handle);
|
||||
EXPECT_EQ(handle_snapshot.type_name,
|
||||
base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor->TypeNameRva)));
|
||||
EXPECT_EQ(0u, handle_descriptor->ObjectNameRva);
|
||||
EXPECT_EQ(handle_snapshot.attributes, handle_descriptor->Attributes);
|
||||
EXPECT_EQ(handle_snapshot.granted_access, handle_descriptor->GrantedAccess);
|
||||
EXPECT_EQ(handle_snapshot.handle_count, handle_descriptor->HandleCount);
|
||||
EXPECT_EQ(handle_snapshot.pointer_count, handle_descriptor->PointerCount);
|
||||
EXPECT_EQ(handle_descriptor->Handle, handle_snapshot.handle);
|
||||
EXPECT_EQ(base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor->TypeNameRva)),
|
||||
handle_snapshot.type_name);
|
||||
EXPECT_EQ(handle_descriptor->ObjectNameRva, 0u);
|
||||
EXPECT_EQ(handle_descriptor->Attributes, handle_snapshot.attributes);
|
||||
EXPECT_EQ(handle_descriptor->GrantedAccess, handle_snapshot.granted_access);
|
||||
EXPECT_EQ(handle_descriptor->HandleCount, handle_snapshot.handle_count);
|
||||
EXPECT_EQ(handle_descriptor->PointerCount, handle_snapshot.pointer_count);
|
||||
|
||||
const MINIDUMP_HANDLE_DESCRIPTOR* handle_descriptor2 =
|
||||
reinterpret_cast<const MINIDUMP_HANDLE_DESCRIPTOR*>(
|
||||
reinterpret_cast<const unsigned char*>(&handle_data_stream[1]) +
|
||||
sizeof(MINIDUMP_HANDLE_DESCRIPTOR));
|
||||
EXPECT_EQ(handle_snapshot2.handle, handle_descriptor2->Handle);
|
||||
EXPECT_EQ(handle_snapshot2.type_name,
|
||||
base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor2->TypeNameRva)));
|
||||
EXPECT_EQ(0u, handle_descriptor2->ObjectNameRva);
|
||||
EXPECT_EQ(handle_snapshot2.attributes, handle_descriptor2->Attributes);
|
||||
EXPECT_EQ(handle_snapshot2.granted_access, handle_descriptor2->GrantedAccess);
|
||||
EXPECT_EQ(handle_snapshot2.handle_count, handle_descriptor2->HandleCount);
|
||||
EXPECT_EQ(handle_snapshot2.pointer_count, handle_descriptor2->PointerCount);
|
||||
EXPECT_EQ(handle_descriptor2->Handle, handle_snapshot2.handle);
|
||||
EXPECT_EQ(base::UTF16ToUTF8(MinidumpStringAtRVAAsString(
|
||||
string_file.string(), handle_descriptor2->TypeNameRva)),
|
||||
handle_snapshot2.type_name);
|
||||
EXPECT_EQ(handle_descriptor2->ObjectNameRva, 0u);
|
||||
EXPECT_EQ(handle_descriptor2->Attributes, handle_snapshot2.attributes);
|
||||
EXPECT_EQ(handle_descriptor2->GrantedAccess, handle_snapshot2.granted_access);
|
||||
EXPECT_EQ(handle_descriptor2->HandleCount, handle_snapshot2.handle_count);
|
||||
EXPECT_EQ(handle_descriptor2->PointerCount, handle_snapshot2.pointer_count);
|
||||
|
||||
EXPECT_EQ(handle_descriptor->TypeNameRva, handle_descriptor2->TypeNameRva);
|
||||
EXPECT_EQ(handle_descriptor2->TypeNameRva, handle_descriptor->TypeNameRva);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -45,10 +45,10 @@ void GetMemoryInfoListStream(
|
||||
|
||||
const size_t kDirectoryIndex = 0;
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeMemoryInfoList,
|
||||
directory[kDirectoryIndex].StreamType);
|
||||
EXPECT_EQ(kMemoryInfoListStreamOffset,
|
||||
directory[kDirectoryIndex].Location.Rva);
|
||||
ASSERT_EQ(directory[kDirectoryIndex].StreamType,
|
||||
kMinidumpStreamTypeMemoryInfoList);
|
||||
EXPECT_EQ(directory[kDirectoryIndex].Location.Rva,
|
||||
kMemoryInfoListStreamOffset);
|
||||
|
||||
*memory_info_list =
|
||||
MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_INFO_LIST>(
|
||||
@@ -66,15 +66,15 @@ TEST(MinidumpMemoryInfoWriter, Empty) {
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MEMORY_INFO_LIST),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MEMORY_INFO_LIST));
|
||||
|
||||
const MINIDUMP_MEMORY_INFO_LIST* memory_info_list = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryInfoListStream(string_file.string(), &memory_info_list));
|
||||
|
||||
EXPECT_EQ(0u, memory_info_list->NumberOfEntries);
|
||||
EXPECT_EQ(memory_info_list->NumberOfEntries, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||
@@ -104,25 +104,25 @@ TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MEMORY_INFO_LIST) +
|
||||
sizeof(MINIDUMP_MEMORY_INFO),
|
||||
string_file.string().size());
|
||||
sizeof(MINIDUMP_MEMORY_INFO));
|
||||
|
||||
const MINIDUMP_MEMORY_INFO_LIST* memory_info_list = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryInfoListStream(string_file.string(), &memory_info_list));
|
||||
|
||||
EXPECT_EQ(1u, memory_info_list->NumberOfEntries);
|
||||
EXPECT_EQ(memory_info_list->NumberOfEntries, 1u);
|
||||
const MINIDUMP_MEMORY_INFO* memory_info =
|
||||
reinterpret_cast<const MINIDUMP_MEMORY_INFO*>(&memory_info_list[1]);
|
||||
EXPECT_EQ(mmi.BaseAddress, memory_info->BaseAddress);
|
||||
EXPECT_EQ(mmi.AllocationBase, memory_info->AllocationBase);
|
||||
EXPECT_EQ(mmi.AllocationProtect, memory_info->AllocationProtect);
|
||||
EXPECT_EQ(mmi.RegionSize, memory_info->RegionSize);
|
||||
EXPECT_EQ(mmi.State, memory_info->State);
|
||||
EXPECT_EQ(mmi.Protect, memory_info->Protect);
|
||||
EXPECT_EQ(mmi.Type, memory_info->Type);
|
||||
EXPECT_EQ(memory_info->BaseAddress, mmi.BaseAddress);
|
||||
EXPECT_EQ(memory_info->AllocationBase, mmi.AllocationBase);
|
||||
EXPECT_EQ(memory_info->AllocationProtect, mmi.AllocationProtect);
|
||||
EXPECT_EQ(memory_info->RegionSize, mmi.RegionSize);
|
||||
EXPECT_EQ(memory_info->State, mmi.State);
|
||||
EXPECT_EQ(memory_info->Protect, mmi.Protect);
|
||||
EXPECT_EQ(memory_info->Type, mmi.Type);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -60,15 +60,15 @@ void GetMemoryListStream(const std::string& file_contents,
|
||||
|
||||
size_t directory_index = 0;
|
||||
if (expected_streams > 1) {
|
||||
ASSERT_EQ(kBogusStreamType, directory[directory_index].StreamType);
|
||||
ASSERT_EQ(0u, directory[directory_index].Location.DataSize);
|
||||
ASSERT_EQ(kMemoryListStreamOffset, directory[directory_index].Location.Rva);
|
||||
ASSERT_EQ(directory[directory_index].StreamType, kBogusStreamType);
|
||||
ASSERT_EQ(directory[directory_index].Location.DataSize, 0u);
|
||||
ASSERT_EQ(directory[directory_index].Location.Rva, kMemoryListStreamOffset);
|
||||
++directory_index;
|
||||
}
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeMemoryList,
|
||||
directory[directory_index].StreamType);
|
||||
EXPECT_EQ(kMemoryListStreamOffset, directory[directory_index].Location.Rva);
|
||||
ASSERT_EQ(directory[directory_index].StreamType,
|
||||
kMinidumpStreamTypeMemoryList);
|
||||
EXPECT_EQ(directory[directory_index].Location.Rva, kMemoryListStreamOffset);
|
||||
|
||||
*memory_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
|
||||
file_contents, directory[directory_index].Location);
|
||||
@@ -84,15 +84,15 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MEMORY_LIST),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MEMORY_LIST));
|
||||
|
||||
const MINIDUMP_MEMORY_LIST* memory_list = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryListStream(string_file.string(), &memory_list, 1));
|
||||
|
||||
EXPECT_EQ(0u, memory_list->NumberOfMemoryRanges);
|
||||
EXPECT_EQ(memory_list->NumberOfMemoryRanges, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||
@@ -157,7 +157,7 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryListStream(string_file.string(), &memory_list, 1));
|
||||
|
||||
EXPECT_EQ(2u, memory_list->NumberOfMemoryRanges);
|
||||
EXPECT_EQ(memory_list->NumberOfMemoryRanges, 2u);
|
||||
|
||||
MINIDUMP_MEMORY_DESCRIPTOR expected;
|
||||
|
||||
@@ -222,7 +222,7 @@ class TestMemoryStream final : public internal::MinidumpStreamWriter {
|
||||
}
|
||||
|
||||
bool WriteObject(FileWriterInterface* file_writer) override {
|
||||
EXPECT_EQ(kStateWritable, state());
|
||||
EXPECT_EQ(state(), kStateWritable);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryListStream(string_file.string(), &memory_list, 2));
|
||||
|
||||
EXPECT_EQ(2u, memory_list->NumberOfMemoryRanges);
|
||||
EXPECT_EQ(memory_list->NumberOfMemoryRanges, 2u);
|
||||
|
||||
MINIDUMP_MEMORY_DESCRIPTOR expected;
|
||||
|
||||
@@ -344,7 +344,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetMemoryListStream(string_file.string(), &memory_list, 1));
|
||||
|
||||
ASSERT_EQ(3u, memory_list->NumberOfMemoryRanges);
|
||||
ASSERT_EQ(memory_list->NumberOfMemoryRanges, 3u);
|
||||
|
||||
for (size_t index = 0; index < memory_list->NumberOfMemoryRanges; ++index) {
|
||||
SCOPED_TRACE(base::StringPrintf("index %" PRIuS, index));
|
||||
|
||||
@@ -49,7 +49,7 @@ void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) {
|
||||
const size_t kMiscInfoStreamSize = sizeof(T);
|
||||
const size_t kFileSize = kMiscInfoStreamOffset + kMiscInfoStreamSize;
|
||||
|
||||
ASSERT_EQ(kFileSize, file_contents.size());
|
||||
ASSERT_EQ(file_contents.size(), kFileSize);
|
||||
|
||||
const MINIDUMP_DIRECTORY* directory;
|
||||
const MINIDUMP_HEADER* header =
|
||||
@@ -57,8 +57,8 @@ void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) {
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeMiscInfo, directory[0].StreamType);
|
||||
EXPECT_EQ(kMiscInfoStreamOffset, directory[0].Location.Rva);
|
||||
ASSERT_EQ(directory[0].StreamType, kMinidumpStreamTypeMiscInfo);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kMiscInfoStreamOffset);
|
||||
|
||||
*misc_info = MinidumpWritableAtLocationDescriptor<T>(file_contents,
|
||||
directory[0].Location);
|
||||
@@ -70,19 +70,19 @@ void ExpectNULPaddedString16Equal(const base::char16* expected,
|
||||
size_t size) {
|
||||
base::string16 expected_string(expected, size);
|
||||
base::string16 observed_string(observed, size);
|
||||
EXPECT_EQ(expected_string, observed_string);
|
||||
EXPECT_EQ(observed_string, expected_string);
|
||||
}
|
||||
|
||||
void ExpectSystemTimeEqual(const SYSTEMTIME* expected,
|
||||
const SYSTEMTIME* observed) {
|
||||
EXPECT_EQ(expected->wYear, observed->wYear);
|
||||
EXPECT_EQ(expected->wMonth, observed->wMonth);
|
||||
EXPECT_EQ(expected->wDayOfWeek, observed->wDayOfWeek);
|
||||
EXPECT_EQ(expected->wDay, observed->wDay);
|
||||
EXPECT_EQ(expected->wHour, observed->wHour);
|
||||
EXPECT_EQ(expected->wMinute, observed->wMinute);
|
||||
EXPECT_EQ(expected->wSecond, observed->wSecond);
|
||||
EXPECT_EQ(expected->wMilliseconds, observed->wMilliseconds);
|
||||
EXPECT_EQ(observed->wYear, expected->wYear);
|
||||
EXPECT_EQ(observed->wMonth, expected->wMonth);
|
||||
EXPECT_EQ(observed->wDayOfWeek, expected->wDayOfWeek);
|
||||
EXPECT_EQ(observed->wDay, expected->wDay);
|
||||
EXPECT_EQ(observed->wHour, expected->wHour);
|
||||
EXPECT_EQ(observed->wMinute, expected->wMinute);
|
||||
EXPECT_EQ(observed->wSecond, expected->wSecond);
|
||||
EXPECT_EQ(observed->wMilliseconds, expected->wMilliseconds);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -92,11 +92,11 @@ template <>
|
||||
void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO>(
|
||||
const MINIDUMP_MISC_INFO* expected,
|
||||
const MINIDUMP_MISC_INFO* observed) {
|
||||
EXPECT_EQ(expected->Flags1, observed->Flags1);
|
||||
EXPECT_EQ(expected->ProcessId, observed->ProcessId);
|
||||
EXPECT_EQ(expected->ProcessCreateTime, observed->ProcessCreateTime);
|
||||
EXPECT_EQ(expected->ProcessUserTime, observed->ProcessUserTime);
|
||||
EXPECT_EQ(expected->ProcessKernelTime, observed->ProcessKernelTime);
|
||||
EXPECT_EQ(observed->Flags1, expected->Flags1);
|
||||
EXPECT_EQ(observed->ProcessId, expected->ProcessId);
|
||||
EXPECT_EQ(observed->ProcessCreateTime, expected->ProcessCreateTime);
|
||||
EXPECT_EQ(observed->ProcessUserTime, expected->ProcessUserTime);
|
||||
EXPECT_EQ(observed->ProcessKernelTime, expected->ProcessKernelTime);
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -106,12 +106,12 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_2>(
|
||||
ExpectMiscInfoEqual<MINIDUMP_MISC_INFO>(
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO*>(expected),
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO*>(observed));
|
||||
EXPECT_EQ(expected->ProcessorMaxMhz, observed->ProcessorMaxMhz);
|
||||
EXPECT_EQ(expected->ProcessorCurrentMhz, observed->ProcessorCurrentMhz);
|
||||
EXPECT_EQ(expected->ProcessorMhzLimit, observed->ProcessorMhzLimit);
|
||||
EXPECT_EQ(expected->ProcessorMaxIdleState, observed->ProcessorMaxIdleState);
|
||||
EXPECT_EQ(expected->ProcessorCurrentIdleState,
|
||||
observed->ProcessorCurrentIdleState);
|
||||
EXPECT_EQ(observed->ProcessorMaxMhz, expected->ProcessorMaxMhz);
|
||||
EXPECT_EQ(observed->ProcessorCurrentMhz, expected->ProcessorCurrentMhz);
|
||||
EXPECT_EQ(observed->ProcessorMhzLimit, expected->ProcessorMhzLimit);
|
||||
EXPECT_EQ(observed->ProcessorMaxIdleState, expected->ProcessorMaxIdleState);
|
||||
EXPECT_EQ(observed->ProcessorCurrentIdleState,
|
||||
expected->ProcessorCurrentIdleState);
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -121,11 +121,11 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_3>(
|
||||
ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_2>(
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO_2*>(expected),
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO_2*>(observed));
|
||||
EXPECT_EQ(expected->ProcessIntegrityLevel, observed->ProcessIntegrityLevel);
|
||||
EXPECT_EQ(expected->ProcessExecuteFlags, observed->ProcessExecuteFlags);
|
||||
EXPECT_EQ(expected->ProtectedProcess, observed->ProtectedProcess);
|
||||
EXPECT_EQ(expected->TimeZoneId, observed->TimeZoneId);
|
||||
EXPECT_EQ(expected->TimeZone.Bias, observed->TimeZone.Bias);
|
||||
EXPECT_EQ(observed->ProcessIntegrityLevel, expected->ProcessIntegrityLevel);
|
||||
EXPECT_EQ(observed->ProcessExecuteFlags, expected->ProcessExecuteFlags);
|
||||
EXPECT_EQ(observed->ProtectedProcess, expected->ProtectedProcess);
|
||||
EXPECT_EQ(observed->TimeZoneId, expected->TimeZoneId);
|
||||
EXPECT_EQ(observed->TimeZone.Bias, expected->TimeZone.Bias);
|
||||
{
|
||||
SCOPED_TRACE("Standard");
|
||||
ExpectNULPaddedString16Equal(expected->TimeZone.StandardName,
|
||||
@@ -133,7 +133,7 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_3>(
|
||||
arraysize(expected->TimeZone.StandardName));
|
||||
ExpectSystemTimeEqual(&expected->TimeZone.StandardDate,
|
||||
&observed->TimeZone.StandardDate);
|
||||
EXPECT_EQ(expected->TimeZone.StandardBias, observed->TimeZone.StandardBias);
|
||||
EXPECT_EQ(observed->TimeZone.StandardBias, expected->TimeZone.StandardBias);
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("Daylight");
|
||||
@@ -142,7 +142,7 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_3>(
|
||||
arraysize(expected->TimeZone.DaylightName));
|
||||
ExpectSystemTimeEqual(&expected->TimeZone.DaylightDate,
|
||||
&observed->TimeZone.DaylightDate);
|
||||
EXPECT_EQ(expected->TimeZone.DaylightBias, observed->TimeZone.DaylightBias);
|
||||
EXPECT_EQ(observed->TimeZone.DaylightBias, expected->TimeZone.DaylightBias);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,20 +174,20 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_5>(
|
||||
ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_4>(
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO_4*>(expected),
|
||||
reinterpret_cast<const MINIDUMP_MISC_INFO_4*>(observed));
|
||||
EXPECT_EQ(expected->XStateData.SizeOfInfo, observed->XStateData.SizeOfInfo);
|
||||
EXPECT_EQ(expected->XStateData.ContextSize, observed->XStateData.ContextSize);
|
||||
EXPECT_EQ(expected->XStateData.EnabledFeatures,
|
||||
observed->XStateData.EnabledFeatures);
|
||||
EXPECT_EQ(observed->XStateData.SizeOfInfo, expected->XStateData.SizeOfInfo);
|
||||
EXPECT_EQ(observed->XStateData.ContextSize, expected->XStateData.ContextSize);
|
||||
EXPECT_EQ(observed->XStateData.EnabledFeatures,
|
||||
expected->XStateData.EnabledFeatures);
|
||||
for (size_t feature_index = 0;
|
||||
feature_index < arraysize(observed->XStateData.Features);
|
||||
++feature_index) {
|
||||
SCOPED_TRACE(base::StringPrintf("feature_index %" PRIuS, feature_index));
|
||||
EXPECT_EQ(expected->XStateData.Features[feature_index].Offset,
|
||||
observed->XStateData.Features[feature_index].Offset);
|
||||
EXPECT_EQ(expected->XStateData.Features[feature_index].Size,
|
||||
observed->XStateData.Features[feature_index].Size);
|
||||
EXPECT_EQ(observed->XStateData.Features[feature_index].Offset,
|
||||
expected->XStateData.Features[feature_index].Offset);
|
||||
EXPECT_EQ(observed->XStateData.Features[feature_index].Size,
|
||||
expected->XStateData.Features[feature_index].Size);
|
||||
}
|
||||
EXPECT_EQ(expected->ProcessCookie, observed->ProcessCookie);
|
||||
EXPECT_EQ(observed->ProcessCookie, expected->ProcessCookie);
|
||||
}
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, Empty) {
|
||||
|
||||
@@ -50,7 +50,7 @@ const MinidumpModuleCrashpadInfoList* MinidumpModuleCrashpadInfoListAtStart(
|
||||
}
|
||||
|
||||
if (list->count != count) {
|
||||
EXPECT_EQ(count, list->count);
|
||||
EXPECT_EQ(list->count, count);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyList) {
|
||||
EXPECT_FALSE(module_list_writer->IsUseful());
|
||||
|
||||
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpModuleCrashpadInfoList),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpModuleCrashpadInfoList));
|
||||
|
||||
const MinidumpModuleCrashpadInfoList* module_list =
|
||||
MinidumpModuleCrashpadInfoListAtStart(string_file.string(), 0);
|
||||
@@ -85,26 +85,26 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) {
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
||||
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpModuleCrashpadInfoList) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpModuleCrashpadInfoList) +
|
||||
sizeof(MinidumpModuleCrashpadInfoLink) +
|
||||
sizeof(MinidumpModuleCrashpadInfo),
|
||||
string_file.string().size());
|
||||
sizeof(MinidumpModuleCrashpadInfo));
|
||||
|
||||
const MinidumpModuleCrashpadInfoList* module_list =
|
||||
MinidumpModuleCrashpadInfoListAtStart(string_file.string(), 1);
|
||||
ASSERT_TRUE(module_list);
|
||||
|
||||
EXPECT_EQ(0u, module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index, 0u);
|
||||
const MinidumpModuleCrashpadInfo* module =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version);
|
||||
EXPECT_EQ(0u, module->list_annotations.DataSize);
|
||||
EXPECT_EQ(0u, module->list_annotations.Rva);
|
||||
EXPECT_EQ(0u, module->simple_annotations.DataSize);
|
||||
EXPECT_EQ(0u, module->simple_annotations.Rva);
|
||||
EXPECT_EQ(module->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
EXPECT_EQ(module->list_annotations.DataSize, 0u);
|
||||
EXPECT_EQ(module->list_annotations.Rva, 0u);
|
||||
EXPECT_EQ(module->simple_annotations.DataSize, 0u);
|
||||
EXPECT_EQ(module->simple_annotations.Rva, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||
@@ -140,7 +140,8 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
||||
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpModuleCrashpadInfoList) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpModuleCrashpadInfoList) +
|
||||
sizeof(MinidumpModuleCrashpadInfoLink) +
|
||||
sizeof(MinidumpModuleCrashpadInfo) +
|
||||
sizeof(MinidumpRVAList) +
|
||||
@@ -149,48 +150,47 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||
sizeof(MinidumpSimpleStringDictionaryEntry) +
|
||||
sizeof(MinidumpUTF8String) + arraysize(kEntry) + 2 + // padding
|
||||
sizeof(MinidumpUTF8String) + arraysize(kKey) +
|
||||
sizeof(MinidumpUTF8String) + arraysize(kValue),
|
||||
string_file.string().size());
|
||||
sizeof(MinidumpUTF8String) + arraysize(kValue));
|
||||
|
||||
const MinidumpModuleCrashpadInfoList* module_list =
|
||||
MinidumpModuleCrashpadInfoListAtStart(string_file.string(), 1);
|
||||
ASSERT_TRUE(module_list);
|
||||
|
||||
EXPECT_EQ(kMinidumpModuleListIndex,
|
||||
module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index,
|
||||
kMinidumpModuleListIndex);
|
||||
const MinidumpModuleCrashpadInfo* module =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version);
|
||||
EXPECT_NE(0u, module->list_annotations.DataSize);
|
||||
EXPECT_NE(0u, module->list_annotations.Rva);
|
||||
EXPECT_NE(0u, module->simple_annotations.DataSize);
|
||||
EXPECT_NE(0u, module->simple_annotations.Rva);
|
||||
EXPECT_EQ(module->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
EXPECT_NE(module->list_annotations.DataSize, 0u);
|
||||
EXPECT_NE(module->list_annotations.Rva, 0u);
|
||||
EXPECT_NE(module->simple_annotations.DataSize, 0u);
|
||||
EXPECT_NE(module->simple_annotations.Rva, 0u);
|
||||
|
||||
const MinidumpRVAList* list_annotations =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
string_file.string(), module->list_annotations);
|
||||
ASSERT_TRUE(list_annotations);
|
||||
|
||||
ASSERT_EQ(1u, list_annotations->count);
|
||||
EXPECT_EQ(kEntry,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations->children[0]));
|
||||
ASSERT_EQ(list_annotations->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations->children[0]),
|
||||
kEntry);
|
||||
|
||||
const MinidumpSimpleStringDictionary* simple_annotations =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>(
|
||||
string_file.string(), module->simple_annotations);
|
||||
ASSERT_TRUE(simple_annotations);
|
||||
|
||||
ASSERT_EQ(1u, simple_annotations->count);
|
||||
EXPECT_EQ(kKey,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].key));
|
||||
EXPECT_EQ(kValue,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value));
|
||||
ASSERT_EQ(simple_annotations->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
simple_annotations->entries[0].key),
|
||||
kKey);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations->entries[0].value),
|
||||
kValue);
|
||||
}
|
||||
|
||||
TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
@@ -258,14 +258,14 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
MinidumpModuleCrashpadInfoListAtStart(string_file.string(), 3);
|
||||
ASSERT_TRUE(module_list);
|
||||
|
||||
EXPECT_EQ(kMinidumpModuleListIndex0,
|
||||
module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index,
|
||||
kMinidumpModuleListIndex0);
|
||||
const MinidumpModuleCrashpadInfo* module_0 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module_0);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version);
|
||||
EXPECT_EQ(module_0->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_0 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
@@ -277,22 +277,22 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
string_file.string(), module_0->simple_annotations);
|
||||
ASSERT_TRUE(simple_annotations_0);
|
||||
|
||||
ASSERT_EQ(1u, simple_annotations_0->count);
|
||||
EXPECT_EQ(kKey0,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].key));
|
||||
EXPECT_EQ(kValue0,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].value));
|
||||
ASSERT_EQ(simple_annotations_0->count, 1u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].key),
|
||||
kKey0);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].value),
|
||||
kValue0);
|
||||
|
||||
EXPECT_EQ(kMinidumpModuleListIndex1,
|
||||
module_list->modules[1].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[1].minidump_module_list_index,
|
||||
kMinidumpModuleListIndex1);
|
||||
const MinidumpModuleCrashpadInfo* module_1 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[1].location);
|
||||
ASSERT_TRUE(module_1);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_1->version);
|
||||
EXPECT_EQ(module_1->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_1 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
@@ -304,14 +304,14 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
string_file.string(), module_1->simple_annotations);
|
||||
EXPECT_FALSE(simple_annotations_1);
|
||||
|
||||
EXPECT_EQ(kMinidumpModuleListIndex2,
|
||||
module_list->modules[2].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[2].minidump_module_list_index,
|
||||
kMinidumpModuleListIndex2);
|
||||
const MinidumpModuleCrashpadInfo* module_2 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[2].location);
|
||||
ASSERT_TRUE(module_2);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version);
|
||||
EXPECT_EQ(module_2->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_2 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
@@ -323,19 +323,19 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
string_file.string(), module_2->simple_annotations);
|
||||
ASSERT_TRUE(simple_annotations_2);
|
||||
|
||||
ASSERT_EQ(2u, simple_annotations_2->count);
|
||||
EXPECT_EQ(kKey2A,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].key));
|
||||
EXPECT_EQ(kValue2A,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].value));
|
||||
EXPECT_EQ(kKey2B,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[1].key));
|
||||
EXPECT_EQ(kValue2B,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[1].value));
|
||||
ASSERT_EQ(simple_annotations_2->count, 2u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].key),
|
||||
kKey2A);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].value),
|
||||
kValue2A);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[1].key),
|
||||
kKey2B);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[1].value),
|
||||
kValue2B);
|
||||
}
|
||||
|
||||
TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
@@ -387,13 +387,13 @@ TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
MinidumpModuleCrashpadInfoListAtStart(string_file.string(), 3);
|
||||
ASSERT_TRUE(module_list);
|
||||
|
||||
EXPECT_EQ(0u, module_list->modules[0].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[0].minidump_module_list_index, 0u);
|
||||
const MinidumpModuleCrashpadInfo* module_0 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[0].location);
|
||||
ASSERT_TRUE(module_0);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version);
|
||||
EXPECT_EQ(module_0->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_0 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
@@ -405,27 +405,27 @@ TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
string_file.string(), module_0->simple_annotations);
|
||||
ASSERT_TRUE(simple_annotations_0);
|
||||
|
||||
ASSERT_EQ(annotations_simple_map_0.size(), simple_annotations_0->count);
|
||||
EXPECT_EQ(kKey0B,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].key));
|
||||
EXPECT_EQ(kValue0B,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].value));
|
||||
EXPECT_EQ(kKey0A,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[1].key));
|
||||
EXPECT_EQ(kValue0A,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[1].value));
|
||||
ASSERT_EQ(simple_annotations_0->count, annotations_simple_map_0.size());
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].key),
|
||||
kKey0B);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[0].value),
|
||||
kValue0B);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[1].key),
|
||||
kKey0A);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_0->entries[1].value),
|
||||
kValue0A);
|
||||
|
||||
EXPECT_EQ(2u, module_list->modules[1].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[1].minidump_module_list_index, 2u);
|
||||
const MinidumpModuleCrashpadInfo* module_2 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[1].location);
|
||||
ASSERT_TRUE(module_2);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version);
|
||||
EXPECT_EQ(module_2->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_2 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
@@ -437,34 +437,34 @@ TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
string_file.string(), module_2->simple_annotations);
|
||||
ASSERT_TRUE(simple_annotations_2);
|
||||
|
||||
ASSERT_EQ(annotations_simple_map_2.size(), simple_annotations_2->count);
|
||||
EXPECT_EQ(kKey2,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].key));
|
||||
EXPECT_EQ(kValue2,
|
||||
MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].value));
|
||||
ASSERT_EQ(simple_annotations_2->count, annotations_simple_map_2.size());
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].key),
|
||||
kKey2);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(
|
||||
string_file.string(), simple_annotations_2->entries[0].value),
|
||||
kValue2);
|
||||
|
||||
EXPECT_EQ(3u, module_list->modules[2].minidump_module_list_index);
|
||||
EXPECT_EQ(module_list->modules[2].minidump_module_list_index, 3u);
|
||||
const MinidumpModuleCrashpadInfo* module_3 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
|
||||
string_file.string(), module_list->modules[2].location);
|
||||
ASSERT_TRUE(module_3);
|
||||
|
||||
EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_3->version);
|
||||
EXPECT_EQ(module_3->version, MinidumpModuleCrashpadInfo::kVersion);
|
||||
|
||||
const MinidumpRVAList* list_annotations_3 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpRVAList>(
|
||||
string_file.string(), module_3->list_annotations);
|
||||
ASSERT_TRUE(list_annotations_3);
|
||||
|
||||
ASSERT_EQ(annotations_vector_3.size(), list_annotations_3->count);
|
||||
EXPECT_EQ(kEntry3A,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations_3->children[0]));
|
||||
EXPECT_EQ(kEntry3B,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations_3->children[1]));
|
||||
ASSERT_EQ(list_annotations_3->count, annotations_vector_3.size());
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations_3->children[0]),
|
||||
kEntry3A);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
list_annotations_3->children[1]),
|
||||
kEntry3B);
|
||||
|
||||
const MinidumpSimpleStringDictionary* simple_annotations_3 =
|
||||
MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>(
|
||||
|
||||
@@ -56,8 +56,8 @@ void GetModuleListStream(const std::string& file_contents,
|
||||
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
|
||||
ASSERT_TRUE(directory);
|
||||
|
||||
ASSERT_EQ(kMinidumpStreamTypeModuleList, directory[0].StreamType);
|
||||
EXPECT_EQ(kModuleListStreamOffset, directory[0].Location.Rva);
|
||||
ASSERT_EQ(directory[0].StreamType, kMinidumpStreamTypeModuleList);
|
||||
EXPECT_EQ(directory[0].Location.Rva, kModuleListStreamOffset);
|
||||
|
||||
*module_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
|
||||
file_contents, directory[0].Location);
|
||||
@@ -73,15 +73,15 @@ TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
||||
ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MODULE_LIST),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
|
||||
sizeof(MINIDUMP_MODULE_LIST));
|
||||
|
||||
const MINIDUMP_MODULE_LIST* module_list = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
EXPECT_EQ(0u, module_list->NumberOfModules);
|
||||
EXPECT_EQ(module_list->NumberOfModules, 0u);
|
||||
}
|
||||
|
||||
// If |expected_pdb_name| is not nullptr, |codeview_record| is used to locate a
|
||||
@@ -96,7 +96,7 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
time_t expected_pdb_timestamp,
|
||||
uint32_t expected_pdb_age) {
|
||||
if (expected_pdb_name) {
|
||||
EXPECT_NE(0u, codeview_record->Rva);
|
||||
EXPECT_NE(codeview_record->Rva, 0u);
|
||||
|
||||
std::string observed_pdb_name;
|
||||
if (expected_pdb_uuid) {
|
||||
@@ -105,11 +105,11 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
MinidumpWritableAtLocationDescriptor<CodeViewRecordPDB70>(
|
||||
file_contents, *codeview_record);
|
||||
ASSERT_TRUE(codeview_pdb70_record);
|
||||
EXPECT_EQ(0,
|
||||
memcmp(expected_pdb_uuid,
|
||||
EXPECT_EQ(memcmp(expected_pdb_uuid,
|
||||
&codeview_pdb70_record->uuid,
|
||||
sizeof(codeview_pdb70_record->uuid)));
|
||||
EXPECT_EQ(expected_pdb_age, codeview_pdb70_record->age);
|
||||
sizeof(codeview_pdb70_record->uuid)),
|
||||
0);
|
||||
EXPECT_EQ(codeview_pdb70_record->age, expected_pdb_age);
|
||||
|
||||
observed_pdb_name.assign(
|
||||
reinterpret_cast<const char*>(&codeview_pdb70_record->pdb_name[0]),
|
||||
@@ -120,9 +120,9 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
MinidumpWritableAtLocationDescriptor<CodeViewRecordPDB20>(
|
||||
file_contents, *codeview_record);
|
||||
ASSERT_TRUE(codeview_pdb20_record);
|
||||
EXPECT_EQ(static_cast<uint32_t>(expected_pdb_timestamp),
|
||||
codeview_pdb20_record->timestamp);
|
||||
EXPECT_EQ(expected_pdb_age, codeview_pdb20_record->age);
|
||||
EXPECT_EQ(codeview_pdb20_record->timestamp,
|
||||
static_cast<uint32_t>(expected_pdb_timestamp));
|
||||
EXPECT_EQ(codeview_pdb20_record->age, expected_pdb_age);
|
||||
|
||||
observed_pdb_name.assign(
|
||||
reinterpret_cast<const char*>(&codeview_pdb20_record->pdb_name[0]),
|
||||
@@ -130,14 +130,14 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
}
|
||||
|
||||
// Check for, and then remove, the NUL terminator.
|
||||
EXPECT_EQ('\0', observed_pdb_name[observed_pdb_name.size() - 1]);
|
||||
EXPECT_EQ(observed_pdb_name[observed_pdb_name.size() - 1], '\0');
|
||||
observed_pdb_name.resize(observed_pdb_name.size() - 1);
|
||||
|
||||
EXPECT_EQ(expected_pdb_name, observed_pdb_name);
|
||||
EXPECT_EQ(observed_pdb_name, expected_pdb_name);
|
||||
} else {
|
||||
// There should be no CodeView record.
|
||||
EXPECT_EQ(0u, codeview_record->DataSize);
|
||||
EXPECT_EQ(0u, codeview_record->Rva);
|
||||
EXPECT_EQ(codeview_record->DataSize, 0u);
|
||||
EXPECT_EQ(codeview_record->Rva, 0u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,21 +152,21 @@ void ExpectMiscellaneousDebugRecord(
|
||||
uint32_t expected_debug_type,
|
||||
bool expected_debug_utf16) {
|
||||
if (expected_debug_name) {
|
||||
EXPECT_NE(0u, misc_record->Rva);
|
||||
EXPECT_NE(misc_record->Rva, 0u);
|
||||
const IMAGE_DEBUG_MISC* misc_debug_record =
|
||||
MinidumpWritableAtLocationDescriptor<IMAGE_DEBUG_MISC>(file_contents,
|
||||
*misc_record);
|
||||
ASSERT_TRUE(misc_debug_record);
|
||||
EXPECT_EQ(expected_debug_type, misc_debug_record->DataType);
|
||||
EXPECT_EQ(expected_debug_utf16, misc_debug_record->Unicode != 0);
|
||||
EXPECT_EQ(0u, misc_debug_record->Reserved[0]);
|
||||
EXPECT_EQ(0u, misc_debug_record->Reserved[1]);
|
||||
EXPECT_EQ(0u, misc_debug_record->Reserved[2]);
|
||||
EXPECT_EQ(misc_debug_record->DataType, expected_debug_type);
|
||||
EXPECT_EQ(misc_debug_record->Unicode != 0, expected_debug_utf16);
|
||||
EXPECT_EQ(misc_debug_record->Reserved[0], 0u);
|
||||
EXPECT_EQ(misc_debug_record->Reserved[1], 0u);
|
||||
EXPECT_EQ(misc_debug_record->Reserved[2], 0u);
|
||||
|
||||
// Check for the NUL terminator.
|
||||
size_t bytes_available =
|
||||
misc_debug_record->Length - offsetof(IMAGE_DEBUG_MISC, Data);
|
||||
EXPECT_EQ('\0', misc_debug_record->Data[bytes_available - 1]);
|
||||
EXPECT_EQ(misc_debug_record->Data[bytes_available - 1], '\0');
|
||||
std::string observed_data(
|
||||
reinterpret_cast<const char*>(misc_debug_record->Data));
|
||||
|
||||
@@ -184,14 +184,14 @@ void ExpectMiscellaneousDebugRecord(
|
||||
|
||||
// Make sure that any padding bytes after the first NUL are also NUL.
|
||||
for (size_t index = bytes_used; index < bytes_available; ++index) {
|
||||
EXPECT_EQ('\0', misc_debug_record->Data[index]);
|
||||
EXPECT_EQ(misc_debug_record->Data[index], '\0');
|
||||
}
|
||||
|
||||
EXPECT_EQ(expected_debug_name, observed_data);
|
||||
EXPECT_EQ(observed_data, expected_debug_name);
|
||||
} else {
|
||||
// There should be no miscellaneous debugging record.
|
||||
EXPECT_EQ(0u, misc_record->DataSize);
|
||||
EXPECT_EQ(0u, misc_record->Rva);
|
||||
EXPECT_EQ(misc_record->DataSize, 0u);
|
||||
EXPECT_EQ(misc_record->Rva, 0u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,43 +215,43 @@ void ExpectModule(const MINIDUMP_MODULE* expected,
|
||||
const char* expected_debug_name,
|
||||
uint32_t expected_debug_type,
|
||||
bool expected_debug_utf16) {
|
||||
EXPECT_EQ(expected->BaseOfImage, observed->BaseOfImage);
|
||||
EXPECT_EQ(expected->SizeOfImage, observed->SizeOfImage);
|
||||
EXPECT_EQ(expected->CheckSum, observed->CheckSum);
|
||||
EXPECT_EQ(expected->TimeDateStamp, observed->TimeDateStamp);
|
||||
EXPECT_EQ(implicit_cast<uint32_t>(VS_FFI_SIGNATURE),
|
||||
observed->VersionInfo.dwSignature);
|
||||
EXPECT_EQ(implicit_cast<uint32_t>(VS_FFI_STRUCVERSION),
|
||||
observed->VersionInfo.dwStrucVersion);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileVersionMS,
|
||||
observed->VersionInfo.dwFileVersionMS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileVersionLS,
|
||||
observed->VersionInfo.dwFileVersionLS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwProductVersionMS,
|
||||
observed->VersionInfo.dwProductVersionMS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwProductVersionLS,
|
||||
observed->VersionInfo.dwProductVersionLS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileFlagsMask,
|
||||
observed->VersionInfo.dwFileFlagsMask);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileFlags,
|
||||
observed->VersionInfo.dwFileFlags);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileOS, observed->VersionInfo.dwFileOS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileType, observed->VersionInfo.dwFileType);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileSubtype,
|
||||
observed->VersionInfo.dwFileSubtype);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileDateMS,
|
||||
observed->VersionInfo.dwFileDateMS);
|
||||
EXPECT_EQ(expected->VersionInfo.dwFileDateLS,
|
||||
observed->VersionInfo.dwFileDateLS);
|
||||
EXPECT_EQ(0u, observed->Reserved0);
|
||||
EXPECT_EQ(0u, observed->Reserved1);
|
||||
EXPECT_EQ(observed->BaseOfImage, expected->BaseOfImage);
|
||||
EXPECT_EQ(observed->SizeOfImage, expected->SizeOfImage);
|
||||
EXPECT_EQ(observed->CheckSum, expected->CheckSum);
|
||||
EXPECT_EQ(observed->TimeDateStamp, expected->TimeDateStamp);
|
||||
EXPECT_EQ(observed->VersionInfo.dwSignature,
|
||||
implicit_cast<uint32_t>(VS_FFI_SIGNATURE));
|
||||
EXPECT_EQ(observed->VersionInfo.dwStrucVersion,
|
||||
implicit_cast<uint32_t>(VS_FFI_STRUCVERSION));
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileVersionMS,
|
||||
expected->VersionInfo.dwFileVersionMS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileVersionLS,
|
||||
expected->VersionInfo.dwFileVersionLS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwProductVersionMS,
|
||||
expected->VersionInfo.dwProductVersionMS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwProductVersionLS,
|
||||
expected->VersionInfo.dwProductVersionLS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileFlagsMask,
|
||||
expected->VersionInfo.dwFileFlagsMask);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileFlags,
|
||||
expected->VersionInfo.dwFileFlags);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileOS, expected->VersionInfo.dwFileOS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileType, expected->VersionInfo.dwFileType);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileSubtype,
|
||||
expected->VersionInfo.dwFileSubtype);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileDateMS,
|
||||
expected->VersionInfo.dwFileDateMS);
|
||||
EXPECT_EQ(observed->VersionInfo.dwFileDateLS,
|
||||
expected->VersionInfo.dwFileDateLS);
|
||||
EXPECT_EQ(observed->Reserved0, 0u);
|
||||
EXPECT_EQ(observed->Reserved1, 0u);
|
||||
|
||||
EXPECT_NE(0u, observed->ModuleNameRva);
|
||||
EXPECT_NE(observed->ModuleNameRva, 0u);
|
||||
base::string16 observed_module_name_utf16 =
|
||||
MinidumpStringAtRVAAsString(file_contents, observed->ModuleNameRva);
|
||||
base::string16 expected_module_name_utf16 =
|
||||
base::UTF8ToUTF16(expected_module_name);
|
||||
EXPECT_EQ(expected_module_name_utf16, observed_module_name_utf16);
|
||||
EXPECT_EQ(observed_module_name_utf16, expected_module_name_utf16);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(ExpectCodeViewRecord(&observed->CvRecord,
|
||||
file_contents,
|
||||
@@ -290,7 +290,7 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
EXPECT_EQ(1u, module_list->NumberOfModules);
|
||||
EXPECT_EQ(module_list->NumberOfModules, 1u);
|
||||
|
||||
MINIDUMP_MODULE expected = {};
|
||||
ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
|
||||
@@ -381,7 +381,7 @@ TEST(MinidumpModuleWriter, OneModule) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
EXPECT_EQ(1u, module_list->NumberOfModules);
|
||||
EXPECT_EQ(module_list->NumberOfModules, 1u);
|
||||
|
||||
MINIDUMP_MODULE expected = {};
|
||||
expected.BaseOfImage = kModuleBase;
|
||||
@@ -456,7 +456,7 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
EXPECT_EQ(1u, module_list->NumberOfModules);
|
||||
EXPECT_EQ(module_list->NumberOfModules, 1u);
|
||||
|
||||
MINIDUMP_MODULE expected = {};
|
||||
|
||||
@@ -548,7 +548,7 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
EXPECT_EQ(3u, module_list->NumberOfModules);
|
||||
EXPECT_EQ(module_list->NumberOfModules, 3u);
|
||||
|
||||
MINIDUMP_MODULE expected = {};
|
||||
|
||||
@@ -733,7 +733,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetModuleListStream(string_file.string(), &module_list));
|
||||
|
||||
ASSERT_EQ(3u, module_list->NumberOfModules);
|
||||
ASSERT_EQ(module_list->NumberOfModules, 3u);
|
||||
|
||||
for (size_t index = 0; index < module_list->NumberOfModules; ++index) {
|
||||
SCOPED_TRACE(base::StringPrintf("index %" PRIuS, index));
|
||||
|
||||
@@ -48,7 +48,7 @@ TEST(MinidumpRVAListWriter, Empty) {
|
||||
StringFile string_file;
|
||||
|
||||
ASSERT_TRUE(list_writer.WriteEverything(&string_file));
|
||||
EXPECT_EQ(sizeof(MinidumpRVAList), string_file.string().size());
|
||||
EXPECT_EQ(string_file.string().size(), sizeof(MinidumpRVAList));
|
||||
|
||||
const MinidumpRVAList* list = MinidumpRVAListAtStart(string_file.string(), 0);
|
||||
ASSERT_TRUE(list);
|
||||
@@ -70,7 +70,7 @@ TEST(MinidumpRVAListWriter, OneChild) {
|
||||
const uint32_t* child = MinidumpWritableAtRVA<uint32_t>(
|
||||
string_file.string(), list->children[0]);
|
||||
ASSERT_TRUE(child);
|
||||
EXPECT_EQ(kValue, *child);
|
||||
EXPECT_EQ(*child, kValue);
|
||||
}
|
||||
|
||||
TEST(MinidumpRVAListWriter, ThreeChildren) {
|
||||
@@ -96,7 +96,7 @@ TEST(MinidumpRVAListWriter, ThreeChildren) {
|
||||
const uint32_t* child = MinidumpWritableAtRVA<uint32_t>(
|
||||
string_file.string(), list->children[index]);
|
||||
ASSERT_TRUE(child);
|
||||
EXPECT_EQ(kValues[index], *child);
|
||||
EXPECT_EQ(*child, kValues[index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptySimpleStringDictionary) {
|
||||
EXPECT_FALSE(dictionary_writer.IsUseful());
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpSimpleStringDictionary),
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpSimpleStringDictionary));
|
||||
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), 0);
|
||||
ASSERT_TRUE(dictionary);
|
||||
EXPECT_EQ(0u, dictionary->count);
|
||||
EXPECT_EQ(dictionary->count, 0u);
|
||||
}
|
||||
|
||||
TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
||||
@@ -71,23 +71,23 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpSimpleStringDictionary) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpSimpleStringDictionary) +
|
||||
sizeof(MinidumpSimpleStringDictionaryEntry) +
|
||||
2 * sizeof(MinidumpUTF8String) + 1 + 3 + 1, // 3 for padding
|
||||
string_file.string().size());
|
||||
2 * sizeof(MinidumpUTF8String) + 1 + 3 + 1); // 3 for padding
|
||||
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), 1);
|
||||
ASSERT_TRUE(dictionary);
|
||||
EXPECT_EQ(1u, dictionary->count);
|
||||
EXPECT_EQ(12u, dictionary->entries[0].key);
|
||||
EXPECT_EQ(20u, dictionary->entries[0].value);
|
||||
EXPECT_EQ("",
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key));
|
||||
EXPECT_EQ("",
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value));
|
||||
EXPECT_EQ(dictionary->count, 1u);
|
||||
EXPECT_EQ(dictionary->entries[0].key, 12u);
|
||||
EXPECT_EQ(dictionary->entries[0].value, 20u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key),
|
||||
"");
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value),
|
||||
"");
|
||||
}
|
||||
|
||||
TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
||||
@@ -105,23 +105,23 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpSimpleStringDictionary) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpSimpleStringDictionary) +
|
||||
sizeof(MinidumpSimpleStringDictionaryEntry) +
|
||||
2 * sizeof(MinidumpUTF8String) + sizeof(kKey) + sizeof(kValue),
|
||||
string_file.string().size());
|
||||
2 * sizeof(MinidumpUTF8String) + sizeof(kKey) + sizeof(kValue));
|
||||
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), 1);
|
||||
ASSERT_TRUE(dictionary);
|
||||
EXPECT_EQ(1u, dictionary->count);
|
||||
EXPECT_EQ(12u, dictionary->entries[0].key);
|
||||
EXPECT_EQ(20u, dictionary->entries[0].value);
|
||||
EXPECT_EQ(kKey,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key));
|
||||
EXPECT_EQ(kValue,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value));
|
||||
EXPECT_EQ(dictionary->count, 1u);
|
||||
EXPECT_EQ(dictionary->entries[0].key, 12u);
|
||||
EXPECT_EQ(dictionary->entries[0].value, 20u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key),
|
||||
kKey);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value),
|
||||
kValue);
|
||||
}
|
||||
|
||||
TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||
@@ -151,23 +151,23 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpSimpleStringDictionary) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpSimpleStringDictionary) +
|
||||
3 * sizeof(MinidumpSimpleStringDictionaryEntry) +
|
||||
6 * sizeof(MinidumpUTF8String) + sizeof(kKey2) +
|
||||
sizeof(kValue2) + 3 + sizeof(kKey0) + 1 + sizeof(kValue0) + 1 +
|
||||
sizeof(kKey1) + 3 + sizeof(kValue1),
|
||||
string_file.string().size());
|
||||
sizeof(kKey1) + 3 + sizeof(kValue1));
|
||||
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), 3);
|
||||
ASSERT_TRUE(dictionary);
|
||||
EXPECT_EQ(3u, dictionary->count);
|
||||
EXPECT_EQ(28u, dictionary->entries[0].key);
|
||||
EXPECT_EQ(36u, dictionary->entries[0].value);
|
||||
EXPECT_EQ(48u, dictionary->entries[1].key);
|
||||
EXPECT_EQ(56u, dictionary->entries[1].value);
|
||||
EXPECT_EQ(68u, dictionary->entries[2].key);
|
||||
EXPECT_EQ(80u, dictionary->entries[2].value);
|
||||
EXPECT_EQ(dictionary->count, 3u);
|
||||
EXPECT_EQ(dictionary->entries[0].key, 28u);
|
||||
EXPECT_EQ(dictionary->entries[0].value, 36u);
|
||||
EXPECT_EQ(dictionary->entries[1].key, 48u);
|
||||
EXPECT_EQ(dictionary->entries[1].value, 56u);
|
||||
EXPECT_EQ(dictionary->entries[2].key, 68u);
|
||||
EXPECT_EQ(dictionary->entries[2].value, 80u);
|
||||
|
||||
// The entries don’t appear in the order they were added. The current
|
||||
// implementation uses a std::map and sorts keys, so the entires appear in
|
||||
@@ -175,24 +175,24 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||
// if the writer stops sorting in this order. Testing for a specific order is
|
||||
// just the easiest way to write this test while the writer will output things
|
||||
// in a known order.
|
||||
EXPECT_EQ(kKey2,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key));
|
||||
EXPECT_EQ(kValue2,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value));
|
||||
EXPECT_EQ(kKey0,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].key));
|
||||
EXPECT_EQ(kValue0,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].value));
|
||||
EXPECT_EQ(kKey1,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].key));
|
||||
EXPECT_EQ(kValue1,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].value));
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key),
|
||||
kKey2);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value),
|
||||
kValue2);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].key),
|
||||
kKey0);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].value),
|
||||
kValue0);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].key),
|
||||
kKey1);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].value),
|
||||
kValue1);
|
||||
}
|
||||
|
||||
TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
||||
@@ -215,23 +215,24 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(sizeof(MinidumpSimpleStringDictionary) +
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpSimpleStringDictionary) +
|
||||
sizeof(MinidumpSimpleStringDictionaryEntry) +
|
||||
2 * sizeof(MinidumpUTF8String) + sizeof(kKey) + sizeof(kValue1),
|
||||
string_file.string().size());
|
||||
2 * sizeof(MinidumpUTF8String) + sizeof(kKey) +
|
||||
sizeof(kValue1));
|
||||
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), 1);
|
||||
ASSERT_TRUE(dictionary);
|
||||
EXPECT_EQ(1u, dictionary->count);
|
||||
EXPECT_EQ(12u, dictionary->entries[0].key);
|
||||
EXPECT_EQ(20u, dictionary->entries[0].value);
|
||||
EXPECT_EQ(kKey,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key));
|
||||
EXPECT_EQ(kValue1,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value));
|
||||
EXPECT_EQ(dictionary->count, 1u);
|
||||
EXPECT_EQ(dictionary->entries[0].key, 12u);
|
||||
EXPECT_EQ(dictionary->entries[0].value, 20u);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key),
|
||||
kKey);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value),
|
||||
kValue1);
|
||||
}
|
||||
|
||||
TEST(MinidumpSimpleStringDictionaryWriter, InitializeFromMap) {
|
||||
@@ -258,7 +259,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, InitializeFromMap) {
|
||||
const MinidumpSimpleStringDictionary* dictionary =
|
||||
MinidumpSimpleStringDictionaryAtStart(string_file.string(), map.size());
|
||||
ASSERT_TRUE(dictionary);
|
||||
ASSERT_EQ(3u, dictionary->count);
|
||||
ASSERT_EQ(dictionary->count, 3u);
|
||||
|
||||
// The entries don’t appear in the order they were added. The current
|
||||
// implementation uses a std::map and sorts keys, so the entires appear in
|
||||
@@ -266,24 +267,24 @@ TEST(MinidumpSimpleStringDictionaryWriter, InitializeFromMap) {
|
||||
// if the writer stops sorting in this order. Testing for a specific order is
|
||||
// just the easiest way to write this test while the writer will output things
|
||||
// in a known order.
|
||||
EXPECT_EQ(kKey1,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key));
|
||||
EXPECT_EQ(kValue1,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value));
|
||||
EXPECT_EQ(kKey0,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].key));
|
||||
EXPECT_EQ(kValue0,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].value));
|
||||
EXPECT_EQ(kKey2,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].key));
|
||||
EXPECT_EQ(kValue2,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].value));
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].key),
|
||||
kKey1);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[0].value),
|
||||
kValue1);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].key),
|
||||
kKey0);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[1].value),
|
||||
kValue0);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].key),
|
||||
kKey2);
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(),
|
||||
dictionary->entries[2].value),
|
||||
kValue2);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -40,13 +40,13 @@ TEST(MinidumpStringWriter, MinidumpUTF16StringWriter) {
|
||||
string_file.Reset();
|
||||
crashpad::internal::MinidumpUTF16StringWriter string_writer;
|
||||
EXPECT_TRUE(string_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(6u, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), 6u);
|
||||
|
||||
const MINIDUMP_STRING* minidump_string =
|
||||
MinidumpStringAtRVA(string_file.string(), 0);
|
||||
EXPECT_TRUE(minidump_string);
|
||||
EXPECT_EQ(base::string16(),
|
||||
MinidumpStringAtRVAAsString(string_file.string(), 0));
|
||||
EXPECT_EQ(MinidumpStringAtRVAAsString(string_file.string(), 0),
|
||||
base::string16());
|
||||
}
|
||||
|
||||
const struct {
|
||||
@@ -74,10 +74,9 @@ TEST(MinidumpStringWriter, MinidumpUTF16StringWriter) {
|
||||
|
||||
// Make sure that the expected output string with its NUL terminator fits in
|
||||
// the space provided.
|
||||
ASSERT_EQ(
|
||||
0,
|
||||
kTestData[index]
|
||||
.output_string[arraysize(kTestData[index].output_string) - 1]);
|
||||
ASSERT_EQ(kTestData[index]
|
||||
.output_string[arraysize(kTestData[index].output_string) - 1],
|
||||
0);
|
||||
|
||||
string_file.Reset();
|
||||
crashpad::internal::MinidumpUTF16StringWriter string_writer;
|
||||
@@ -91,16 +90,16 @@ TEST(MinidumpStringWriter, MinidumpUTF16StringWriter) {
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
const size_t expected_utf16_bytes =
|
||||
expected_utf16_units_with_nul * sizeof(tmp.Buffer[0]);
|
||||
ASSERT_EQ(sizeof(MINIDUMP_STRING) + expected_utf16_bytes,
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MINIDUMP_STRING) + expected_utf16_bytes);
|
||||
|
||||
const MINIDUMP_STRING* minidump_string =
|
||||
MinidumpStringAtRVA(string_file.string(), 0);
|
||||
EXPECT_TRUE(minidump_string);
|
||||
base::string16 expect_string = base::string16(
|
||||
kTestData[index].output_string, kTestData[index].output_length);
|
||||
EXPECT_EQ(expect_string,
|
||||
MinidumpStringAtRVAAsString(string_file.string(), 0));
|
||||
EXPECT_EQ(MinidumpStringAtRVAAsString(string_file.string(), 0),
|
||||
expect_string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,13 +133,13 @@ TEST(MinidumpStringWriter, ConvertInvalidUTF8ToUTF16) {
|
||||
EXPECT_TRUE(minidump_string);
|
||||
MINIDUMP_STRING tmp = {0};
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
EXPECT_EQ(string_file.string().size() - sizeof(MINIDUMP_STRING) -
|
||||
sizeof(tmp.Buffer[0]),
|
||||
minidump_string->Length);
|
||||
EXPECT_EQ(minidump_string->Length,
|
||||
string_file.string().size() - sizeof(MINIDUMP_STRING) -
|
||||
sizeof(tmp.Buffer[0]));
|
||||
base::string16 output_string =
|
||||
MinidumpStringAtRVAAsString(string_file.string(), 0);
|
||||
EXPECT_FALSE(output_string.empty());
|
||||
EXPECT_NE(base::string16::npos, output_string.find(0xfffd));
|
||||
EXPECT_NE(output_string.find(0xfffd), base::string16::npos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,13 +151,13 @@ TEST(MinidumpStringWriter, MinidumpUTF8StringWriter) {
|
||||
string_file.Reset();
|
||||
crashpad::internal::MinidumpUTF8StringWriter string_writer;
|
||||
EXPECT_TRUE(string_writer.WriteEverything(&string_file));
|
||||
ASSERT_EQ(5u, string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(), 5u);
|
||||
|
||||
const MinidumpUTF8String* minidump_string =
|
||||
MinidumpUTF8StringAtRVA(string_file.string(), 0);
|
||||
EXPECT_TRUE(minidump_string);
|
||||
EXPECT_EQ(std::string(),
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(), 0));
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(), 0),
|
||||
std::string());
|
||||
}
|
||||
|
||||
const struct {
|
||||
@@ -186,18 +185,18 @@ TEST(MinidumpStringWriter, MinidumpUTF8StringWriter) {
|
||||
crashpad::internal::MinidumpUTF8StringWriter string_writer;
|
||||
std::string test_string(kTestData[index].string, kTestData[index].length);
|
||||
string_writer.SetUTF8(test_string);
|
||||
EXPECT_EQ(test_string, string_writer.UTF8());
|
||||
EXPECT_EQ(string_writer.UTF8(), test_string);
|
||||
EXPECT_TRUE(string_writer.WriteEverything(&string_file));
|
||||
|
||||
const size_t expected_utf8_bytes_with_nul = kTestData[index].length + 1;
|
||||
ASSERT_EQ(sizeof(MinidumpUTF8String) + expected_utf8_bytes_with_nul,
|
||||
string_file.string().size());
|
||||
ASSERT_EQ(string_file.string().size(),
|
||||
sizeof(MinidumpUTF8String) + expected_utf8_bytes_with_nul);
|
||||
|
||||
const MinidumpUTF8String* minidump_string =
|
||||
MinidumpUTF8StringAtRVA(string_file.string(), 0);
|
||||
EXPECT_TRUE(minidump_string);
|
||||
EXPECT_EQ(test_string,
|
||||
MinidumpUTF8StringAtRVAAsString(string_file.string(), 0));
|
||||
EXPECT_EQ(MinidumpUTF8StringAtRVAAsString(string_file.string(), 0),
|
||||
test_string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,9 +244,9 @@ void MinidumpStringListTest() {
|
||||
ASSERT_TRUE(list);
|
||||
|
||||
for (size_t index = 0; index < strings.size(); ++index) {
|
||||
EXPECT_EQ(Traits::ExpectationForUTF8(strings[index]),
|
||||
Traits::ObservationAtRVA(string_file.string(),
|
||||
list->children[index]));
|
||||
EXPECT_EQ(
|
||||
Traits::ObservationAtRVA(string_file.string(), list->children[index]),
|
||||
Traits::ExpectationForUTF8(strings[index]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user