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

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: fixes2 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
« no previous file with comments | « handler/win/crashy_test_program.cc ('k') | snapshot/win/process_snapshot_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f6509a51c13f1519bda9098c65ad60df650223af 100644
--- a/snapshot/win/exception_snapshot_win_test.cc
+++ b/snapshot/win/exception_snapshot_win_test.cc
@@ -20,7 +20,6 @@
#include "base/strings/utf_string_conversions.h"
#include "client/crashpad_client.h"
#include "gtest/gtest.h"
-#include "snapshot/win/process_reader_win.h"
#include "snapshot/win/process_snapshot_win.h"
#include "test/win/win_child_process.h"
#include "util/thread/thread.h"
@@ -63,22 +62,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 +99,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 +121,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 +186,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);
« no previous file with comments | « handler/win/crashy_test_program.cc ('k') | snapshot/win/process_snapshot_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698