OLD | NEW |
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 Loading... |
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 // The below assertion is just due to the way we generate times in t
he moch URLRequestJob and is not generally an invariant. |
| 544 test.assertTrue(resource.timing.pushEnd < resource.endTime, "pushEnd
should be before endTime"); |
| 545 test.assertTrue(resource.startTime < resource.timing.pushEnd, "pushE
nd should be after startTime"); |
| 546 } |
| 547 if (!--pendingResourceCount) |
| 548 test.releaseControl(); |
| 549 } |
| 550 |
| 551 this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkReq
uest", finishResource, true); |
| 552 |
| 553 test.evaluateInConsole_("addImage('" + url + "')", function(resultText) {}); |
| 554 test.evaluateInConsole_("addImage('" + url + "?pushUseNullEndTime')", functi
on(resultText) {}); |
| 555 this.takeControl(); |
| 556 }; |
| 557 |
| 558 |
529 TestSuite.prototype.testConsoleOnNavigateBack = function() | 559 TestSuite.prototype.testConsoleOnNavigateBack = function() |
530 { | 560 { |
531 if (WebInspector.multitargetConsoleModel.messages().length === 1) | 561 if (WebInspector.multitargetConsoleModel.messages().length === 1) |
532 firstConsoleMessageReceived.call(this); | 562 firstConsoleMessageReceived.call(this); |
533 else | 563 else |
534 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso
leModel.Events.MessageAdded, firstConsoleMessageReceived, this); | 564 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso
leModel.Events.MessageAdded, firstConsoleMessageReceived, this); |
535 | 565 |
536 function firstConsoleMessageReceived() { | 566 function firstConsoleMessageReceived() { |
537 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co
nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this); | 567 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co
nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this); |
538 this.evaluateInConsole_("clickLink();", didClickLink.bind(this)); | 568 this.evaluateInConsole_("clickLink();", didClickLink.bind(this)); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 */ | 1100 */ |
1071 TestSuite.createKeyEvent = function(keyIdentifier) | 1101 TestSuite.createKeyEvent = function(keyIdentifier) |
1072 { | 1102 { |
1073 var evt = document.createEvent("KeyboardEvent"); | 1103 var evt = document.createEvent("KeyboardEvent"); |
1074 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); | 1104 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); |
1075 return evt; | 1105 return evt; |
1076 }; | 1106 }; |
1077 | 1107 |
1078 window.uiTests = new TestSuite(window.domAutomationController); | 1108 window.uiTests = new TestSuite(window.domAutomationController); |
1079 })(window); | 1109 })(window); |
OLD | NEW |