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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 webview.addEventListener('loadcommit', onLoadCommitA); | 573 webview.addEventListener('loadcommit', onLoadCommitA); |
574 webview.addEventListener('loadcommit', onLoadCommitB); | 574 webview.addEventListener('loadcommit', onLoadCommitB); |
575 webview.setAttribute('src', url); | 575 webview.setAttribute('src', url); |
576 } | 576 } |
577 | 577 |
578 // This test verifies that setting the partition attribute after the src has | 578 // This test verifies that setting the partition attribute after the src has |
579 // been set raises an exception. | 579 // been set raises an exception. |
580 function testPartitionRaisesException() { | 580 function testPartitionRaisesException() { |
581 var webview = document.createElement('webview'); | 581 var webview = document.createElement('webview'); |
582 webview.setAttribute('partition', arguments.callee.name); | 582 webview.setAttribute('partition', arguments.callee.name); |
583 webview.setAttribute('src', 'data:text/html,trigger navigation'); | 583 |
584 document.body.appendChild(webview); | 584 var loadstopHandler = function(e) { |
585 setTimeout(function() { | |
586 try { | 585 try { |
587 webview.partition = 'illegal'; | 586 webview.partition = 'illegal'; |
588 embedder.test.fail(); | 587 embedder.test.fail(); |
589 } catch (e) { | 588 } catch (e) { |
590 embedder.test.succeed(); | 589 embedder.test.succeed(); |
591 } | 590 } |
592 }, 0); | 591 }; |
| 592 webview.addEventListener('loadstop', loadstopHandler); |
| 593 |
| 594 document.body.appendChild(webview); |
| 595 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
593 } | 596 } |
594 | 597 |
595 function testExecuteScriptFail() { | 598 function testExecuteScriptFail() { |
596 var webview = document.createElement('webview'); | 599 var webview = document.createElement('webview'); |
597 document.body.appendChild(webview); | 600 document.body.appendChild(webview); |
598 setTimeout(function() { | 601 setTimeout(function() { |
599 try { | 602 try { |
600 webview.executeScript( | 603 webview.executeScript( |
601 {code:'document.body.style.backgroundColor = "red";'}, | 604 {code:'document.body.style.backgroundColor = "red";'}, |
602 function(results) { | 605 function(results) { |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 'testFindAPI': testFindAPI, | 1735 'testFindAPI': testFindAPI, |
1733 'testFindAPI_findupdate': testFindAPI | 1736 'testFindAPI_findupdate': testFindAPI |
1734 }; | 1737 }; |
1735 | 1738 |
1736 onload = function() { | 1739 onload = function() { |
1737 chrome.test.getConfig(function(config) { | 1740 chrome.test.getConfig(function(config) { |
1738 embedder.setUp_(config); | 1741 embedder.setUp_(config); |
1739 chrome.test.sendMessage("Launched"); | 1742 chrome.test.sendMessage("Launched"); |
1740 }); | 1743 }); |
1741 }; | 1744 }; |
OLD | NEW |