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

Unified Diff: snapshot/win/exception_snapshot_win_test.cc

Issue 1314093002: Refactor handler/main for Windows, implement CrashHandlerExceptionServer (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@crash-handler-exe
Patch Set: fixes Created 5 years, 3 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: snapshot/win/exception_snapshot_win_test.cc
diff --git a/snapshot/win/exception_snapshot_win_test.cc b/snapshot/win/exception_snapshot_win_test.cc
index dbed3f80cfa9777858a62ad111fb0d638b84e3fc..7574c6c22e21ec767f0e5dbb2180a72e38b34f12 100644
--- a/snapshot/win/exception_snapshot_win_test.cc
+++ b/snapshot/win/exception_snapshot_win_test.cc
@@ -63,22 +63,9 @@ class ExceptionSnapshotWinTest : public testing::Test {
unsigned int ExceptionHandlerServerException(
HANDLE process,
WinVMAddress exception_information_address) override {
- // Snapshot the process and exception.
- ProcessReaderWin process_reader;
- EXPECT_TRUE(process_reader.Initialize(process));
- if (HasFatalFailure())
- return 0xffffffff;
- ExceptionInformation exception_information;
- EXPECT_TRUE(
- process_reader.ReadMemory(exception_information_address,
- sizeof(exception_information),
- &exception_information));
- if (HasFatalFailure())
- return 0xffffffff;
ProcessSnapshotWin snapshot;
snapshot.Initialize(process);
- snapshot.InitializeException(exception_information.thread_id,
- exception_information.exception_pointers);
+ snapshot.InitializeException(exception_information_address);
// Confirm the exception record was read correctly.
EXPECT_NE(snapshot.Exception()->ThreadID(), 0u);
@@ -113,17 +100,19 @@ class ExceptionSnapshotWinTest : public testing::Test {
// Runs the ExceptionHandlerServer on a background thread.
class RunServerThread : public Thread {
public:
- // Instantiates a thread which will invoke server->Run(pipe_name);
- explicit RunServerThread(ExceptionHandlerServer* server,
- const std::string& pipe_name)
- : server_(server), pipe_name_(pipe_name) {}
+ // Instantiates a thread which will invoke server->Run(delegate, pipe_name);
+ RunServerThread(ExceptionHandlerServer* server,
+ ExceptionHandlerServer::Delegate* delegate,
+ const std::string& pipe_name)
+ : server_(server), delegate_(delegate), pipe_name_(pipe_name) {}
~RunServerThread() override {}
private:
// Thread:
- void ThreadMain() override { server_->Run(pipe_name_); }
+ void ThreadMain() override { server_->Run(delegate_, pipe_name_); }
ExceptionHandlerServer* server_;
+ ExceptionHandlerServer::Delegate* delegate_;
std::string pipe_name_;
DISALLOW_COPY_AND_ASSIGN(RunServerThread);
@@ -133,8 +122,7 @@ class RunServerThread : public Thread {
// thread joined.
class ScopedStopServerAndJoinThread {
public:
- explicit ScopedStopServerAndJoinThread(ExceptionHandlerServer* server,
- Thread* thread)
+ ScopedStopServerAndJoinThread(ExceptionHandlerServer* server, Thread* thread)
: server_(server), thread_(thread) {}
~ScopedStopServerAndJoinThread() {
server_->Stop();
@@ -199,8 +187,9 @@ TEST_F(ExceptionSnapshotWinTest, ChildCrash) {
ScopedKernelHANDLE completed(CreateEvent(nullptr, false, false, nullptr));
Delegate delegate(server_ready.get(), completed.get());
- ExceptionHandlerServer exception_handler_server(&delegate);
- RunServerThread server_thread(&exception_handler_server, pipe_name);
+ ExceptionHandlerServer exception_handler_server;
+ RunServerThread server_thread(
+ &exception_handler_server, &delegate, pipe_name);
server_thread.Start();
ScopedStopServerAndJoinThread scoped_stop_server_and_join_thread(
&exception_handler_server, &server_thread);

Powered by Google App Engine
This is Rietveld 408576698