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 scriptingAPI; | 5 var scriptingAPI; |
6 | 6 |
7 /** | 7 /** |
8 * These tests require that the PDF plugin be available to run correctly. | 8 * These tests require that the PDF plugin be available to run correctly. |
9 */ | 9 */ |
10 var tests = [ | 10 var tests = [ |
(...skipping 27 matching lines...) Expand all Loading... |
38 chrome.test.assertEq(792, dict.height); | 38 chrome.test.assertEq(792, dict.height); |
39 chrome.test.assertEq(1.0, dict.textBox[0].fontSize); | 39 chrome.test.assertEq(1.0, dict.textBox[0].fontSize); |
40 chrome.test.assertEq('text', dict.textBox[0].textNodes[0].type); | 40 chrome.test.assertEq('text', dict.textBox[0].textNodes[0].type); |
41 chrome.test.assertEq('this is some text', | 41 chrome.test.assertEq('this is some text', |
42 dict.textBox[0].textNodes[0].text); | 42 dict.textBox[0].textNodes[0].text); |
43 chrome.test.assertEq(1.0, dict.textBox[1].fontSize); | 43 chrome.test.assertEq(1.0, dict.textBox[1].fontSize); |
44 chrome.test.assertEq('text', dict.textBox[1].textNodes[0].type); | 44 chrome.test.assertEq('text', dict.textBox[1].textNodes[0].type); |
45 chrome.test.assertEq('some more text', | 45 chrome.test.assertEq('some more text', |
46 dict.textBox[1].textNodes[0].text); | 46 dict.textBox[1].textNodes[0].text); |
47 }), 0); | 47 }), 0); |
48 } | 48 }, |
| 49 |
| 50 function testGetSelectedText() { |
| 51 var client = new PDFScriptingAPI(window, window); |
| 52 client.selectAll(); |
| 53 client.getSelectedText(chrome.test.callbackPass(function(selectedText) { |
| 54 chrome.test.assertEq('this is some text\nsome more text', selectedText); |
| 55 })); |
| 56 }, |
49 ]; | 57 ]; |
50 | 58 |
51 var scriptingAPI = new PDFScriptingAPI(window, window); | 59 var scriptingAPI = new PDFScriptingAPI(window, window); |
52 scriptingAPI.setLoadCallback(function() { | 60 scriptingAPI.setLoadCallback(function() { |
53 chrome.test.runTests(tests); | 61 chrome.test.runTests(tests); |
54 }); | 62 }); |
OLD | NEW |