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

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

Issue 918953002: Fix for PDFs with lots of named destinations take a long time to load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 10 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
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/test/data/pdf/params_parser_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 function NavigateInCurrentTabCallback() { 5 function NavigateInCurrentTabCallback() {
6 this.navigateInCurrentTabCalled = false; 6 this.navigateInCurrentTabCalled = false;
7 this.callback = function() { 7 this.callback = function() {
8 this.navigateInCurrentTabCalled = true; 8 this.navigateInCurrentTabCalled = true;
9 }.bind(this); 9 }.bind(this);
10 this.reset = function() { 10 this.reset = function() {
(...skipping 16 matching lines...) Expand all
27 * Test navigation within the page, opening a url in the same tab and 27 * Test navigation within the page, opening a url in the same tab and
28 * opening a url in the new tab. 28 * opening a url in the new tab.
29 */ 29 */
30 function testNavigate() { 30 function testNavigate() {
31 var mockWindow = new MockWindow(100, 100); 31 var mockWindow = new MockWindow(100, 100);
32 var mockSizer = new MockSizer(); 32 var mockSizer = new MockSizer();
33 var mockCallback = new MockViewportChangedCallback(); 33 var mockCallback = new MockViewportChangedCallback();
34 var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, 34 var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback,
35 function() {}, function() {}, 0, 0); 35 function() {}, function() {}, 0, 0);
36 36
37 var paramsParser = new OpenPDFParamsParser(); 37 var paramsParser = new OpenPDFParamsParser(function(name) {
38 paramsParser.namedDestinations['US'] = 0; 38 if (name == 'US')
39 paramsParser.namedDestinations['UY'] = 2; 39 paramsParser.onNamedDestinationReceived(0);
40 else if (name == 'UY')
41 paramsParser.onNamedDestinationReceived(2);
42 else
43 paramsParser.onNamedDestinationReceived(-1);
44 });
40 var url = "http://xyz.pdf"; 45 var url = "http://xyz.pdf";
41 46
42 var navigateInCurrentTabCallback = new NavigateInCurrentTabCallback(); 47 var navigateInCurrentTabCallback = new NavigateInCurrentTabCallback();
43 var navigateInNewTabCallback = new NavigateInNewTabCallback(); 48 var navigateInNewTabCallback = new NavigateInNewTabCallback();
44 var navigator = new Navigator(url, viewport, paramsParser, 49 var navigator = new Navigator(url, viewport, paramsParser,
45 navigateInCurrentTabCallback.callback, 50 navigateInCurrentTabCallback.callback,
46 navigateInNewTabCallback.callback); 51 navigateInNewTabCallback.callback);
47 52
48 var documentDimensions = new MockDocumentDimensions(); 53 var documentDimensions = new MockDocumentDimensions();
49 documentDimensions.addPage(100, 100); 54 documentDimensions.addPage(100, 100);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 chrome.test.assertEq(300, viewport.position.y); 94 chrome.test.assertEq(300, viewport.position.y);
90 95
91 chrome.test.succeed(); 96 chrome.test.succeed();
92 } 97 }
93 ]; 98 ];
94 99
95 var scriptingAPI = new PDFScriptingAPI(window, window); 100 var scriptingAPI = new PDFScriptingAPI(window, window);
96 scriptingAPI.setLoadCallback(function() { 101 scriptingAPI.setLoadCallback(function() {
97 chrome.test.runTests(tests); 102 chrome.test.runTests(tests);
98 }); 103 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/test/data/pdf/params_parser_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698