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

Unified Diff: snapshot/win/process_reader_win_test.cc

Issue 1133203002: win: Retrieve thread context for x64 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fix current thread Created 5 years, 7 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 | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/thread_snapshot_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/win/process_reader_win_test.cc
diff --git a/snapshot/win/process_reader_win_test.cc b/snapshot/win/process_reader_win_test.cc
index e7c478ea5b31be431a85c2ea2d659cbcbb1cf04a..38de7865a25f45cb03a637069eb7816773d21d80 100644
--- a/snapshot/win/process_reader_win_test.cc
+++ b/snapshot/win/process_reader_win_test.cc
@@ -43,6 +43,28 @@ TEST(ProcessReaderWin, SelfBasic) {
EXPECT_STREQ(kTestMemory, buffer);
}
+TEST(ProcessReaderWin, SelfOneThread) {
+ ProcessReaderWin process_reader;
+ ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess()));
+
+ const std::vector<ProcessReaderWin::Thread>& threads =
+ process_reader.Threads();
+
+ // If other tests ran in this process previously, threads may have been
+ // created and may still be running. This check must look for at least one
+ // thread, not exactly one thread.
+ ASSERT_GE(threads.size(), 1u);
+
+ EXPECT_EQ(GetThreadId(GetCurrentThread()), threads[0].id);
+#if defined(ARCH_CPU_64_BITS)
+ EXPECT_NE(0, threads[0].context.Rip);
+#else
+ EXPECT_NE(0, threads[0].context.Eip);
+#endif
+
+ EXPECT_EQ(0, threads[0].suspend_count);
+}
+
} // namespace
} // namespace test
} // namespace crashpad
« no previous file with comments | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/thread_snapshot_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698