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

Side by Side Diff: extensions/test/data/web_view/apitest/main.js

Issue 698973003: Got rid of the internal copies of webview attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Created 6 years, 1 month 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
« no previous file with comments | « extensions/renderer/resources/guest_view/web_view_attributes.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 embedder = {}; 5 var embedder = {};
6 6
7 // TODO(lfg) Move these functions to a common js. 7 // TODO(lfg) Move these functions to a common js.
8 embedder.setUp_ = function(config) { 8 embedder.setUp_ = function(config) {
9 if (!config || !config.testServer) { 9 if (!config || !config.testServer) {
10 return; 10 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 }; 64 };
65 65
66 66
67 // Tests begin. 67 // Tests begin.
68 68
69 // This test verifies that the allowtransparency property cannot be changed 69 // This test verifies that the allowtransparency property cannot be changed
70 // once set. The attribute can only be deleted. 70 // once set. The attribute can only be deleted.
71 function testAllowTransparencyAttribute() { 71 function testAllowTransparencyAttribute() {
72 var webview = document.createElement('webview'); 72 var webview = document.createElement('webview');
73 webview.src = 'data:text/html,webview test'; 73 webview.src = 'data:text/html,webview test';
74 embedder.test.assertFalse(webview.hasAttribute('allowtransparency'));
75 embedder.test.assertFalse(webview.allowtransparency);
74 webview.allowtransparency = true; 76 webview.allowtransparency = true;
75 77
76 webview.addEventListener('loadstop', function(e) { 78 webview.addEventListener('loadstop', function(e) {
77 embedder.test.assertTrue(webview.hasAttribute('allowtransparency')); 79 embedder.test.assertTrue(webview.hasAttribute('allowtransparency'));
80 embedder.test.assertTrue(webview.allowtransparency);
78 webview.allowtransparency = false; 81 webview.allowtransparency = false;
82 embedder.test.assertFalse(webview.hasAttribute('allowtransparency'));
83 embedder.test.assertFalse(webview.allowtransparency);
84 webview.allowtransparency = '';
85 embedder.test.assertFalse(webview.hasAttribute('allowtransparency'));
86 embedder.test.assertFalse(webview.allowtransparency);
87 webview.allowtransparency = 'some string';
88 embedder.test.assertTrue(webview.hasAttribute('allowtransparency'));
79 embedder.test.assertTrue(webview.allowtransparency); 89 embedder.test.assertTrue(webview.allowtransparency);
80 embedder.test.assertTrue(webview.hasAttribute('allowtransparency'));
81 webview.removeAttribute('allowtransparency');
82 embedder.test.assertFalse(webview.allowtransparency);
83 embedder.test.succeed(); 90 embedder.test.succeed();
84 }); 91 });
85 92
86 document.body.appendChild(webview); 93 document.body.appendChild(webview);
87 } 94 }
88 95
89 function testAPIMethodExistence() { 96 function testAPIMethodExistence() {
90 var apiMethodsToCheck = [ 97 var apiMethodsToCheck = [
91 'back', 98 'back',
92 'find', 99 'find',
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 embedder.test.succeed(); 1282 embedder.test.succeed();
1276 }; 1283 };
1277 1284
1278 webview.setAttribute('src', 'data:text/html,next navigation'); 1285 webview.setAttribute('src', 'data:text/html,next navigation');
1279 }); 1286 });
1280 1287
1281 webview.setAttribute('src', 'data:text/html,trigger navigation'); 1288 webview.setAttribute('src', 'data:text/html,trigger navigation');
1282 document.body.appendChild(webview); 1289 document.body.appendChild(webview);
1283 } 1290 }
1284 1291
1285 // This test verifies that setting the partition attribute after the src has 1292 // This test verifies that the partion attribute cannot be changed after the src
1286 // been set raises an exception. 1293 // has been set.
1287 function testPartitionRaisesException() { 1294 function testPartitionChangeAfterNavigation() {
1288 var webview = document.createElement('webview'); 1295 var webview = document.createElement('webview');
1289 var partitionAttribute = arguments.callee.name; 1296 var partitionAttribute = arguments.callee.name;
1290 webview.setAttribute('partition', partitionAttribute); 1297 webview.setAttribute('partition', partitionAttribute);
1291 1298
1292 var loadstopHandler = function(e) { 1299 var loadstopHandler = function(e) {
1293 try { 1300 webview.partition = 'illegal';
1294 webview.partition = 'illegal'; 1301 embedder.test.assertEq(partitionAttribute, webview.partition);
1295 embedder.test.fail(); 1302 embedder.test.succeed();
1296 } catch (e) {
1297 embedder.test.assertEq(partitionAttribute, webview.partition);
1298 embedder.test.succeed();
1299 }
1300 }; 1303 };
1301 webview.addEventListener('loadstop', loadstopHandler); 1304 webview.addEventListener('loadstop', loadstopHandler);
1302 1305
1303 webview.setAttribute('src', 'data:text/html,trigger navigation'); 1306 webview.setAttribute('src', 'data:text/html,trigger navigation');
1304 document.body.appendChild(webview); 1307 document.body.appendChild(webview);
1305 } 1308 }
1306 1309
1307 // This test verifies that removing partition attribute after navigation does 1310 // This test verifies that removing partition attribute after navigation does
1308 // not work, i.e. the partition remains the same. 1311 // not work, i.e. the partition remains the same.
1309 function testPartitionRemovalAfterNavigationFails() { 1312 function testPartitionRemovalAfterNavigationFails() {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 'testNavigateAfterResize': testNavigateAfterResize, 1703 'testNavigateAfterResize': testNavigateAfterResize,
1701 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, 1704 'testNavigationToExternalProtocol': testNavigationToExternalProtocol,
1702 'testNavOnConsecutiveSrcAttributeChanges': 1705 'testNavOnConsecutiveSrcAttributeChanges':
1703 testNavOnConsecutiveSrcAttributeChanges, 1706 testNavOnConsecutiveSrcAttributeChanges,
1704 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, 1707 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange,
1705 'testNewWindow': testNewWindow, 1708 'testNewWindow': testNewWindow,
1706 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, 1709 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault,
1707 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, 1710 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink,
1708 'testNewWindowTwoListeners': testNewWindowTwoListeners, 1711 'testNewWindowTwoListeners': testNewWindowTwoListeners,
1709 'testOnEventProperties': testOnEventProperties, 1712 'testOnEventProperties': testOnEventProperties,
1710 'testPartitionRaisesException': testPartitionRaisesException, 1713 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation,
1711 'testPartitionRemovalAfterNavigationFails': 1714 'testPartitionRemovalAfterNavigationFails':
1712 testPartitionRemovalAfterNavigationFails, 1715 testPartitionRemovalAfterNavigationFails,
1713 'testReassignSrcAttribute': testReassignSrcAttribute, 1716 'testReassignSrcAttribute': testReassignSrcAttribute,
1714 'testReload': testReload, 1717 'testReload': testReload,
1715 'testReloadAfterTerminate': testReloadAfterTerminate, 1718 'testReloadAfterTerminate': testReloadAfterTerminate,
1716 'testRemoveSrcAttribute': testRemoveSrcAttribute, 1719 'testRemoveSrcAttribute': testRemoveSrcAttribute,
1717 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, 1720 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation,
1718 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, 1721 'testRemoveWebviewOnExit': testRemoveWebviewOnExit,
1719 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, 1722 'testResizeWebviewResizesContent': testResizeWebviewResizesContent,
1720 'testTerminateAfterExit': testTerminateAfterExit, 1723 'testTerminateAfterExit': testTerminateAfterExit,
1721 'testWebRequestAPI': testWebRequestAPI, 1724 'testWebRequestAPI': testWebRequestAPI,
1722 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, 1725 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders,
1723 'testWebRequestAPIExistence': testWebRequestAPIExistence, 1726 'testWebRequestAPIExistence': testWebRequestAPIExistence,
1724 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty 1727 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty
1725 }; 1728 };
1726 1729
1727 onload = function() { 1730 onload = function() {
1728 chrome.test.getConfig(function(config) { 1731 chrome.test.getConfig(function(config) {
1729 embedder.setUp_(config); 1732 embedder.setUp_(config);
1730 chrome.test.sendMessage('LAUNCHED'); 1733 chrome.test.sendMessage('LAUNCHED');
1731 }); 1734 });
1732 }; 1735 };
OLDNEW
« no previous file with comments | « extensions/renderer/resources/guest_view/web_view_attributes.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698