| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 }); |
| OLD | NEW |