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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/Tests.js

Issue 1828203005: Expose SPDY pushes in DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated wording on push_end comment Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkReq uest", finishResource); 520 this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkReq uest", finishResource);
521 521
522 // Reload inspected page to sniff network events 522 // Reload inspected page to sniff network events
523 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {}); 523 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {});
524 524
525 this.takeControl(); 525 this.takeControl();
526 }; 526 };
527 527
528 528
529 TestSuite.prototype.testPushTimes = function(url)
530 {
531 var test = this;
532 var pendingResourceCount = 2;
533
534 function finishResource(resource, finishTime)
535 {
536 test.assertTrue(typeof resource.timing.pushStart === "number" && resourc e.timing.pushStart > 0, `pushStart is invalid: ${resource.timing.pushStart}`);
537 test.assertTrue(typeof resource.timing.pushEnd === "number", `pushEnd is invalid: ${resource.timing.pushEnd}`);
538 test.assertTrue(resource.timing.pushStart < resource.startTime, "pushSta rt should be before startTime");
539 if (resource.url.endsWith("?pushUseNullEndTime")) {
540 test.assertTrue(resource.timing.pushEnd === 0, `pushEnd should be 0 but is ${resource.timing.pushEnd}`);
541 } else {
542 test.assertTrue(resource.timing.pushStart < resource.timing.pushEnd, `pushStart should be before pushEnd (${resource.timing.pushStart} >= ${resource .timing.pushEnd})`);
543 test.assertTrue(resource.timing.pushEnd < resource.endTime, "pushEnd should be before endTime");
544 test.assertTrue(resource.startTime < resource.timing.pushEnd, "pushE nd should be after startTime");
dgozman 2016/04/15 21:13:16 Let's comment this is not true generally, but we m
545 }
546 if (!--pendingResourceCount)
547 test.releaseControl();
548 }
549
550 this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkReq uest", finishResource, true);
551
552 test.evaluateInConsole_("addImage('" + url + "')", function(resultText) {});
553 test.evaluateInConsole_("addImage('" + url + "?pushUseNullEndTime')", functi on(resultText) {});
554 this.takeControl();
555 };
556
557
529 TestSuite.prototype.testConsoleOnNavigateBack = function() 558 TestSuite.prototype.testConsoleOnNavigateBack = function()
530 { 559 {
531 if (WebInspector.multitargetConsoleModel.messages().length === 1) 560 if (WebInspector.multitargetConsoleModel.messages().length === 1)
532 firstConsoleMessageReceived.call(this); 561 firstConsoleMessageReceived.call(this);
533 else 562 else
534 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso leModel.Events.MessageAdded, firstConsoleMessageReceived, this); 563 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso leModel.Events.MessageAdded, firstConsoleMessageReceived, this);
535 564
536 function firstConsoleMessageReceived() { 565 function firstConsoleMessageReceived() {
537 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this); 566 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this);
538 this.evaluateInConsole_("clickLink();", didClickLink.bind(this)); 567 this.evaluateInConsole_("clickLink();", didClickLink.bind(this));
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 */ 1099 */
1071 TestSuite.createKeyEvent = function(keyIdentifier) 1100 TestSuite.createKeyEvent = function(keyIdentifier)
1072 { 1101 {
1073 var evt = document.createEvent("KeyboardEvent"); 1102 var evt = document.createEvent("KeyboardEvent");
1074 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel * /, null /* view */, keyIdentifier, ""); 1103 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel * /, null /* view */, keyIdentifier, "");
1075 return evt; 1104 return evt;
1076 }; 1105 };
1077 1106
1078 window.uiTests = new TestSuite(window.domAutomationController); 1107 window.uiTests = new TestSuite(window.domAutomationController);
1079 })(window); 1108 })(window);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698