OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var util = {}; | 5 var util = {}; |
6 var embedder = {}; | 6 var embedder = {}; |
7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
8 embedder.emptyGuestURL = ''; | 8 embedder.emptyGuestURL = ''; |
9 embedder.windowOpenGuestURL = ''; | 9 embedder.windowOpenGuestURL = ''; |
10 embedder.noReferrerGuestURL = ''; | 10 embedder.noReferrerGuestURL = ''; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 function testDestroyOnEventListener() { | 500 function testDestroyOnEventListener() { |
501 var webview = util.createWebViewTagInDOM(arguments.callee.name); | 501 var webview = util.createWebViewTagInDOM(arguments.callee.name); |
502 var url = 'data:text/html,<body>Destroy test</body>'; | 502 var url = 'data:text/html,<body>Destroy test</body>'; |
503 | 503 |
504 var loadCommitCount = 0; | 504 var loadCommitCount = 0; |
505 function loadCommitCommon(e) { | 505 function loadCommitCommon(e) { |
506 embedder.test.assertEq('loadcommit', e.type); | 506 embedder.test.assertEq('loadcommit', e.type); |
507 if (url != e.url) | 507 if (url != e.url) |
508 return; | 508 return; |
509 ++loadCommitCount; | 509 ++loadCommitCount; |
510 if (loadCommitCount == 1) { | 510 if (loadCommitCount == 2) { |
| 511 // Pass in a timeout so that we can catch if any additional loadcommit |
| 512 // occurs. |
511 setTimeout(function() { | 513 setTimeout(function() { |
512 embedder.test.succeed(); | 514 embedder.test.succeed(); |
513 }, 0); | 515 }, 0); |
514 } else if (loadCommitCount > 2) { | 516 } else if (loadCommitCount > 2) { |
515 embedder.test.fail(); | 517 embedder.test.fail(); |
516 } | 518 } |
517 }; | 519 }; |
518 | 520 |
519 // The test starts from here, by setting the src to |url|. | 521 // The test starts from here, by setting the src to |url|. |
520 webview.addEventListener('loadcommit', function(e) { | 522 webview.addEventListener('loadcommit', function(e) { |
| 523 window.console.log('loadcommit1'); |
521 webview.parentNode.removeChild(webview); | 524 webview.parentNode.removeChild(webview); |
522 loadCommitCommon(e); | 525 loadCommitCommon(e); |
523 }); | 526 }); |
524 webview.addEventListener('loadcommit', function(e) { | 527 webview.addEventListener('loadcommit', function(e) { |
| 528 window.console.log('loadcommit2'); |
525 loadCommitCommon(e); | 529 loadCommitCommon(e); |
526 }); | 530 }); |
527 webview.setAttribute('src', url); | 531 webview.setAttribute('src', url); |
528 } | 532 } |
529 | 533 |
530 // This test registers two event listeners on a same event (loadcommit). | 534 // This test registers two event listeners on a same event (loadcommit). |
531 // Each of the listener tries to change some properties on the event param, | 535 // Each of the listener tries to change some properties on the event param, |
532 // which should not be possible. | 536 // which should not be possible. |
533 function testCannotMutateEventName() { | 537 function testCannotMutateEventName() { |
534 var webview = util.createWebViewTagInDOM(arguments.callee.name); | 538 var webview = util.createWebViewTagInDOM(arguments.callee.name); |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 'testFindAPI': testFindAPI, | 1739 'testFindAPI': testFindAPI, |
1736 'testFindAPI_findupdate': testFindAPI | 1740 'testFindAPI_findupdate': testFindAPI |
1737 }; | 1741 }; |
1738 | 1742 |
1739 onload = function() { | 1743 onload = function() { |
1740 chrome.test.getConfig(function(config) { | 1744 chrome.test.getConfig(function(config) { |
1741 embedder.setUp_(config); | 1745 embedder.setUp_(config); |
1742 chrome.test.sendMessage("Launched"); | 1746 chrome.test.sendMessage("Launched"); |
1743 }); | 1747 }); |
1744 }; | 1748 }; |
OLD | NEW |