| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 webview.removeEventListener('loadstop', onLoadStop); | 718 webview.removeEventListener('loadstop', onLoadStop); |
| 719 }); | 719 }); |
| 720 | 720 |
| 721 window.console.log('1. Performing initial navigation.'); | 721 window.console.log('1. Performing initial navigation.'); |
| 722 webview.setAttribute('src', 'about:blank'); | 722 webview.setAttribute('src', 'about:blank'); |
| 723 document.body.appendChild(webview); | 723 document.body.appendChild(webview); |
| 724 } | 724 } |
| 725 | 725 |
| 726 function testFindAPI() { | 726 function testFindAPI() { |
| 727 var webview = new WebView(); | 727 var webview = new WebView(); |
| 728 webview.src = 'data:text/html,Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 728 webview.src = 'data:text/html,Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 729 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 729 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 730 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 730 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 731 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 731 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 732 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 732 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 733 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 733 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 734 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 734 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 735 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 735 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 736 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 736 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 737 'Dog dog dog Dog dog dogcatDog dogDogdog.<br><br>' + | 737 'Dog dog dog Dog dog dogcatDog dogDogdog<br><br>' + |
| 738 '<a href="about:blank">Click here!</a>'; | 738 '<a href="about:blank">Click here!</a>'; |
| 739 | 739 |
| 740 var loadstopListener2 = function(e) { | 740 var loadstopListener2 = function(e) { |
| 741 embedder.test.assertEq(webview.src, "about:blank"); | 741 embedder.test.assertEq(webview.src, "about:blank"); |
| 742 embedder.test.succeed(); | 742 embedder.test.succeed(); |
| 743 } | 743 } |
| 744 | 744 |
| 745 var loadstopListener1 = function(e) { | 745 var loadstopListener1 = function(e) { |
| 746 // Test find results. | 746 // Test find results. |
| 747 webview.find("dog", {}, function(results) { | 747 webview.find("dog", {}, function(results) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 }); | 793 }); |
| 794 }); | 794 }); |
| 795 }; | 795 }; |
| 796 | 796 |
| 797 webview.addEventListener('loadstop', loadstopListener1); | 797 webview.addEventListener('loadstop', loadstopListener1); |
| 798 document.body.appendChild(webview); | 798 document.body.appendChild(webview); |
| 799 }; | 799 }; |
| 800 | 800 |
| 801 function testFindAPI_findupdate() { | 801 function testFindAPI_findupdate() { |
| 802 var webview = new WebView(); | 802 var webview = new WebView(); |
| 803 webview.src = 'data:text/html,Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 803 webview.src = 'data:text/html,Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 804 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 804 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 805 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 805 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 806 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 806 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 807 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 807 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 808 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 808 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 809 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 809 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 810 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 810 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 811 'Dog dog dog Dog dog dogcatDog dogDogdog.<br>' + | 811 'Dog dog dog Dog dog dogcatDog dogDogdog<br>' + |
| 812 'Dog dog dog Dog dog dogcatDog dogDogdog.<br><br>' + | 812 'Dog dog dog Dog dog dogcatDog dogDogdog<br><br>' + |
| 813 '<a href="about:blank">Click here!</a>'; | 813 '<a href="about:blank">Click here!</a>'; |
| 814 var canceledTest = false; | 814 var canceledTest = false; |
| 815 webview.addEventListener('loadstop', function(e) { | 815 webview.addEventListener('loadstop', function(e) { |
| 816 // Test the |findupdate| event. | 816 // Test the |findupdate| event. |
| 817 webview.addEventListener('findupdate', function(e) { | 817 webview.addEventListener('findupdate', function(e) { |
| 818 if (e.activeMatchOrdinal > 0) { | 818 if (e.activeMatchOrdinal > 0) { |
| 819 // embedder.test.assertTrue(e.numberOfMatches >= e.activeMatchOrdinal) | 819 // embedder.test.assertTrue(e.numberOfMatches >= e.activeMatchOrdinal) |
| 820 // This currently fails because of http://crbug.com/342445 . | 820 // This currently fails because of http://crbug.com/342445 . |
| 821 embedder.test.assertTrue(e.selectionRect.width > 0); | 821 embedder.test.assertTrue(e.selectionRect.width > 0); |
| 822 embedder.test.assertTrue(e.selectionRect.height > 0); | 822 embedder.test.assertTrue(e.selectionRect.height > 0); |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 1745 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
| 1746 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty | 1746 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty |
| 1747 }; | 1747 }; |
| 1748 | 1748 |
| 1749 onload = function() { | 1749 onload = function() { |
| 1750 chrome.test.getConfig(function(config) { | 1750 chrome.test.getConfig(function(config) { |
| 1751 embedder.setUp_(config); | 1751 embedder.setUp_(config); |
| 1752 chrome.test.sendMessage('LAUNCHED'); | 1752 chrome.test.sendMessage('LAUNCHED'); |
| 1753 }); | 1753 }); |
| 1754 }; | 1754 }; |
| OLD | NEW |