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

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/shim/main.js

Issue 299753011: Move allocate instance id to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments addressed Created 6 years, 6 months 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 // 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // on the <webview> tag. 572 // on the <webview> tag.
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 var partitionAttribute = arguments.callee.name;
583 webview.setAttribute('partition', partitionAttribute);
583 webview.setAttribute('src', 'data:text/html,trigger navigation'); 584 webview.setAttribute('src', 'data:text/html,trigger navigation');
584 document.body.appendChild(webview); 585 document.body.appendChild(webview);
585 setTimeout(function() { 586 setTimeout(function() {
586 try { 587 try {
587 webview.partition = 'illegal'; 588 webview.partition = 'illegal';
588 embedder.test.fail(); 589 embedder.test.fail();
589 } catch (e) { 590 } catch (e) {
591 embedder.test.assertEq(partitionAttribute, webview.partition);
590 embedder.test.succeed(); 592 embedder.test.succeed();
591 } 593 }
592 }, 0); 594 }, 0);
593 } 595 }
594 596
597 // This test verifies that removing partition attribute after navigation does
598 // not work, i.e. the partition remains the same.
599 function testPartitionRemovalAfterNavigationFails() {
600 var webview = document.createElement('webview');
601 document.body.appendChild(webview);
602
603 var partition = 'testme';
604 webview.setAttribute('partition', partition);
605
606 var loadstopHandler = function(e) {
607 window.console.log('webview.loadstop');
608 // Removing after navigation should not change the partition.
609 webview.removeAttribute('partition');
610 embedder.test.assertEq('testme', webview.partition);
611 embedder.test.succeed();
612 };
613 webview.addEventListener('loadstop', loadstopHandler);
614
615 webview.setAttribute('src', 'data:text/html,<html><body>guest</body></html>');
616 }
617
595 function testExecuteScriptFail() { 618 function testExecuteScriptFail() {
596 var webview = document.createElement('webview'); 619 var webview = document.createElement('webview');
597 document.body.appendChild(webview); 620 document.body.appendChild(webview);
598 setTimeout(function() { 621 setTimeout(function() {
599 try { 622 try {
600 webview.executeScript( 623 webview.executeScript(
601 {code:'document.body.style.backgroundColor = "red";'}, 624 {code:'document.body.style.backgroundColor = "red";'},
602 function(results) { 625 function(results) {
603 embedder.test.fail(); 626 embedder.test.fail();
604 }); 627 });
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 'testInlineScriptFromAccessibleResources': 1700 'testInlineScriptFromAccessibleResources':
1678 testInlineScriptFromAccessibleResources, 1701 testInlineScriptFromAccessibleResources,
1679 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, 1702 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL,
1680 'testWebRequestAPIExistence': testWebRequestAPIExistence, 1703 'testWebRequestAPIExistence': testWebRequestAPIExistence,
1681 'testEventName': testEventName, 1704 'testEventName': testEventName,
1682 'testOnEventProperties': testOnEventProperties, 1705 'testOnEventProperties': testOnEventProperties,
1683 'testLoadProgressEvent': testLoadProgressEvent, 1706 'testLoadProgressEvent': testLoadProgressEvent,
1684 'testDestroyOnEventListener': testDestroyOnEventListener, 1707 'testDestroyOnEventListener': testDestroyOnEventListener,
1685 'testCannotMutateEventName': testCannotMutateEventName, 1708 'testCannotMutateEventName': testCannotMutateEventName,
1686 'testPartitionRaisesException': testPartitionRaisesException, 1709 'testPartitionRaisesException': testPartitionRaisesException,
1710 'testPartitionRemovalAfterNavigationFails':
1711 testPartitionRemovalAfterNavigationFails,
1687 'testExecuteScriptFail': testExecuteScriptFail, 1712 'testExecuteScriptFail': testExecuteScriptFail,
1688 'testExecuteScript': testExecuteScript, 1713 'testExecuteScript': testExecuteScript,
1689 'testExecuteScriptIsAbortedWhenWebViewSourceIsChanged': 1714 'testExecuteScriptIsAbortedWhenWebViewSourceIsChanged':
1690 testExecuteScriptIsAbortedWhenWebViewSourceIsChanged, 1715 testExecuteScriptIsAbortedWhenWebViewSourceIsChanged,
1691 'testTerminateAfterExit': testTerminateAfterExit, 1716 'testTerminateAfterExit': testTerminateAfterExit,
1692 'testAssignSrcAfterCrash': testAssignSrcAfterCrash, 1717 'testAssignSrcAfterCrash': testAssignSrcAfterCrash,
1693 'testNavOnConsecutiveSrcAttributeChanges': 1718 'testNavOnConsecutiveSrcAttributeChanges':
1694 testNavOnConsecutiveSrcAttributeChanges, 1719 testNavOnConsecutiveSrcAttributeChanges,
1695 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, 1720 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange,
1696 'testReassignSrcAttribute': testReassignSrcAttribute, 1721 'testReassignSrcAttribute': testReassignSrcAttribute,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 'testFindAPI': testFindAPI, 1757 'testFindAPI': testFindAPI,
1733 'testFindAPI_findupdate': testFindAPI 1758 'testFindAPI_findupdate': testFindAPI
1734 }; 1759 };
1735 1760
1736 onload = function() { 1761 onload = function() {
1737 chrome.test.getConfig(function(config) { 1762 chrome.test.getConfig(function(config) {
1738 embedder.setUp_(config); 1763 embedder.setUp_(config);
1739 chrome.test.sendMessage("Launched"); 1764 chrome.test.sendMessage("Launched");
1740 }); 1765 });
1741 }; 1766 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698