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

Side by Side 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: . 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 25 matching lines...) Expand all
36 // set directly from the supplied thread, float, and debug state parameters. 36 // set directly from the supplied thread, float, and debug state parameters.
37 { 37 {
38 CPUContextX86_64 cpu_context_x86_64 = {}; 38 CPUContextX86_64 cpu_context_x86_64 = {};
39 InitializeX64Context(context, &cpu_context_x86_64); 39 InitializeX64Context(context, &cpu_context_x86_64);
40 EXPECT_EQ(10u, cpu_context_x86_64.rax); 40 EXPECT_EQ(10u, cpu_context_x86_64.rax);
41 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); 41 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw);
42 EXPECT_EQ(12u, cpu_context_x86_64.dr0); 42 EXPECT_EQ(12u, cpu_context_x86_64.dr0);
43 } 43 }
44 } 44 }
45 45
46 #else // ARCH_CPU_X86_64 46 #else
47 47
48 #error ARCH_CPU_X86 48 TEST(CPUContextWin, InitializeX86Context) {
49 CONTEXT context = {0};
50 context.Eax = 1;
51 context.ExtendedRegisters[4] = 2; // FTW.
52 context.Dr0 = 3;
53
54 // Test the simple case, where everything in the CPUContextX86 argument is
55 // set directly from the supplied thread, float, and debug state parameters.
56 {
57 CPUContextX86 cpu_context_x86 = {};
58 InitializeX86Context(context, &cpu_context_x86);
59 EXPECT_EQ(1u, cpu_context_x86.eax);
60 EXPECT_EQ(2u, cpu_context_x86.fxsave.ftw);
61 EXPECT_EQ(3u, cpu_context_x86.dr0);
62 }
63 }
64
49 65
50 #endif // ARCH_CPU_X86_64 66 #endif // ARCH_CPU_X86_64
51 67
52 } // namespace 68 } // namespace
53 } // namespace test 69 } // namespace test
54 } // namespace crashpad 70 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698