Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/test/data/pdf/basic_plugin_test.js

Issue 265283005: Add accessibility function to PDFScriptingAPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 100%. 13 // Verify that the initial zoom is 100%.
14 chrome.test.assertEq(1, viewer.viewport.zoom); 14 chrome.test.assertEq(1, viewer.viewport.zoom);
15 15
16 var sizer = document.getElementById('sizer'); 16 var sizer = document.getElementById('sizer');
17 chrome.test.assertEq(826, sizer.offsetWidth); 17 chrome.test.assertEq(826, sizer.offsetWidth);
18 chrome.test.assertEq(1066, sizer.offsetHeight); 18 chrome.test.assertEq(1066, sizer.offsetHeight);
19 chrome.test.succeed(); 19 chrome.test.succeed();
20 }, 20 },
21
22 function testAccessibility() {
23 var client = new PDFScriptingAPI(window, window.location.origin);
24 client.setDestinationWindow(window);
25 client.getAccessibilityJSON(chrome.test.callbackPass(function(json) {
26 chrome.test.assertEq('{"copyable":true,"loaded":true,"numberOfPages":1}',
27 json);
28 }));
29 },
30
31 function testAccessibilityWithPage() {
32 var client = new PDFScriptingAPI(window, window.location.origin);
33 client.setDestinationWindow(window);
34 client.getAccessibilityJSON(chrome.test.callbackPass(function(json) {
35 chrome.test.assertEq(
36 '{"height":792.0,"textBox":[{"fontSize":1.0,' +
37 '"height":8.8680419921875,"left":77.13200378417969,' +
Lei Zhang 2014/05/08 06:42:53 Are these values going to work cross-platform?
raymes 2014/05/09 06:19:45 Good point - I got rid of the checks for floating
38 '"textNodes":[{"text":"this is some text","type":"text"}],' +
39 '"top":74.3599853515625,"width":85.58399963378906},' +
40 '{"fontSize":1.0,"height":8.25604248046875,' +
41 '"left":77.38400268554688,' +
42 '"textNodes":[{"text":"some more text","type":"text"}],' +
43 '"top":88.97198486328125,"width":82.30081176757812}],"width":612.0}',
44 json);
45 }), 0);
46 }
21 ]; 47 ];
22 48
23 window.addEventListener('pdfload', function() { 49 window.addEventListener('pdfload', function() {
24 chrome.test.runTests(tests); 50 chrome.test.runTests(tests);
25 }); 51 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698