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

Side by Side Diff: snapshot/win/cpu_context_win_test.cc

Issue 1126413008: win: Implement exception snapshot (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 5 years, 4 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
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "snapshot/win/cpu_context_win.h"
16
17 #include <windows.h>
18
19 #include "build/build_config.h"
20 #include "gtest/gtest.h"
21 #include "snapshot/cpu_context.h"
22
23 namespace crashpad {
24 namespace test {
25 namespace {
26
27 #if defined(ARCH_CPU_X86_FAMILY)
28
29 #if defined(ARCH_CPU_64_BITS)
Mark Mentovai 2015/08/18 17:52:13 Why not just #if defined(ARCH_CPU_X86_64) instead
scottmg 2015/08/18 18:18:21 Done.
30
31 TEST(CPUContextWin, InitializeX64Context) {
32 CONTEXT context;
33 context.Rax = 10;
34 context.FltSave.TagWord = 11;
35 context.Dr0 = 12;
36
37 // Test the simple case, where everything in the CPUContextX86_64 argument is
38 // set directly from the supplied thread, float, and debug state parameters.
39 {
40 CPUContextX86_64 cpu_context_x86_64 = {};
41 InitializeX64Context(context, &cpu_context_x86_64);
42 EXPECT_EQ(10u, cpu_context_x86_64.rax);
43 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw);
44 EXPECT_EQ(12u, cpu_context_x86_64.dr0);
45 }
46 }
47
48 #else
49
50 #error ARCH_CPU_32_BITS
51
52 #endif // ARCH_CPU_64_BITS
53
54 #endif // ARCH_CPU_X86_FAMILY
55
56 } // namespace
57 } // namespace test
58 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698