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 |
| 533 function finishResource(resource, finishTime) |
| 534 { |
| 535 test.assertTrue(typeof resource.timing.pushStart === "number" && resourc
e.timing.pushStart > 0, "pushStart is invalid: " + resource.timing.pushStart); |
| 536 test.assertTrue(typeof resource.timing.pushEnd === "number" && resource.
timing.pushEnd > 0, "pushEnd is invalid: " + resource.timing.pushEnd); |
| 537 test.assertTrue(resource.timing.pushStart < resource.timing.pushEnd, `pu
shStart should be before pushEnd (${resource.timing.pushStart} >= ${resource.tim
ing.pushEnd})`); |
| 538 test.assertTrue(resource.timing.pushStart < resource.startTime, "pushSta
rt should be before startTime"); |
| 539 test.assertTrue(resource.startTime < resource.timing.pushEnd, "pushEnd s
hould be after startTime"); |
| 540 test.assertTrue(resource.timing.pushEnd < resource.endTime, "pushEnd sho
uld be before endTime"); |
| 541 |
| 542 test.releaseControl(); |
| 543 } |
| 544 |
| 545 this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkReq
uest", finishResource); |
| 546 |
| 547 test.evaluateInConsole_("addImage('" + url + "')", function(resultText) {}); |
| 548 this.takeControl(); |
| 549 }; |
| 550 |
| 551 |
529 TestSuite.prototype.testConsoleOnNavigateBack = function() | 552 TestSuite.prototype.testConsoleOnNavigateBack = function() |
530 { | 553 { |
531 if (WebInspector.multitargetConsoleModel.messages().length === 1) | 554 if (WebInspector.multitargetConsoleModel.messages().length === 1) |
532 firstConsoleMessageReceived.call(this); | 555 firstConsoleMessageReceived.call(this); |
533 else | 556 else |
534 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso
leModel.Events.MessageAdded, firstConsoleMessageReceived, this); | 557 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso
leModel.Events.MessageAdded, firstConsoleMessageReceived, this); |
535 | 558 |
536 function firstConsoleMessageReceived() { | 559 function firstConsoleMessageReceived() { |
537 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co
nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this); | 560 WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.Co
nsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this); |
538 this.evaluateInConsole_("clickLink();", didClickLink.bind(this)); | 561 this.evaluateInConsole_("clickLink();", didClickLink.bind(this)); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 */ | 1093 */ |
1071 TestSuite.createKeyEvent = function(keyIdentifier) | 1094 TestSuite.createKeyEvent = function(keyIdentifier) |
1072 { | 1095 { |
1073 var evt = document.createEvent("KeyboardEvent"); | 1096 var evt = document.createEvent("KeyboardEvent"); |
1074 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); | 1097 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); |
1075 return evt; | 1098 return evt; |
1076 }; | 1099 }; |
1077 | 1100 |
1078 window.uiTests = new TestSuite(window.domAutomationController); | 1101 window.uiTests = new TestSuite(window.domAutomationController); |
1079 })(window); | 1102 })(window); |
OLD | NEW |