| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // Try to overwrite webview.request, shall not succeed. | 542 // Try to overwrite webview.request, shall not succeed. |
| 543 webview.request = '123'; | 543 webview.request = '123'; |
| 544 embedder.test.assertTrue(typeof webview.request !== 'string'); | 544 embedder.test.assertTrue(typeof webview.request !== 'string'); |
| 545 | 545 |
| 546 embedder.test.succeed(); | 546 embedder.test.succeed(); |
| 547 }); | 547 }); |
| 548 webview.setAttribute('src', 'data:text/html,webview check api'); | 548 webview.setAttribute('src', 'data:text/html,webview check api'); |
| 549 document.body.appendChild(webview); | 549 document.body.appendChild(webview); |
| 550 } | 550 } |
| 551 | 551 |
| 552 function testDeclarativeContentAPIExistence() { | |
| 553 var apiPropertiesToCheck = [ | |
| 554 // Declarative Content API. | |
| 555 'onPageChanged' | |
| 556 ]; | |
| 557 var webview = document.createElement('webview'); | |
| 558 webview.setAttribute('partition', arguments.callee.name); | |
| 559 webview.addEventListener('loadstop', function(e) { | |
| 560 for (var i = 0; i < apiPropertiesToCheck.length; ++i) { | |
| 561 embedder.test.assertEq('object', | |
| 562 typeof webview.request[apiPropertiesToCheck[i]]); | |
| 563 embedder.test.assertEq( | |
| 564 'function', | |
| 565 typeof webview.request[apiPropertiesToCheck[i]].addRules); | |
| 566 embedder.test.assertEq( | |
| 567 'function', | |
| 568 typeof webview.request[apiPropertiesToCheck[i]].getRules); | |
| 569 embedder.test.assertEq( | |
| 570 'function', | |
| 571 typeof webview.request[apiPropertiesToCheck[i]].removeRules); | |
| 572 } | |
| 573 | |
| 574 // Try to overwrite webview.request, shall not succeed. | |
| 575 webview.request = '123'; | |
| 576 embedder.test.assertTrue(typeof webview.request !== 'string'); | |
| 577 | |
| 578 embedder.test.succeed(); | |
| 579 }); | |
| 580 webview.setAttribute('src', 'data:text/html,webview check api'); | |
| 581 document.body.appendChild(webview); | |
| 582 } | |
| 583 | |
| 584 // This test verifies that the loadstart, loadstop, and exit events fire as | 552 // This test verifies that the loadstart, loadstop, and exit events fire as |
| 585 // expected. | 553 // expected. |
| 586 function testEventName() { | 554 function testEventName() { |
| 587 var webview = document.createElement('webview'); | 555 var webview = document.createElement('webview'); |
| 588 webview.setAttribute('partition', arguments.callee.name); | 556 webview.setAttribute('partition', arguments.callee.name); |
| 589 | 557 |
| 590 webview.addEventListener('loadstart', function(evt) { | 558 webview.addEventListener('loadstart', function(evt) { |
| 591 embedder.test.assertEq('loadstart', evt.type); | 559 embedder.test.assertEq('loadstart', evt.type); |
| 592 }); | 560 }); |
| 593 | 561 |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, | 2041 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, |
| 2074 'testAPIMethodExistence': testAPIMethodExistence, | 2042 'testAPIMethodExistence': testAPIMethodExistence, |
| 2075 'testChromeExtensionURL': testChromeExtensionURL, | 2043 'testChromeExtensionURL': testChromeExtensionURL, |
| 2076 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, | 2044 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, |
| 2077 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, | 2045 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, |
| 2078 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, | 2046 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, |
| 2079 'testInlineScriptFromAccessibleResources': | 2047 'testInlineScriptFromAccessibleResources': |
| 2080 testInlineScriptFromAccessibleResources, | 2048 testInlineScriptFromAccessibleResources, |
| 2081 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, | 2049 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, |
| 2082 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 2050 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
| 2083 'testDeclarativeContentAPIExistence': testDeclarativeContentAPIExistence, | |
| 2084 'testEventName': testEventName, | 2051 'testEventName': testEventName, |
| 2085 'testOnEventProperties': testOnEventProperties, | 2052 'testOnEventProperties': testOnEventProperties, |
| 2086 'testLoadProgressEvent': testLoadProgressEvent, | 2053 'testLoadProgressEvent': testLoadProgressEvent, |
| 2087 'testDestroyOnEventListener': testDestroyOnEventListener, | 2054 'testDestroyOnEventListener': testDestroyOnEventListener, |
| 2088 'testCannotMutateEventName': testCannotMutateEventName, | 2055 'testCannotMutateEventName': testCannotMutateEventName, |
| 2089 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation, | 2056 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation, |
| 2090 'testPartitionRemovalAfterNavigationFails': | 2057 'testPartitionRemovalAfterNavigationFails': |
| 2091 testPartitionRemovalAfterNavigationFails, | 2058 testPartitionRemovalAfterNavigationFails, |
| 2092 'testExecuteScriptFail': testExecuteScriptFail, | 2059 'testExecuteScriptFail': testExecuteScriptFail, |
| 2093 'testExecuteScript': testExecuteScript, | 2060 'testExecuteScript': testExecuteScript, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 'testFindAPI_findupdate': testFindAPI, | 2110 'testFindAPI_findupdate': testFindAPI, |
| 2144 'testLoadDataAPI': testLoadDataAPI | 2111 'testLoadDataAPI': testLoadDataAPI |
| 2145 }; | 2112 }; |
| 2146 | 2113 |
| 2147 onload = function() { | 2114 onload = function() { |
| 2148 chrome.test.getConfig(function(config) { | 2115 chrome.test.getConfig(function(config) { |
| 2149 embedder.setUp_(config); | 2116 embedder.setUp_(config); |
| 2150 chrome.test.sendMessage("Launched"); | 2117 chrome.test.sendMessage("Launched"); |
| 2151 }); | 2118 }); |
| 2152 }; | 2119 }; |
| OLD | NEW |