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

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

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (WebInspector.multitargetConsoleModel.messages().length === 1) 520
521 firstConsoleMessageReceived.call(this); 521 function filteredMessages() {
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);
522 else 528 else
523 WebInspector.multitargetConsoleModel.addEventListener( 529 WebInspector.multitargetConsoleModel.addEventListener(
524 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece ived, this); 530 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece ived, this);
525 531
526 function firstConsoleMessageReceived() { 532 function firstConsoleMessageReceived(event) {
533 if (event && event.data.source === WebInspector.ConsoleMessage.MessageSour ce.Violation)
534 return;
527 WebInspector.multitargetConsoleModel.removeEventListener( 535 WebInspector.multitargetConsoleModel.removeEventListener(
528 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece ived, this); 536 WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageRece ived, this);
529 this.evaluateInConsole_('clickLink();', didClickLink.bind(this)); 537 this.evaluateInConsole_('clickLink();', didClickLink.bind(this));
530 } 538 }
531 539
532 function didClickLink() { 540 function didClickLink() {
533 // Check that there are no new messages(command is not a message). 541 // Check that there are no new messages(command is not a message).
534 this.assertEquals(3, WebInspector.multitargetConsoleModel.messages().lengt h); 542 this.assertEquals(3, filteredMessages().length);
535 this.evaluateInConsole_('history.back();', didNavigateBack.bind(this)); 543 this.evaluateInConsole_('history.back();', didNavigateBack.bind(this));
536 } 544 }
537 545
538 function didNavigateBack() { 546 function didNavigateBack() {
539 // Make sure navigation completed and possible console messages were pushe d. 547 // Make sure navigation completed and possible console messages were pushe d.
540 this.evaluateInConsole_('void 0;', didCompleteNavigation.bind(this)); 548 this.evaluateInConsole_('void 0;', didCompleteNavigation.bind(this));
541 } 549 }
542 550
543 function didCompleteNavigation() { 551 function didCompleteNavigation() {
544 this.assertEquals(7, WebInspector.multitargetConsoleModel.messages().lengt h); 552 this.assertEquals(7, filteredMessages().length);
545 this.releaseControl(); 553 this.releaseControl();
546 } 554 }
547 555
548 this.takeControl(); 556 this.takeControl();
549 }; 557 };
550 558
551 TestSuite.prototype.testSharedWorker = function() { 559 TestSuite.prototype.testSharedWorker = function() {
552 function didEvaluateInConsole(resultText) { 560 function didEvaluateInConsole(resultText) {
553 this.assertEquals('2011', resultText); 561 this.assertEquals('2011', resultText);
554 this.releaseControl(); 562 this.releaseControl();
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 callback.call(null); 1107 callback.call(null);
1100 else 1108 else
1101 this.addSniffer( 1109 this.addSniffer(
1102 WebInspector.RuntimeModel.prototype, '_executionContextCreated', che ckForExecutionContexts.bind(this)); 1110 WebInspector.RuntimeModel.prototype, '_executionContextCreated', che ckForExecutionContexts.bind(this));
1103 } 1111 }
1104 }; 1112 };
1105 1113
1106 1114
1107 window.uiTests = new TestSuite(window.domAutomationController); 1115 window.uiTests = new TestSuite(window.domAutomationController);
1108 })(window); 1116 })(window);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698