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

Unified Diff: base/debug/activity_analyzer_unittest.cc

Issue 2753573002: Remove 'global' user-data in favor of 'process' user-data. (Closed)
Patch Set: rebased Created 3 years, 8 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 | « base/debug/activity_analyzer.cc ('k') | base/debug/activity_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/activity_analyzer_unittest.cc
diff --git a/base/debug/activity_analyzer_unittest.cc b/base/debug/activity_analyzer_unittest.cc
index 82889dc4ef29a0a95a2730088c0534b0fcb10532..31871f5dd698961909727a380a2d208f113bf73c 100644
--- a/base/debug/activity_analyzer_unittest.cc
+++ b/base/debug/activity_analyzer_unittest.cc
@@ -314,6 +314,7 @@ TEST_F(ActivityAnalyzerTest, UserDataSnapshotTest) {
}
TEST_F(ActivityAnalyzerTest, GlobalUserDataTest) {
+ const int64_t pid = GetCurrentProcId();
GlobalActivityTracker::CreateWithLocalMemory(kMemorySize, 0, "", 3, 0);
const char string1[] = "foo";
@@ -324,18 +325,21 @@ TEST_F(ActivityAnalyzerTest, GlobalUserDataTest) {
GlobalActivityAnalyzer global_analyzer(MakeUnique<PersistentMemoryAllocator>(
const_cast<void*>(allocator->data()), allocator->size(), 0, 0, "", true));
- ActivityUserData& global_data = GlobalActivityTracker::Get()->global_data();
- global_data.Set("raw", "foo", 3);
- global_data.SetString("string", "bar");
- global_data.SetChar("char", '9');
- global_data.SetInt("int", -9999);
- global_data.SetUint("uint", 9999);
- global_data.SetBool("bool", true);
- global_data.SetReference("ref", string1, sizeof(string1));
- global_data.SetStringReference("sref", string2);
-
+ ActivityUserData& process_data = GlobalActivityTracker::Get()->process_data();
+ ASSERT_NE(0U, process_data.id());
+ process_data.Set("raw", "foo", 3);
+ process_data.SetString("string", "bar");
+ process_data.SetChar("char", '9');
+ process_data.SetInt("int", -9999);
+ process_data.SetUint("uint", 9999);
+ process_data.SetBool("bool", true);
+ process_data.SetReference("ref", string1, sizeof(string1));
+ process_data.SetStringReference("sref", string2);
+
+ int64_t first_pid = global_analyzer.GetFirstProcess();
+ DCHECK_EQ(pid, first_pid);
const ActivityUserData::Snapshot& snapshot =
- global_analyzer.GetGlobalDataSnapshot();
+ global_analyzer.GetProcessDataSnapshot(pid);
ASSERT_TRUE(ContainsKey(snapshot, "raw"));
EXPECT_EQ("foo", snapshot.at("raw").Get().as_string());
ASSERT_TRUE(ContainsKey(snapshot, "string"));
« no previous file with comments | « base/debug/activity_analyzer.cc ('k') | base/debug/activity_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698