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

Unified Diff: snapshot/win/cpu_context_win_test.cc

Issue 1336823002: win x86: Grab bag of restructuring to get tests working on x86-on-x86 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
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
Index: snapshot/win/cpu_context_win_test.cc
diff --git a/snapshot/win/cpu_context_win_test.cc b/snapshot/win/cpu_context_win_test.cc
index 99d7c928bb78f92634b031c6cb6a2bd61ea9d203..0c7484b7c0e1ab551ba7abc9ba7b949cd3d75b30 100644
--- a/snapshot/win/cpu_context_win_test.cc
+++ b/snapshot/win/cpu_context_win_test.cc
@@ -27,10 +27,12 @@ namespace {
#if defined(ARCH_CPU_X86_64)
TEST(CPUContextWin, InitializeX64Context) {
- CONTEXT context;
+ CONTEXT context = {0};
context.Rax = 10;
context.FltSave.TagWord = 11;
context.Dr0 = 12;
+ context.ContextFlags =
+ CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS;
// Test the simple case, where everything in the CPUContextX86_64 argument is
// set directly from the supplied thread, float, and debug state parameters.
@@ -43,9 +45,26 @@ TEST(CPUContextWin, InitializeX64Context) {
}
}
-#else // ARCH_CPU_X86_64
+#else
-#error ARCH_CPU_X86
+TEST(CPUContextWin, InitializeX86Context) {
+ CONTEXT context = {0};
+ context.ContextFlags =
+ CONTEXT_INTEGER | CONTEXT_EXTENDED_REGISTERS | CONTEXT_DEBUG_REGISTERS;
+ context.Eax = 1;
+ context.ExtendedRegisters[4] = 2; // FTW.
+ context.Dr0 = 3;
+
+ // Test the simple case, where everything in the CPUContextX86 argument is
+ // set directly from the supplied thread, float, and debug state parameters.
+ {
+ CPUContextX86 cpu_context_x86 = {};
+ InitializeX86Context(context, &cpu_context_x86);
+ EXPECT_EQ(1u, cpu_context_x86.eax);
+ EXPECT_EQ(2u, cpu_context_x86.fxsave.ftw);
+ EXPECT_EQ(3u, cpu_context_x86.dr0);
+ }
+}
#endif // ARCH_CPU_X86_64

Powered by Google App Engine
This is Rietveld 408576698