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

Unified Diff: third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc
diff --git a/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc b/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc
index 82b2903561735305287c1c359723a1b554a09912..75e6e7089e7125e9da0fd0f95ac6a909cb773635 100644
--- a/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc
+++ b/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win_test.cc
@@ -20,7 +20,8 @@
#include "snapshot/win/module_snapshot_win.h"
#include "snapshot/win/pe_image_reader.h"
#include "snapshot/win/process_reader_win.h"
-#include "test/paths.h"
+#include "test/errors.h"
+#include "test/test_paths.h"
#include "test/win/child_launcher.h"
#include "util/file/file_io.h"
#include "util/win/scoped_handle.h"
@@ -35,9 +36,9 @@ void TestImageReaderChild(const base::string16& directory_modification) {
done_uuid.InitializeWithNew();
ScopedKernelHANDLE done(
CreateEvent(nullptr, true, false, done_uuid.ToString16().c_str()));
- ASSERT_TRUE(done.get());
+ ASSERT_TRUE(done.is_valid()) << ErrorMessage("CreateEvent");
- base::FilePath test_executable = Paths::Executable();
+ base::FilePath test_executable = TestPaths::Executable();
std::wstring child_test_executable =
test_executable.DirName()
.Append(directory_modification)
@@ -50,61 +51,65 @@ void TestImageReaderChild(const base::string16& directory_modification) {
char c;
ASSERT_TRUE(
LoggingReadFileExactly(child.stdout_read_handle(), &c, sizeof(c)));
- ASSERT_EQ(' ', c);
-
- ScopedProcessSuspend suspend(child.process_handle());
-
- ProcessSnapshotWin process_snapshot;
- ASSERT_TRUE(process_snapshot.Initialize(
- child.process_handle(), ProcessSuspensionState::kSuspended, 0, 0));
-
- ASSERT_GE(process_snapshot.Modules().size(), 2u);
-
- UUID uuid;
- DWORD age;
- std::string pdbname;
- const std::string suffix(".pdb");
-
- // Check the main .exe to see that we can retrieve its sections.
- auto module = reinterpret_cast<const internal::ModuleSnapshotWin*>(
- process_snapshot.Modules()[0]);
- ASSERT_TRUE(module->pe_image_reader().DebugDirectoryInformation(
- &uuid, &age, &pdbname));
- EXPECT_NE(std::string::npos,
- pdbname.find("crashpad_snapshot_test_image_reader"));
- EXPECT_EQ(
- 0,
- pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix));
-
- // Check the dll it loads too.
- module = reinterpret_cast<const internal::ModuleSnapshotWin*>(
- process_snapshot.Modules().back());
- ASSERT_TRUE(module->pe_image_reader().DebugDirectoryInformation(
- &uuid, &age, &pdbname));
- EXPECT_NE(std::string::npos,
- pdbname.find("crashpad_snapshot_test_image_reader_module"));
- EXPECT_EQ(
- 0,
- pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix));
-
- // Sum the size of the extra memory in all the threads and confirm it's near
- // the limit that the child process set in its CrashpadInfo.
- EXPECT_GE(process_snapshot.Threads().size(), 100u);
-
- size_t extra_memory_total = 0;
- for (const auto* thread : process_snapshot.Threads()) {
- for (const auto* extra_memory : thread->ExtraMemory()) {
- extra_memory_total += extra_memory->Size();
+ ASSERT_EQ(c, ' ');
+
+ {
+ ScopedProcessSuspend suspend(child.process_handle());
+
+ ProcessSnapshotWin process_snapshot;
+ ASSERT_TRUE(process_snapshot.Initialize(
+ child.process_handle(), ProcessSuspensionState::kSuspended, 0, 0));
+
+ ASSERT_GE(process_snapshot.Modules().size(), 2u);
+
+ UUID uuid;
+ DWORD age;
+ std::string pdbname;
+ const std::string suffix(".pdb");
+
+ // Check the main .exe to see that we can retrieve its sections.
+ auto module = reinterpret_cast<const internal::ModuleSnapshotWin*>(
+ process_snapshot.Modules()[0]);
+ ASSERT_TRUE(module->pe_image_reader().DebugDirectoryInformation(
+ &uuid, &age, &pdbname));
+ EXPECT_NE(pdbname.find("crashpad_snapshot_test_image_reader"),
+ std::string::npos);
+ EXPECT_EQ(
+ pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix),
+ 0);
+
+ // Check the dll it loads too.
+ module = reinterpret_cast<const internal::ModuleSnapshotWin*>(
+ process_snapshot.Modules().back());
+ ASSERT_TRUE(module->pe_image_reader().DebugDirectoryInformation(
+ &uuid, &age, &pdbname));
+ EXPECT_NE(pdbname.find("crashpad_snapshot_test_image_reader_module"),
+ std::string::npos);
+ EXPECT_EQ(
+ pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix),
+ 0);
+
+ // Sum the size of the extra memory in all the threads and confirm it's near
+ // the limit that the child process set in its CrashpadInfo.
+ EXPECT_GE(process_snapshot.Threads().size(), 100u);
+
+ size_t extra_memory_total = 0;
+ for (const auto* thread : process_snapshot.Threads()) {
+ for (const auto* extra_memory : thread->ExtraMemory()) {
+ extra_memory_total += extra_memory->Size();
+ }
}
- }
- // We confirm we gathered less than 1M of extra data. The cap is set to only
- // 100K, but there are other "extra memory" regions that aren't included in
- // the cap. (Completely uncapped it would be > 10M.)
- EXPECT_LT(extra_memory_total, 1000000u);
+ // Confirm that less than 1M of extra data was gathered. The cap is set to
+ // only 100K, but there are other "extra memory" regions that aren't
+ // included in the cap. (Completely uncapped it would be > 10M.)
+ EXPECT_LT(extra_memory_total, 1000000u);
+ }
// Tell the child it can terminate.
- SetEvent(done.get());
+ EXPECT_TRUE(SetEvent(done.get())) << ErrorMessage("SetEvent");
+
+ EXPECT_EQ(child.WaitForExit(), 0);
}
TEST(ProcessSnapshotTest, CrashpadInfoChild) {

Powered by Google App Engine
This is Rietveld 408576698