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

Unified Diff: syzygy/agent/asan/rtl_impl_unittest.cc

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Fix comments. Created 3 years, 11 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
« no previous file with comments | « syzygy/agent/asan/rtl_impl.cc ('k') | syzygy/agent/asan/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/agent/asan/rtl_impl_unittest.cc
diff --git a/syzygy/agent/asan/rtl_impl_unittest.cc b/syzygy/agent/asan/rtl_impl_unittest.cc
index 4a8426db9e6c520c560ccc71acdb101b8e13dfe5..a0a1cf690a7b01c727bf4409a0384736a2aa2e5c 100644
--- a/syzygy/agent/asan/rtl_impl_unittest.cc
+++ b/syzygy/agent/asan/rtl_impl_unittest.cc
@@ -23,6 +23,9 @@
#include "syzygy/agent/asan/unittest_util.h"
#include "syzygy/core/unittest_util.h"
+namespace agent {
+namespace asan {
+
namespace {
class AsanRtlImplTest : public testing::TestWithAsanLogger {
@@ -32,7 +35,7 @@ class AsanRtlImplTest : public testing::TestWithAsanLogger {
void SetUp() override {
testing::TestWithAsanLogger::SetUp();
- asan_runtime_.SetUp(std::wstring());
+ asan_runtime_.SetUp(runtime_command_line_);
agent::asan::SetUpRtl(&asan_runtime_);
heap_ = asan_HeapCreate(0, 0, 0);
ASSERT_TRUE(heap_ != NULL);
@@ -56,6 +59,11 @@ class AsanRtlImplTest : public testing::TestWithAsanLogger {
// Scratch heap handle valid from SetUp to TearDown.
HANDLE heap_;
+
+ // The command line used to initialize the runtime. Empty by default but
+ // can be override by the derived classes to enable some runtime flags
+ // during setup.
+ std::wstring runtime_command_line_;
};
} // namespace
@@ -151,3 +159,24 @@ TEST_F(AsanRtlImplTest, SetInformationWithNullHeapPtr) {
asan_HeapSetInformation(NULL, HeapEnableTerminationOnCorruption,
NULL, 0));
}
+
+namespace {
+
+// Derived class that defers the crash reporter initialization.
+class AsanRtlImplTestCrashReporterInitialization : public AsanRtlImplTest {
+ public:
+ AsanRtlImplTestCrashReporterInitialization() {
+ runtime_command_line_ = L"--defer_crash_reporter_initialization";
+ }
+};
+
+} // namespace
+
+TEST_F(AsanRtlImplTestCrashReporterInitialization, InitializeCrashReporter) {
+ EXPECT_FALSE(asan_runtime_.crash_reporter_initialized());
+ asan_InitializeCrashReporter();
+ EXPECT_TRUE(asan_runtime_.crash_reporter_initialized());
+}
+
+} // namespace asan
+} // namespace agent
« no previous file with comments | « syzygy/agent/asan/rtl_impl.cc ('k') | syzygy/agent/asan/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698