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

Unified Diff: base/debug/activity_tracker_unittest.cc

Issue 2702413006: Enable storing last-dispatched exception per-thread. (Closed)
Patch Set: removed user-data for exception tracking; keep it simple to start Created 3 years, 9 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: base/debug/activity_tracker_unittest.cc
diff --git a/base/debug/activity_tracker_unittest.cc b/base/debug/activity_tracker_unittest.cc
index e9934d1ffda954d4ef17487fa940c85633134dc3..5411302b1ce867f1f0f670b7d9f2cba98ad1b9da 100644
--- a/base/debug/activity_tracker_unittest.cc
+++ b/base/debug/activity_tracker_unittest.cc
@@ -250,6 +250,27 @@ TEST_F(ActivityTrackerTest, ScopedTaskTest) {
ASSERT_EQ(2U, GetGlobalUserDataMemoryCacheUsed());
}
+TEST_F(ActivityTrackerTest, ExceptionTest) {
+ GlobalActivityTracker::CreateWithLocalMemory(kMemorySize, 0, "", 3);
+ GlobalActivityTracker* global = GlobalActivityTracker::Get();
+
+ ThreadActivityTracker* tracker =
+ GlobalActivityTracker::Get()->GetOrCreateTrackerForCurrentThread();
+ ThreadActivityTracker::Snapshot snapshot;
+ ASSERT_EQ(0U, GetGlobalUserDataMemoryCacheUsed());
+
+ ASSERT_TRUE(tracker->CreateSnapshot(&snapshot));
+ ASSERT_EQ(0U, snapshot.last_exception.activity_type);
+
+ char origin;
+ global->RecordException(&origin);
+
+ ASSERT_TRUE(tracker->CreateSnapshot(&snapshot));
+ EXPECT_EQ(Activity::ACT_EXCEPTION, snapshot.last_exception.activity_type);
+ EXPECT_EQ(reinterpret_cast<uintptr_t>(&origin),
+ snapshot.last_exception.origin_address);
+}
+
TEST_F(ActivityTrackerTest, CreateWithFileTest) {
const char temp_name[] = "CreateWithFileTest";
ScopedTempDir temp_dir;

Powered by Google App Engine
This is Rietveld 408576698