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

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

Issue 2103043003: Remove legacy PDF JSON interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert unrelated change Created 4 years, 5 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
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 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 + viewer.viewport.topToolbarHeight_,
22 sizer.offsetHeight); 22 sizer.offsetHeight);
23 chrome.test.succeed(); 23 chrome.test.succeed();
24 }, 24 },
25 25
26 function testAccessibility() {
27 scriptingAPI.getAccessibilityJSON(chrome.test.callbackPass(function(json) {
28 var dict = JSON.parse(json);
29 chrome.test.assertEq(true, dict.copyable);
30 chrome.test.assertEq(true, dict.loaded);
31 chrome.test.assertEq(1, dict.numberOfPages);
32 }));
33 },
34
35 function testAccessibilityWithPage() {
36 scriptingAPI.getAccessibilityJSON(chrome.test.callbackPass(function(json) {
37 var dict = JSON.parse(json);
38 chrome.test.assertEq(612, dict.width);
39 chrome.test.assertEq(792, dict.height);
40 chrome.test.assertEq(1.0, dict.textBox[0].fontSize);
41 chrome.test.assertEq('text', dict.textBox[0].textNodes[0].type);
42 chrome.test.assertEq('this is some text',
43 dict.textBox[0].textNodes[0].text);
44 chrome.test.assertEq('text', dict.textBox[1].textNodes[0].type);
45 chrome.test.assertEq('some more text',
46 dict.textBox[1].textNodes[0].text);
47 }), 0);
48 },
49
50 function testGetSelectedText() { 26 function testGetSelectedText() {
51 var client = new PDFScriptingAPI(window, window); 27 var client = new PDFScriptingAPI(window, window);
52 client.selectAll(); 28 client.selectAll();
53 client.getSelectedText(chrome.test.callbackPass(function(selectedText) { 29 client.getSelectedText(chrome.test.callbackPass(function(selectedText) {
54 chrome.test.assertEq('this is some text\nsome more text', selectedText); 30 chrome.test.assertEq('this is some text\nsome more text', selectedText);
55 })); 31 }));
56 }, 32 },
57 33
58 /** 34 /**
59 * Test that the filename is used as the title.pdf. 35 * Test that the filename is used as the title.pdf.
(...skipping 17 matching lines...) Expand all
77 e.initEvent('keydown'); 53 e.initEvent('keydown');
78 e.keyCode = 27; 54 e.keyCode = 27;
79 document.dispatchEvent(e); 55 document.dispatchEvent(e);
80 } 56 }
81 ]; 57 ];
82 58
83 var scriptingAPI = new PDFScriptingAPI(window, window); 59 var scriptingAPI = new PDFScriptingAPI(window, window);
84 scriptingAPI.setLoadCallback(function() { 60 scriptingAPI.setLoadCallback(function() {
85 chrome.test.runTests(tests); 61 chrome.test.runTests(tests);
86 }); 62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698