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

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: Addressing nit 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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 chrome.test.assertEq(0, viewport.position.x); 69 chrome.test.assertEq(0, viewport.position.x);
70 chrome.test.assertEq(0, viewport.position.y); 70 chrome.test.assertEq(0, viewport.position.y);
71 71
72 mockCallback.reset(); 72 mockCallback.reset();
73 // This should move viewport to page 2. 73 // This should move viewport to page 2.
74 navigator.navigate(url + "#UY", false); 74 navigator.navigate(url + "#UY", false);
75 chrome.test.assertTrue(mockCallback.wasCalled); 75 chrome.test.assertTrue(mockCallback.wasCalled);
76 chrome.test.assertEq(0, viewport.position.x); 76 chrome.test.assertEq(0, viewport.position.x);
77 chrome.test.assertEq(300, viewport.position.y); 77 chrome.test.assertEq(300, viewport.position.y);
78 78
79 mockCallback.reset();
80 navigateInCurrentTabCallback.reset();
81 // #ABC is not a named destination in the page so viewport should not
82 // update and viewport position should remain same. As this link will open
83 // in the same tab.
84 navigator.navigate(url + "#ABC", false);
85 chrome.test.assertFalse(mockCallback.wasCalled);
86 chrome.test.assertTrue(
87 navigateInCurrentTabCallback.navigateInCurrentTabCalled);
88 chrome.test.assertEq(0, viewport.position.x);
89 chrome.test.assertEq(300, viewport.position.y);
90
91 chrome.test.succeed(); 79 chrome.test.succeed();
92 } 80 }
93 ]; 81 ];
94 82
95 var scriptingAPI = new PDFScriptingAPI(window, window); 83 var scriptingAPI = new PDFScriptingAPI(window, window);
96 scriptingAPI.setLoadCallback(function() { 84 scriptingAPI.setLoadCallback(function() {
97 chrome.test.runTests(tests); 85 chrome.test.runTests(tests);
98 }); 86 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698