| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } | 510 } |
| 511 | 511 |
| 512 this.addSniffer(WebInspector.NetworkDispatcher.prototype, '_finishNetworkReq
uest', finishResource, true); | 512 this.addSniffer(WebInspector.NetworkDispatcher.prototype, '_finishNetworkReq
uest', finishResource, true); |
| 513 | 513 |
| 514 test.evaluateInConsole_('addImage(\'' + url + '\')', function(resultText) {}
); | 514 test.evaluateInConsole_('addImage(\'' + url + '\')', function(resultText) {}
); |
| 515 test.evaluateInConsole_('addImage(\'' + url + '?pushUseNullEndTime\')', func
tion(resultText) {}); | 515 test.evaluateInConsole_('addImage(\'' + url + '?pushUseNullEndTime\')', func
tion(resultText) {}); |
| 516 this.takeControl(); | 516 this.takeControl(); |
| 517 }; | 517 }; |
| 518 | 518 |
| 519 TestSuite.prototype.testConsoleOnNavigateBack = function() { | 519 TestSuite.prototype.testConsoleOnNavigateBack = function() { |
| 520 | 520 if (WebInspector.multitargetConsoleModel.messages().length === 1) |
| 521 function filteredMessages() { | 521 firstConsoleMessageReceived.call(this); |
| 522 return WebInspector.multitargetConsoleModel.messages().filter( | |
| 523 a => a.source !== WebInspector.ConsoleMessage.MessageSource.Violation
); | |
| 524 } | |
| 525 | |
| 526 if (filteredMessages().length === 1) | |
| 527 firstConsoleMessageReceived.call(this, null); | |
| 528 else | 522 else |
| 529 WebInspector.multitargetConsoleModel.addEventListener( | 523 WebInspector.multitargetConsoleModel.addEventListener( |
| 530 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece
ived, this); | 524 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece
ived, this); |
| 531 | 525 |
| 532 function firstConsoleMessageReceived(event) { | 526 function firstConsoleMessageReceived() { |
| 533 if (event && event.data.source === WebInspector.ConsoleMessage.MessageSour
ce.Violation) | |
| 534 return; | |
| 535 WebInspector.multitargetConsoleModel.removeEventListener( | 527 WebInspector.multitargetConsoleModel.removeEventListener( |
| 536 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece
ived, this); | 528 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece
ived, this); |
| 537 this.evaluateInConsole_('clickLink();', didClickLink.bind(this)); | 529 this.evaluateInConsole_('clickLink();', didClickLink.bind(this)); |
| 538 } | 530 } |
| 539 | 531 |
| 540 function didClickLink() { | 532 function didClickLink() { |
| 541 // Check that there are no new messages(command is not a message). | 533 // Check that there are no new messages(command is not a message). |
| 542 this.assertEquals(3, filteredMessages().length); | 534 this.assertEquals(3, WebInspector.multitargetConsoleModel.messages().lengt
h); |
| 543 this.evaluateInConsole_('history.back();', didNavigateBack.bind(this)); | 535 this.evaluateInConsole_('history.back();', didNavigateBack.bind(this)); |
| 544 } | 536 } |
| 545 | 537 |
| 546 function didNavigateBack() { | 538 function didNavigateBack() { |
| 547 // Make sure navigation completed and possible console messages were pushe
d. | 539 // Make sure navigation completed and possible console messages were pushe
d. |
| 548 this.evaluateInConsole_('void 0;', didCompleteNavigation.bind(this)); | 540 this.evaluateInConsole_('void 0;', didCompleteNavigation.bind(this)); |
| 549 } | 541 } |
| 550 | 542 |
| 551 function didCompleteNavigation() { | 543 function didCompleteNavigation() { |
| 552 this.assertEquals(7, filteredMessages().length); | 544 this.assertEquals(7, WebInspector.multitargetConsoleModel.messages().lengt
h); |
| 553 this.releaseControl(); | 545 this.releaseControl(); |
| 554 } | 546 } |
| 555 | 547 |
| 556 this.takeControl(); | 548 this.takeControl(); |
| 557 }; | 549 }; |
| 558 | 550 |
| 559 TestSuite.prototype.testSharedWorker = function() { | 551 TestSuite.prototype.testSharedWorker = function() { |
| 560 function didEvaluateInConsole(resultText) { | 552 function didEvaluateInConsole(resultText) { |
| 561 this.assertEquals('2011', resultText); | 553 this.assertEquals('2011', resultText); |
| 562 this.releaseControl(); | 554 this.releaseControl(); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 callback.call(null); | 1099 callback.call(null); |
| 1108 else | 1100 else |
| 1109 this.addSniffer( | 1101 this.addSniffer( |
| 1110 WebInspector.RuntimeModel.prototype, '_executionContextCreated', che
ckForExecutionContexts.bind(this)); | 1102 WebInspector.RuntimeModel.prototype, '_executionContextCreated', che
ckForExecutionContexts.bind(this)); |
| 1111 } | 1103 } |
| 1112 }; | 1104 }; |
| 1113 | 1105 |
| 1114 | 1106 |
| 1115 window.uiTests = new TestSuite(window.domAutomationController); | 1107 window.uiTests = new TestSuite(window.domAutomationController); |
| 1116 })(window); | 1108 })(window); |
| OLD | NEW |