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

Unified Diff: LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html

Issue 1021543002: DevTools: remove InspectorTest.assert from inspector-protocol tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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: LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html
diff --git a/LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html b/LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html
index 8b732f3f05885fb7b1605e5cbb7dbdce65f7383d..230ed4667a07a3e1c8570f61aa537ba69931b437 100644
--- a/LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html
+++ b/LayoutTests/inspector-protocol/heap-profiler/heap-objects-tracking.html
@@ -26,8 +26,8 @@ function test()
{
InspectorTest.importScript("../../../../inspector-protocol/heap-profiler/resources/heap-snapshot-common.js");
- var gotLastSeenObjectIdEvent = false;
- var gotHeapStatsUpdateEvent = false;
+ var lastSeenObjectIdEventCount = 0;
+ var heapStatsUpdateEventCount = 0;
function trackingStarted()
{
InspectorTest.log("SUCCESS: tracking started");
@@ -35,10 +35,8 @@ function test()
function trackingStopped()
{
- if (gotHeapStatsUpdateEvent)
- InspectorTest.log("SUCCESS: heapStatsUpdate arrived");
- if (gotLastSeenObjectIdEvent)
- InspectorTest.log("SUCCESS: lastSeenObjectId arrived");
+ InspectorTest.log("Number of heapStatsUpdate events >= numbrt of lastSeenObjectId events: " + (heapStatsUpdateEventCount >= lastSeenObjectIdEventCount));
+ InspectorTest.log("At least 2 lastSeenObjectId arrived: " + (lastSeenObjectIdEventCount >= 2));
InspectorTest.log("SUCCESS: tracking stopped");
InspectorTest.completeTest();
}
@@ -46,30 +44,35 @@ function test()
var fragments = [];
InspectorTest.eventHandler["HeapProfiler.lastSeenObjectId"] = function(messageObject)
{
-
- var params = messageObject["params"];
- InspectorTest.assert(params, "no params found in event HeapProfiler.lastSeenObjectId");
- InspectorTest.assert(params.lastSeenObjectId, "lastSeenObjectId is missing in event HeapProfiler.lastSeenObjectId");
- InspectorTest.assert(params.timestamp, "timestamp is missing in event HeapProfiler.lastSeenObjectId");
- InspectorTest.assert(fragments.length, "a heap stats fragment didn't arrive before HeapProfiler.lastSeenObjectId");
- InspectorTest.sendCommand("HeapProfiler.stopTrackingHeapObjects", {}, trackingStopped);
- gotLastSeenObjectIdEvent = true;
+ if (++lastSeenObjectIdEventCount <= 2) {
+ var params = messageObject["params"];
+ InspectorTest.log("HeapProfiler.lastSeenObjectId has params: " + !!params);
+ InspectorTest.log("HeapProfiler.lastSeenObjectId has params.lastSeenObjectId: " + !!params.lastSeenObjectId);
+ InspectorTest.log("HeapProfiler.lastSeenObjectId has timestamp: " + !!params.timestamp);
+ InspectorTest.log("A heap stats fragment did arrive before HeapProfiler.lastSeenObjectId: " + !!fragments.length);
+ InspectorTest.log("");
+ }
+ if (lastSeenObjectIdEventCount == 2) {
+ // Wait for two updates and then stop tracing.
+ InspectorTest.sendCommand("HeapProfiler.stopTrackingHeapObjects", {}, trackingStopped);
+ }
}
InspectorTest.eventHandler["HeapProfiler.heapStatsUpdate"] = function(messageObject)
{
- var params = messageObject["params"];
- InspectorTest.assert(params, "no params found in event HeapProfiler.heapStatsUpdate");
- var statsUpdate = params.statsUpdate;
- InspectorTest.assert(statsUpdate, "statsUpdata is missing in event HeapProfiler.heapStatsUpdate");
- InspectorTest.assert(statsUpdate.length, "statsUpdate should have non zero length");
- InspectorTest.assert(!(statsUpdate.length % 3), "statsUpdate length must be a multiple of three");
- InspectorTest.assert(!(statsUpdate.length % 3), "statsUpdate length must be a multiple of three");
- InspectorTest.assert(!statsUpdate[0], "statsUpdate: first fragmentIndex in first update has to be zero");
- InspectorTest.assert(statsUpdate[1], "statsUpdate: total count of objects should be not zero");
- InspectorTest.assert(statsUpdate[2], "statsUpdate: total size of objects should be not zero");
- fragments.push(statsUpdate);
- gotHeapStatsUpdateEvent = true;
+ var params = messageObject["params"];
+ InspectorTest.log("HeapProfiler.heapStatsUpdate has params: " + !!params);
+ var statsUpdate = params.statsUpdate;
+ if (++heapStatsUpdateEventCount < 2) {
+ InspectorTest.log("HeapProfiler.heapStatsUpdate has statsUpdate: " + !!statsUpdate);
+ InspectorTest.log("statsUpdate length is not zero: " + !!statsUpdate.length);
+ InspectorTest.log("statsUpdate length is a multiple of three: " + !(statsUpdate.length % 3));
+ InspectorTest.log("statsUpdate: first fragmentIndex in first update: " + statsUpdate[0]);
+ InspectorTest.log("statsUpdate: total count of objects is not zero: " + !!statsUpdate[1]);
+ InspectorTest.log("statsUpdate: total size of objects is not zero: " + !!statsUpdate[2]);
+ InspectorTest.log("");
+ }
+ fragments.push(statsUpdate);
}
InspectorTest.sendCommand("HeapProfiler.startTrackingHeapObjects", {}, trackingStarted);

Powered by Google App Engine
This is Rietveld 408576698