| 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 = [ |
| 11 /** | 11 /** |
| 12 * Test that the page is sized to the size of the document. | 12 * Test that the page is sized to the size of the document. |
| 13 */ | 13 */ |
| 14 function testPageSize() { | 14 function testPageSize() { |
| 15 // Verify that the initial zoom is less than or equal to 100%. | 15 // Verify that the initial zoom is less than or equal to 100%. |
| 16 chrome.test.assertTrue(viewer.viewport.zoom <= 1); | 16 chrome.test.assertTrue(viewer.viewport.zoom <= 1); |
| 17 | 17 |
| 18 viewer.viewport.setZoom(1); | 18 viewer.viewport.setZoom(1); |
| 19 var sizer = document.getElementById('sizer'); | 19 var sizer = document.getElementById('sizer'); |
| 20 chrome.test.assertEq(826, sizer.offsetWidth); | 20 chrome.test.assertEq(826, sizer.offsetWidth); |
| 21 chrome.test.assertEq(1066 + viewer.viewport.topToolbarHeight_, | 21 chrome.test.assertEq(1066, sizer.offsetHeight); |
| 22 sizer.offsetHeight); | |
| 23 chrome.test.succeed(); | 22 chrome.test.succeed(); |
| 24 }, | 23 }, |
| 25 | 24 |
| 26 function testAccessibility() { | 25 function testAccessibility() { |
| 27 scriptingAPI.getAccessibilityJSON(chrome.test.callbackPass(function(json) { | 26 scriptingAPI.getAccessibilityJSON(chrome.test.callbackPass(function(json) { |
| 28 var dict = JSON.parse(json); | 27 var dict = JSON.parse(json); |
| 29 chrome.test.assertEq(true, dict.copyable); | 28 chrome.test.assertEq(true, dict.copyable); |
| 30 chrome.test.assertEq(true, dict.loaded); | 29 chrome.test.assertEq(true, dict.loaded); |
| 31 chrome.test.assertEq(1, dict.numberOfPages); | 30 chrome.test.assertEq(1, dict.numberOfPages); |
| 32 })); | 31 })); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 54 client.getSelectedText(chrome.test.callbackPass(function(selectedText) { | 53 client.getSelectedText(chrome.test.callbackPass(function(selectedText) { |
| 55 chrome.test.assertEq('this is some text\nsome more text', selectedText); | 54 chrome.test.assertEq('this is some text\nsome more text', selectedText); |
| 56 })); | 55 })); |
| 57 }, | 56 }, |
| 58 ]; | 57 ]; |
| 59 | 58 |
| 60 var scriptingAPI = new PDFScriptingAPI(window, window); | 59 var scriptingAPI = new PDFScriptingAPI(window, window); |
| 61 scriptingAPI.setLoadCallback(function() { | 60 scriptingAPI.setLoadCallback(function() { |
| 62 chrome.test.runTests(tests); | 61 chrome.test.runTests(tests); |
| 63 }); | 62 }); |
| OLD | NEW |