| 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 ' id="object-plugin"' + | 692 ' id="object-plugin"' + |
| 693 ' src="data:text/html,<body>You should not see this</body>">' + | 693 ' src="data:text/html,<body>You should not see this</body>">' + |
| 694 '</object>'; | 694 '</object>'; |
| 695 var objectElement = document.getElementById('object-plugin'); | 695 var objectElement = document.getElementById('object-plugin'); |
| 696 // Check that bindings are not registered. | 696 // Check that bindings are not registered. |
| 697 embedder.test.assertTrue( | 697 embedder.test.assertTrue( |
| 698 objectElement['-internal-attach'] === undefined); | 698 objectElement['-internal-attach'] === undefined); |
| 699 embedder.test.succeed(); | 699 embedder.test.succeed(); |
| 700 } | 700 } |
| 701 | 701 |
| 702 function testPluginLoadPermission() { |
| 703 var pluginIdentifier = 'unknown platform'; |
| 704 if (navigator.platform.match(/linux/i)) |
| 705 pluginIdentifier = 'libppapi_tests.so'; |
| 706 else if (navigator.platform.match(/win32/i)) |
| 707 pluginIdentifier = 'ppapi_tests.dll'; |
| 708 else if (navigator.platform.match(/mac/i)) |
| 709 pluginIdentifier = 'ppapi_tests.plugin'; |
| 710 |
| 711 var webview = document.createElement('webview'); |
| 712 webview.addEventListener('permissionrequest', function(e) { |
| 713 e.preventDefault(); |
| 714 embedder.test.assertEq('loadplugin', e.permission); |
| 715 embedder.test.assertEq(pluginIdentifier, e.name); |
| 716 embedder.test.assertEq(pluginIdentifier, e.identifier); |
| 717 embedder.test.assertEq('function', typeof e.request.allow); |
| 718 embedder.test.assertEq('function', typeof e.request.deny); |
| 719 embedder.test.succeed(); |
| 720 }); |
| 721 webview.setAttribute('src', 'data:text/html,<body>' + |
| 722 '<embed type="application/x-ppapi-tests">' + |
| 723 '</embed></body>'); |
| 724 document.body.appendChild(webview); |
| 725 } |
| 726 |
| 702 // This test verifies that new window attachment functions as expected. | 727 // This test verifies that new window attachment functions as expected. |
| 703 function testNewWindow() { | 728 function testNewWindow() { |
| 704 var webview = document.createElement('webview'); | 729 var webview = document.createElement('webview'); |
| 705 webview.addEventListener('newwindow', function(e) { | 730 webview.addEventListener('newwindow', function(e) { |
| 706 e.preventDefault(); | 731 e.preventDefault(); |
| 707 var newwebview = document.createElement('webview'); | 732 var newwebview = document.createElement('webview'); |
| 708 newwebview.addEventListener('loadstop', function(evt) { | 733 newwebview.addEventListener('loadstop', function(evt) { |
| 709 // If the new window finishes loading, the test is successful. | 734 // If the new window finishes loading, the test is successful. |
| 710 embedder.test.succeed(); | 735 embedder.test.succeed(); |
| 711 }); | 736 }); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 'testExecuteScriptFail': testExecuteScriptFail, | 1090 'testExecuteScriptFail': testExecuteScriptFail, |
| 1066 'testExecuteScript': testExecuteScript, | 1091 'testExecuteScript': testExecuteScript, |
| 1067 'testTerminateAfterExit': testTerminateAfterExit, | 1092 'testTerminateAfterExit': testTerminateAfterExit, |
| 1068 'testAssignSrcAfterCrash': testAssignSrcAfterCrash, | 1093 'testAssignSrcAfterCrash': testAssignSrcAfterCrash, |
| 1069 'testNavOnConsecutiveSrcAttributeChanges': | 1094 'testNavOnConsecutiveSrcAttributeChanges': |
| 1070 testNavOnConsecutiveSrcAttributeChanges, | 1095 testNavOnConsecutiveSrcAttributeChanges, |
| 1071 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, | 1096 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, |
| 1072 'testReassignSrcAttribute': testReassignSrcAttribute, | 1097 'testReassignSrcAttribute': testReassignSrcAttribute, |
| 1073 'testRemoveSrcAttribute': testRemoveSrcAttribute, | 1098 'testRemoveSrcAttribute': testRemoveSrcAttribute, |
| 1074 'testBrowserPluginNotAllowed': testBrowserPluginNotAllowed, | 1099 'testBrowserPluginNotAllowed': testBrowserPluginNotAllowed, |
| 1100 'testPluginLoadPermission': testPluginLoadPermission, |
| 1075 'testNewWindow': testNewWindow, | 1101 'testNewWindow': testNewWindow, |
| 1076 'testNewWindowTwoListeners': testNewWindowTwoListeners, | 1102 'testNewWindowTwoListeners': testNewWindowTwoListeners, |
| 1077 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, | 1103 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, |
| 1078 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, | 1104 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, |
| 1079 'testContentLoadEvent': testContentLoadEvent, | 1105 'testContentLoadEvent': testContentLoadEvent, |
| 1080 'testWebRequestAPI': testWebRequestAPI, | 1106 'testWebRequestAPI': testWebRequestAPI, |
| 1081 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, | 1107 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, |
| 1082 'testWebRequestListenerSurvivesReparenting': | 1108 'testWebRequestListenerSurvivesReparenting': |
| 1083 testWebRequestListenerSurvivesReparenting, | 1109 testWebRequestListenerSurvivesReparenting, |
| 1084 'testGetProcessId': testGetProcessId, | 1110 'testGetProcessId': testGetProcessId, |
| 1085 'testLoadStartLoadRedirect': testLoadStartLoadRedirect, | 1111 'testLoadStartLoadRedirect': testLoadStartLoadRedirect, |
| 1086 'testLoadAbortEmptyResponse': testLoadAbortEmptyResponse, | 1112 'testLoadAbortEmptyResponse': testLoadAbortEmptyResponse, |
| 1087 'testLoadAbortIllegalChromeURL': testLoadAbortIllegalChromeURL, | 1113 'testLoadAbortIllegalChromeURL': testLoadAbortIllegalChromeURL, |
| 1088 'testLoadAbortIllegalFileURL': testLoadAbortIllegalFileURL, | 1114 'testLoadAbortIllegalFileURL': testLoadAbortIllegalFileURL, |
| 1089 'testLoadAbortIllegalJavaScriptURL': testLoadAbortIllegalJavaScriptURL, | 1115 'testLoadAbortIllegalJavaScriptURL': testLoadAbortIllegalJavaScriptURL, |
| 1090 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, | 1116 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, |
| 1091 'testReload': testReload, | 1117 'testReload': testReload, |
| 1092 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, | 1118 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, |
| 1093 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, | 1119 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, |
| 1094 'testResizeWebviewResizesContent': testResizeWebviewResizesContent | 1120 'testResizeWebviewResizesContent': testResizeWebviewResizesContent |
| 1095 }; | 1121 }; |
| 1096 | 1122 |
| 1097 onload = function() { | 1123 onload = function() { |
| 1098 chrome.test.getConfig(function(config) { | 1124 chrome.test.getConfig(function(config) { |
| 1099 embedder.setUp_(config); | 1125 embedder.setUp_(config); |
| 1100 chrome.test.sendMessage("Launched"); | 1126 chrome.test.sendMessage("Launched"); |
| 1101 }); | 1127 }); |
| 1102 }; | 1128 }; |
| OLD | NEW |