Index: third_party/WebKit/Source/devtools/front_end/Tests.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js |
index c2bddb498112e1856d20017790716fb1b4a44f81..df304856e7c8db9f9dc760ca06f39a904b2ec83d 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js |
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js |
@@ -526,6 +526,35 @@ TestSuite.prototype.testNetworkTiming = function() |
}; |
+TestSuite.prototype.testPushTimes = function(url) |
+{ |
+ var test = this; |
+ var pendingResourceCount = 2; |
+ |
+ function finishResource(resource, finishTime) |
+ { |
+ test.assertTrue(typeof resource.timing.pushStart === "number" && resource.timing.pushStart > 0, `pushStart is invalid: ${resource.timing.pushStart}`); |
+ test.assertTrue(typeof resource.timing.pushEnd === "number", `pushEnd is invalid: ${resource.timing.pushEnd}`); |
+ test.assertTrue(resource.timing.pushStart < resource.startTime, "pushStart should be before startTime"); |
+ if (resource.url.endsWith("?pushUseNullEndTime")) { |
+ test.assertTrue(resource.timing.pushEnd === 0, `pushEnd should be 0 but is ${resource.timing.pushEnd}`); |
+ } else { |
+ test.assertTrue(resource.timing.pushStart < resource.timing.pushEnd, `pushStart should be before pushEnd (${resource.timing.pushStart} >= ${resource.timing.pushEnd})`); |
+ test.assertTrue(resource.timing.pushEnd < resource.endTime, "pushEnd should be before endTime"); |
+ test.assertTrue(resource.startTime < resource.timing.pushEnd, "pushEnd should be after startTime"); |
dgozman
2016/04/15 21:13:16
Let's comment this is not true generally, but we m
|
+ } |
+ if (!--pendingResourceCount) |
+ test.releaseControl(); |
+ } |
+ |
+ this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkRequest", finishResource, true); |
+ |
+ test.evaluateInConsole_("addImage('" + url + "')", function(resultText) {}); |
+ test.evaluateInConsole_("addImage('" + url + "?pushUseNullEndTime')", function(resultText) {}); |
+ this.takeControl(); |
+}; |
+ |
+ |
TestSuite.prototype.testConsoleOnNavigateBack = function() |
{ |
if (WebInspector.multitargetConsoleModel.messages().length === 1) |