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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // Try to overwrite webview.request, shall not succeed. | 538 // Try to overwrite webview.request, shall not succeed. |
539 webview.request = '123'; | 539 webview.request = '123'; |
540 embedder.test.assertTrue(typeof webview.request !== 'string'); | 540 embedder.test.assertTrue(typeof webview.request !== 'string'); |
541 | 541 |
542 embedder.test.succeed(); | 542 embedder.test.succeed(); |
543 }); | 543 }); |
544 webview.setAttribute('src', 'data:text/html,webview check api'); | 544 webview.setAttribute('src', 'data:text/html,webview check api'); |
545 document.body.appendChild(webview); | 545 document.body.appendChild(webview); |
546 } | 546 } |
547 | 547 |
| 548 function testDeclarativeContentAPIExistence() { |
| 549 var apiPropertiesToCheck = [ |
| 550 // Declarative Content API. |
| 551 'onPageChanged' |
| 552 ]; |
| 553 var webview = document.createElement('webview'); |
| 554 webview.setAttribute('partition', arguments.callee.name); |
| 555 webview.addEventListener('loadstop', function(e) { |
| 556 for (var i = 0; i < apiPropertiesToCheck.length; ++i) { |
| 557 embedder.test.assertEq('object', |
| 558 typeof webview.request[apiPropertiesToCheck[i]]); |
| 559 embedder.test.assertEq( |
| 560 'function', |
| 561 typeof webview.request[apiPropertiesToCheck[i]].addRules); |
| 562 embedder.test.assertEq( |
| 563 'function', |
| 564 typeof webview.request[apiPropertiesToCheck[i]].getRules); |
| 565 embedder.test.assertEq( |
| 566 'function', |
| 567 typeof webview.request[apiPropertiesToCheck[i]].removeRules); |
| 568 } |
| 569 |
| 570 // Try to overwrite webview.request, shall not succeed. |
| 571 webview.request = '123'; |
| 572 embedder.test.assertTrue(typeof webview.request !== 'string'); |
| 573 |
| 574 embedder.test.succeed(); |
| 575 }); |
| 576 webview.setAttribute('src', 'data:text/html,webview check api'); |
| 577 document.body.appendChild(webview); |
| 578 } |
| 579 |
548 // This test verifies that the loadstart, loadstop, and exit events fire as | 580 // This test verifies that the loadstart, loadstop, and exit events fire as |
549 // expected. | 581 // expected. |
550 function testEventName() { | 582 function testEventName() { |
551 var webview = document.createElement('webview'); | 583 var webview = document.createElement('webview'); |
552 webview.setAttribute('partition', arguments.callee.name); | 584 webview.setAttribute('partition', arguments.callee.name); |
553 | 585 |
554 webview.addEventListener('loadstart', function(evt) { | 586 webview.addEventListener('loadstart', function(evt) { |
555 embedder.test.assertEq('loadstart', evt.type); | 587 embedder.test.assertEq('loadstart', evt.type); |
556 }); | 588 }); |
557 | 589 |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, | 2041 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, |
2010 'testAPIMethodExistence': testAPIMethodExistence, | 2042 'testAPIMethodExistence': testAPIMethodExistence, |
2011 'testChromeExtensionURL': testChromeExtensionURL, | 2043 'testChromeExtensionURL': testChromeExtensionURL, |
2012 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, | 2044 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, |
2013 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, | 2045 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, |
2014 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, | 2046 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, |
2015 'testInlineScriptFromAccessibleResources': | 2047 'testInlineScriptFromAccessibleResources': |
2016 testInlineScriptFromAccessibleResources, | 2048 testInlineScriptFromAccessibleResources, |
2017 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, | 2049 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, |
2018 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 2050 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
| 2051 'testDeclarativeContentAPIExistence': testDeclarativeContentAPIExistence, |
2019 'testEventName': testEventName, | 2052 'testEventName': testEventName, |
2020 'testOnEventProperties': testOnEventProperties, | 2053 'testOnEventProperties': testOnEventProperties, |
2021 'testLoadProgressEvent': testLoadProgressEvent, | 2054 'testLoadProgressEvent': testLoadProgressEvent, |
2022 'testDestroyOnEventListener': testDestroyOnEventListener, | 2055 'testDestroyOnEventListener': testDestroyOnEventListener, |
2023 'testCannotMutateEventName': testCannotMutateEventName, | 2056 'testCannotMutateEventName': testCannotMutateEventName, |
2024 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation, | 2057 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation, |
2025 'testPartitionRemovalAfterNavigationFails': | 2058 'testPartitionRemovalAfterNavigationFails': |
2026 testPartitionRemovalAfterNavigationFails, | 2059 testPartitionRemovalAfterNavigationFails, |
2027 'testExecuteScriptFail': testExecuteScriptFail, | 2060 'testExecuteScriptFail': testExecuteScriptFail, |
2028 'testExecuteScript': testExecuteScript, | 2061 'testExecuteScript': testExecuteScript, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 'testFindAPI_findupdate': testFindAPI, | 2110 'testFindAPI_findupdate': testFindAPI, |
2078 'testLoadDataAPI': testLoadDataAPI | 2111 'testLoadDataAPI': testLoadDataAPI |
2079 }; | 2112 }; |
2080 | 2113 |
2081 onload = function() { | 2114 onload = function() { |
2082 chrome.test.getConfig(function(config) { | 2115 chrome.test.getConfig(function(config) { |
2083 embedder.setUp_(config); | 2116 embedder.setUp_(config); |
2084 chrome.test.sendMessage("Launched"); | 2117 chrome.test.sendMessage("Launched"); |
2085 }); | 2118 }); |
2086 }; | 2119 }; |
OLD | NEW |