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

Unified 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: tidy 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 side-by-side diff with in-line comments
Download patch
Index: snapshot/win/cpu_context_win_test.cc
diff --git a/test/paths_test.cc b/snapshot/win/cpu_context_win_test.cc
similarity index 52%
copy from test/paths_test.cc
copy to snapshot/win/cpu_context_win_test.cc
index 7cbca049e70f68e2e5715c380036faf62697dc87..c6802eb4f4e33c5a67a006badb6eb3e71b422fca 100644
--- a/test/paths_test.cc
+++ b/snapshot/win/cpu_context_win_test.cc
@@ -12,36 +12,39 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "test/paths.h"
+#include "snapshot/win/cpu_context_win.h"
+
+#include <windows.h>
-#include "base/files/file_path.h"
#include "build/build_config.h"
#include "gtest/gtest.h"
-#include "util/file/file_io.h"
+#include "snapshot/cpu_context.h"
namespace crashpad {
namespace test {
namespace {
-TEST(Paths, Executable) {
- base::FilePath executable_path = Paths::Executable();
- base::FilePath executable_name = executable_path.BaseName();
-#if defined(OS_WIN)
- EXPECT_EQ(FILE_PATH_LITERAL("crashpad_test_test.exe"),
- executable_name.value());
-#else
- EXPECT_EQ("crashpad_test_test", executable_name.value());
-#endif // OS_WIN
-}
+#if defined(ARCH_CPU_X86_FAMILY)
Mark Mentovai 2015/08/18 16:17:19 Doesn’t look like it’ll work as-is on 32-bit x86,
scottmg 2015/08/18 16:56:00 Added #error on 32 for now.
-TEST(Paths, TestDataRoot) {
- base::FilePath test_data_root = Paths::TestDataRoot();
- ScopedFileHandle file(LoggingOpenFileForRead(
- test_data_root.Append(FILE_PATH_LITERAL("test"))
- .Append(FILE_PATH_LITERAL("paths_test_data_root.txt"))));
- EXPECT_TRUE(file.is_valid());
+TEST(CPUContextWin, InitializeX64Context) {
+ CONTEXT context;
+ context.Rax = 10;
+ context.FltSave.TagWord = 11;
+ context.Dr0 = 12;
+
+ // Test the simple case, where everything in the CPUContextX86_64 argument is
+ // set directly from the supplied thread, float, and debug state parameters.
+ {
+ CPUContextX86_64 cpu_context_x86_64 = {};
+ InitializeX64Context(context, &cpu_context_x86_64);
+ EXPECT_EQ(10u, cpu_context_x86_64.rax);
+ EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw);
+ EXPECT_EQ(12u, cpu_context_x86_64.dr0);
+ }
}
+#endif
+
} // namespace
} // namespace test
} // namespace crashpad

Powered by Google App Engine
This is Rietveld 408576698