OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 var tests = [ | 25 var tests = [ |
26 /** | 26 /** |
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, 1); | 35 function() {}, function() {}, 0, 1, 0); |
36 | 36 |
37 var paramsParser = new OpenPDFParamsParser(function(name) { | 37 var paramsParser = new OpenPDFParamsParser(function(name) { |
38 if (name == 'US') | 38 if (name == 'US') |
39 paramsParser.onNamedDestinationReceived(0); | 39 paramsParser.onNamedDestinationReceived(0); |
40 else if (name == 'UY') | 40 else if (name == 'UY') |
41 paramsParser.onNamedDestinationReceived(2); | 41 paramsParser.onNamedDestinationReceived(2); |
42 else | 42 else |
43 paramsParser.onNamedDestinationReceived(-1); | 43 paramsParser.onNamedDestinationReceived(-1); |
44 }); | 44 }); |
45 var url = "http://xyz.pdf"; | 45 var url = "http://xyz.pdf"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 chrome.test.assertEq(300, viewport.position.y); | 94 chrome.test.assertEq(300, viewport.position.y); |
95 | 95 |
96 chrome.test.succeed(); | 96 chrome.test.succeed(); |
97 } | 97 } |
98 ]; | 98 ]; |
99 | 99 |
100 var scriptingAPI = new PDFScriptingAPI(window, window); | 100 var scriptingAPI = new PDFScriptingAPI(window, window); |
101 scriptingAPI.setLoadCallback(function() { | 101 scriptingAPI.setLoadCallback(function() { |
102 chrome.test.runTests(tests); | 102 chrome.test.runTests(tests); |
103 }); | 103 }); |
OLD | NEW |