| 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 var tests = [ | 5 var tests = [ |
| 6 /** | 6 /** |
| 7 * Test that the correct bookmarks were loaded for test-bookmarks.pdf. | 7 * Test that the correct bookmarks were loaded for test-bookmarks.pdf. |
| 8 */ | 8 */ |
| 9 function testHasCorrectBookmarks() { | 9 function testHasCorrectBookmarks() { |
| 10 var bookmarks = viewer.bookmarks; | 10 var bookmarks = viewer.bookmarks; |
| 11 | 11 |
| 12 // Load all relevant bookmarks. | 12 // Load all relevant bookmarks. |
| 13 chrome.test.assertEq(2, bookmarks.length); | 13 chrome.test.assertEq(3, bookmarks.length); |
| 14 var firstBookmark = bookmarks[0]; | 14 var firstBookmark = bookmarks[0]; |
| 15 var secondBookmark = bookmarks[1]; | 15 var secondBookmark = bookmarks[1]; |
| 16 var uriBookmark = bookmarks[2]; |
| 16 chrome.test.assertEq(1, firstBookmark.children.length); | 17 chrome.test.assertEq(1, firstBookmark.children.length); |
| 17 chrome.test.assertEq(0, secondBookmark.children.length); | 18 chrome.test.assertEq(0, secondBookmark.children.length); |
| 18 var firstNestedBookmark = firstBookmark.children[0]; | 19 var firstNestedBookmark = firstBookmark.children[0]; |
| 19 | 20 |
| 20 // Check titles. | 21 // Check titles. |
| 21 chrome.test.assertEq('First Section', | 22 chrome.test.assertEq('First Section', |
| 22 firstBookmark.title); | 23 firstBookmark.title); |
| 23 chrome.test.assertEq('First Subsection', | 24 chrome.test.assertEq('First Subsection', |
| 24 firstNestedBookmark.title); | 25 firstNestedBookmark.title); |
| 25 chrome.test.assertEq('Second Section', | 26 chrome.test.assertEq('Second Section', |
| 26 secondBookmark.title); | 27 secondBookmark.title); |
| 28 chrome.test.assertEq('URI Bookmark', uriBookmark.title); |
| 29 |
| 27 // Check pages. | 30 // Check pages. |
| 28 chrome.test.assertEq(0, firstBookmark.page); | 31 chrome.test.assertEq(0, firstBookmark.page); |
| 29 chrome.test.assertEq(1, firstNestedBookmark.page); | 32 chrome.test.assertEq(1, firstNestedBookmark.page); |
| 30 chrome.test.assertEq(2, secondBookmark.page); | 33 chrome.test.assertEq(2, secondBookmark.page); |
| 34 chrome.test.assertEq(undefined, uriBookmark.page); |
| 35 |
| 36 chrome.test.assertEq('http://www.chromium.org', uriBookmark.uri); |
| 31 | 37 |
| 32 chrome.test.succeed(); | 38 chrome.test.succeed(); |
| 33 } | 39 } |
| 34 ]; | 40 ]; |
| 35 | 41 |
| 36 var scriptingAPI = new PDFScriptingAPI(window, window); | 42 var scriptingAPI = new PDFScriptingAPI(window, window); |
| 37 scriptingAPI.setLoadCallback(function() { | 43 scriptingAPI.setLoadCallback(function() { |
| 38 chrome.test.runTests(tests); | 44 chrome.test.runTests(tests); |
| 39 }); | 45 }); |
| OLD | NEW |