Index: snapshot/win/pe_image_annotations_reader_test.cc |
diff --git a/snapshot/win/pe_image_annotations_reader_test.cc b/snapshot/win/pe_image_annotations_reader_test.cc |
index d9365c2b83a5219abe45069a5ee8d45a77d20431..383ada99e01fddf69e54796f713492d01441d88f 100644 |
--- a/snapshot/win/pe_image_annotations_reader_test.cc |
+++ b/snapshot/win/pe_image_annotations_reader_test.cc |
@@ -36,19 +36,18 @@ namespace crashpad { |
namespace test { |
namespace { |
-class TestPEImageAnnotationsReader final : public WinMultiprocess { |
- public: |
- enum TestType { |
- // Don't crash, just test the CrashpadInfo interface. |
- kDontCrash = 0, |
+enum TestType { |
+ // Don't crash, just test the CrashpadInfo interface. |
+ kDontCrash = 0, |
- // The child process should crash by __debugbreak(). |
- kCrashDebugBreak, |
- }; |
- |
- explicit TestPEImageAnnotationsReader(TestType test_type) |
- : WinMultiprocess(), test_type_(test_type) {} |
+ // The child process should crash by __debugbreak(). |
+ kCrashDebugBreak, |
+}; |
+template <TestType Type> |
+class TestPEImageAnnotationsReader final : public WinMultiprocess { |
+ public: |
+ TestPEImageAnnotationsReader() {} |
~TestPEImageAnnotationsReader() {} |
private: |
@@ -87,7 +86,7 @@ class TestPEImageAnnotationsReader final : public WinMultiprocess { |
EXPECT_EQ("shorter", all_annotations_simple_map["#TEST# longer"]); |
EXPECT_EQ("", all_annotations_simple_map["#TEST# empty_value"]); |
- if (test_type_ == kCrashDebugBreak) |
+ if (Type == kCrashDebugBreak) |
SetExpectedChildExitCode(STATUS_BREAKPOINT); |
// Tell the child process to continue. |
@@ -115,7 +114,7 @@ class TestPEImageAnnotationsReader final : public WinMultiprocess { |
// Wait for the parent to indicate that it's safe to continue/crash. |
CheckedReadFile(ReadPipeHandle(), &c, sizeof(c)); |
- switch (test_type_) { |
+ switch (Type) { |
case kDontCrash: |
break; |
@@ -125,21 +124,15 @@ class TestPEImageAnnotationsReader final : public WinMultiprocess { |
} |
} |
- TestType test_type_; |
- |
DISALLOW_COPY_AND_ASSIGN(TestPEImageAnnotationsReader); |
}; |
TEST(PEImageAnnotationsReader, DontCrash) { |
- TestPEImageAnnotationsReader test_pe_image_annotations_reader( |
- TestPEImageAnnotationsReader::kDontCrash); |
- test_pe_image_annotations_reader.Run(); |
+ WinMultiprocess::Run<TestPEImageAnnotationsReader<kDontCrash>>(); |
} |
TEST(PEImageAnnotationsReader, CrashDebugBreak) { |
- TestPEImageAnnotationsReader test_pe_image_annotations_reader( |
- TestPEImageAnnotationsReader::kCrashDebugBreak); |
- test_pe_image_annotations_reader.Run(); |
+ WinMultiprocess::Run<TestPEImageAnnotationsReader<kCrashDebugBreak>>(); |
} |
} // namespace |