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 /** | 5 /** |
6 * These tests require that the PDF plugin be available to run correctly. | 6 * These tests require that the PDF plugin be available to run correctly. |
7 */ | 7 */ |
8 var tests = [ | 8 var tests = [ |
9 /** | 9 /** |
10 * Test that the page is sized to the size of the document. | 10 * Test that the page is sized to the size of the document. |
11 */ | 11 */ |
12 function testPageSize() { | 12 function testPageSize() { |
13 // Verify that the initial zoom is less than or equal to 100%. | 13 // Verify that the initial zoom is less than or equal to 100%. |
14 chrome.test.assertTrue(viewer.viewport.zoom <= 1); | 14 chrome.test.assertTrue(viewer.viewport.zoom <= 1); |
15 | 15 |
16 viewer.viewport.zoom = 1; | 16 viewer.viewport.setZoomForTest_(1); |
17 var sizer = document.getElementById('sizer'); | 17 var sizer = document.getElementById('sizer'); |
18 chrome.test.assertEq(826, sizer.offsetWidth); | 18 chrome.test.assertEq(826, sizer.offsetWidth); |
19 chrome.test.assertEq(1066, sizer.offsetHeight); | 19 chrome.test.assertEq(1066, sizer.offsetHeight); |
20 chrome.test.succeed(); | 20 chrome.test.succeed(); |
21 }, | 21 }, |
22 | 22 |
23 function testAccessibility() { | 23 function testAccessibility() { |
24 var client = new PDFScriptingAPI(window, window.location.origin); | 24 var client = new PDFScriptingAPI(window, window.location.origin); |
25 client.setDestinationWindow(window); | 25 client.setDestinationWindow(window); |
26 client.getAccessibilityJSON(chrome.test.callbackPass(function(json) { | 26 client.getAccessibilityJSON(chrome.test.callbackPass(function(json) { |
(...skipping 23 matching lines...) Expand all Loading... |
50 } | 50 } |
51 ]; | 51 ]; |
52 | 52 |
53 if (viewer.loaded) { | 53 if (viewer.loaded) { |
54 chrome.test.runTests(tests); | 54 chrome.test.runTests(tests); |
55 } else { | 55 } else { |
56 window.addEventListener('pdfload', function() { | 56 window.addEventListener('pdfload', function() { |
57 chrome.test.runTests(tests); | 57 chrome.test.runTests(tests); |
58 }); | 58 }); |
59 } | 59 } |
OLD | NEW |