Bug 1680995 - Profiler gtests: Add some general checks - r=canaltinova

JSONOutputCheck now checks a few more properties, including thread contents, and sub-process profiles.

Differential Revision: https://phabricator.services.mozilla.com/D98891
This commit is contained in:
Gerald Squelart 2020-12-09 04:14:20 +00:00
Родитель fba8be0f11
Коммит 90f7b56bf6
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -148,13 +148,21 @@ static void JSONRootCheck(const Json::Value& aRoot,
EXPECT_HAS_JSON(meta["version"], UInt);
EXPECT_HAS_JSON(meta["startTime"], Double);
EXPECT_HAS_JSON(aRoot["pages"], Array);
EXPECT_HAS_JSON(aRoot["profilerOverhead"], Object);
GET_JSON(threads, aRoot["threads"], Array);
const Json::ArrayIndex threadCount = threads.size();
for (Json::ArrayIndex i = 0; i < threadCount; ++i) {
GET_JSON(thread, threads[i], Object);
EXPECT_HAS_JSON(thread["processType"], String);
EXPECT_HAS_JSON(thread["name"], String);
EXPECT_HAS_JSON(thread["registerTime"], Double);
EXPECT_HAS_JSON(thread["samples"], Object);
EXPECT_HAS_JSON(thread["markers"], Object);
EXPECT_HAS_JSON(thread["pid"], UInt);
EXPECT_HAS_JSON(thread["tid"], UInt);
EXPECT_HAS_JSON(thread["stackTable"], Object);
EXPECT_HAS_JSON(thread["frameTable"], Object);
EXPECT_HAS_JSON(thread["stringTable"], Array);
@ -165,6 +173,18 @@ static void JSONRootCheck(const Json::Value& aRoot,
GET_JSON(thread0, threads[0], Object);
EXPECT_EQ_JSON(thread0["name"], String, "GeckoMain");
}
EXPECT_HAS_JSON(aRoot["pausedRanges"], Array);
const Json::Value& processes = aRoot["processes"];
if (!processes.isNull()) {
ASSERT_TRUE(processes.isArray());
const Json::ArrayIndex processCount = processes.size();
for (Json::ArrayIndex i = 0; i < processCount; ++i) {
GET_JSON(process, processes[i], Object);
JSONRootCheck(process, aWithMainThread);
}
}
}
// Check that various expected top properties are in the JSON, and then call the