OLD | NEW |
(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_64) |
| 28 |
| 29 TEST(CPUContextWin, InitializeX64Context) { |
| 30 CONTEXT context; |
| 31 context.Rax = 10; |
| 32 context.FltSave.TagWord = 11; |
| 33 context.Dr0 = 12; |
| 34 |
| 35 // Test the simple case, where everything in the CPUContextX86_64 argument is |
| 36 // set directly from the supplied thread, float, and debug state parameters. |
| 37 { |
| 38 CPUContextX86_64 cpu_context_x86_64 = {}; |
| 39 InitializeX64Context(context, &cpu_context_x86_64); |
| 40 EXPECT_EQ(10u, cpu_context_x86_64.rax); |
| 41 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); |
| 42 EXPECT_EQ(12u, cpu_context_x86_64.dr0); |
| 43 } |
| 44 } |
| 45 |
| 46 #else // ARCH_CPU_X86_64 |
| 47 |
| 48 #error ARCH_CPU_X86 |
| 49 |
| 50 #endif // ARCH_CPU_X86_64 |
| 51 |
| 52 } // namespace |
| 53 } // namespace test |
| 54 } // namespace crashpad |
OLD | NEW |