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

Unified Diff: base/debug/activity_analyzer_unittest.cc

Issue 2544853003: Store log messages in global activity tracker. (Closed)
Patch Set: added comment about NUL terminator Created 4 years 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_analyzer_unittest.cc
diff --git a/base/debug/activity_analyzer_unittest.cc b/base/debug/activity_analyzer_unittest.cc
index 5cdb6c5fe48e45fe486fafecef97abf5c85f5357..c8c3911750d49e56348039ecd64c802444f3fc22 100644
--- a/base/debug/activity_analyzer_unittest.cc
+++ b/base/debug/activity_analyzer_unittest.cc
@@ -176,5 +176,22 @@ TEST_F(ActivityAnalyzerTest, GlobalAnalyzerConstruction) {
EXPECT_EQ(tk1, tk2);
}
+TEST_F(ActivityAnalyzerTest, GlobalLogMessages) {
+ GlobalActivityTracker::CreateWithLocalMemory(kMemorySize, 0, "", 3);
+
+ PersistentMemoryAllocator* allocator =
+ GlobalActivityTracker::Get()->allocator();
+ GlobalActivityAnalyzer analyzer(MakeUnique<PersistentMemoryAllocator>(
+ const_cast<void*>(allocator->data()), allocator->size(), 0, 0, "", true));
+
+ GlobalActivityTracker::Get()->RecordLogMessage("hello world");
+ GlobalActivityTracker::Get()->RecordLogMessage("foo bar");
+
+ std::vector<std::string> messages = analyzer.GetLogMessages();
+ ASSERT_EQ(2U, messages.size());
+ EXPECT_EQ("hello world", messages[0]);
+ EXPECT_EQ("foo bar", messages[1]);
+}
+
} // namespace debug
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698