| OLD | NEW |
| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 embedder.test.assertEq('red', results[0]); | 664 embedder.test.assertEq('red', results[0]); |
| 665 embedder.test.succeed(); | 665 embedder.test.succeed(); |
| 666 }); | 666 }); |
| 667 }); | 667 }); |
| 668 webview.setAttribute('src', 'data:text/html,trigger navigation'); | 668 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
| 669 document.body.appendChild(webview); | 669 document.body.appendChild(webview); |
| 670 } | 670 } |
| 671 | 671 |
| 672 function testExecuteScriptFail() { | 672 function testExecuteScriptFail() { |
| 673 var webview = document.createElement('webview'); | 673 var webview = document.createElement('webview'); |
| 674 try { | 674 document.body.appendChild(webview); |
| 675 setTimeout(function() { |
| 675 webview.executeScript( | 676 webview.executeScript( |
| 676 {code: 'document.body.style.backgroundColor = "red";'}, | 677 {code:'document.body.style.backgroundColor = "red";'}, |
| 677 function(results) { embedder.test.fail(); }); | 678 function(results) { |
| 678 } | 679 embedder.test.fail(); |
| 679 catch (e) { | 680 }); |
| 680 embedder.test.succeed(); | 681 setTimeout(function() { |
| 681 } | 682 embedder.test.succeed(); |
| 683 }, 0); |
| 684 }, 0); |
| 682 } | 685 } |
| 683 | 686 |
| 684 // This test verifies that the call of executeScript will fail and return null | 687 // This test verifies that the call of executeScript will fail and return null |
| 685 // if the webview has been navigated to another source. | 688 // if the webview has been navigated to another source. |
| 686 function testExecuteScriptIsAbortedWhenWebViewSourceIsChanged() { | 689 function testExecuteScriptIsAbortedWhenWebViewSourceIsChanged() { |
| 687 var webview = document.createElement('webview'); | 690 var webview = document.createElement('webview'); |
| 688 var initial = true; | 691 var initial = true; |
| 689 var navigationOccur = false; | 692 var navigationOccur = false; |
| 690 var newSrc = 'data:text/html,trigger navigation'; | 693 var newSrc = 'data:text/html,trigger navigation'; |
| 691 webview.addEventListener('loadstart', function() { | 694 webview.addEventListener('loadstart', function() { |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 1729 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
| 1727 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty | 1730 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty |
| 1728 }; | 1731 }; |
| 1729 | 1732 |
| 1730 onload = function() { | 1733 onload = function() { |
| 1731 chrome.test.getConfig(function(config) { | 1734 chrome.test.getConfig(function(config) { |
| 1732 embedder.setUp_(config); | 1735 embedder.setUp_(config); |
| 1733 chrome.test.sendMessage('LAUNCHED'); | 1736 chrome.test.sendMessage('LAUNCHED'); |
| 1734 }); | 1737 }); |
| 1735 }; | 1738 }; |
| OLD | NEW |