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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Test find results when looking for nothing. |
| 743 webview.find("", {}, function(results) { |
| 744 embedder.test.assertEq(results.numberOfMatches, 0); |
| 745 embedder.test.assertEq(results.activeMatchOrdinal, 0); |
| 746 embedder.test.assertEq(results.selectionRect.left, 0); |
| 747 embedder.test.assertEq(results.selectionRect.top, 0); |
| 748 embedder.test.assertEq(results.selectionRect.width, 0); |
| 749 embedder.test.assertEq(results.selectionRect.height, 0); |
| 750 |
| 751 embedder.test.succeed(); |
| 752 }); |
743 } | 753 } |
744 | 754 |
745 var loadstopListener1 = function(e) { | 755 var loadstopListener1 = function(e) { |
746 // Test find results. | 756 // Test find results. |
747 webview.find("dog", {}, function(results) { | 757 webview.find("dog", {}, function(results) { |
748 callbackTest = true; | |
749 embedder.test.assertEq(results.numberOfMatches, 100); | 758 embedder.test.assertEq(results.numberOfMatches, 100); |
750 embedder.test.assertTrue(results.selectionRect.width > 0); | 759 embedder.test.assertTrue(results.selectionRect.width > 0); |
751 embedder.test.assertTrue(results.selectionRect.height > 0); | 760 embedder.test.assertTrue(results.selectionRect.height > 0); |
752 | 761 |
753 // Test finding next active matches. | 762 // Test finding next active matches. |
754 webview.find("dog"); | 763 webview.find("dog"); |
755 webview.find("dog"); | 764 webview.find("dog"); |
756 webview.find("dog"); | 765 webview.find("dog"); |
757 webview.find("dog"); | 766 webview.find("dog"); |
758 webview.find("dog", {}, function(results) { | 767 webview.find("dog", {}, function(results) { |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 1754 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
1746 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty | 1755 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty |
1747 }; | 1756 }; |
1748 | 1757 |
1749 onload = function() { | 1758 onload = function() { |
1750 chrome.test.getConfig(function(config) { | 1759 chrome.test.getConfig(function(config) { |
1751 embedder.setUp_(config); | 1760 embedder.setUp_(config); |
1752 chrome.test.sendMessage('LAUNCHED'); | 1761 chrome.test.sendMessage('LAUNCHED'); |
1753 }); | 1762 }); |
1754 }; | 1763 }; |
OLD | NEW |