Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var tests = [ | |
| 6 | |
|
raymes
2015/01/16 02:46:30
nit: we can remove this line
Alexandre Carlton
2015/01/16 03:14:07
Done.
| |
| 7 /** | |
| 8 * Test that the correct bookmarks were loaded for test-bookmarks.pdf. | |
| 9 */ | |
| 10 function testHasCorrectBookmarks() { | |
| 11 var bookmarks = viewer.bookmarks_; | |
|
raymes
2015/01/16 02:46:31
nit: rather than access the private member directl
Alexandre Carlton
2015/01/16 03:14:07
Done.
| |
| 12 | |
| 13 // Load all relevant bookmarks. | |
| 14 chrome.test.assertEq(2, bookmarks.length); | |
| 15 var firstBookmark = bookmarks[0]; | |
| 16 var secondBookmark = bookmarks[1]; | |
| 17 chrome.test.assertEq(1, firstBookmark.children.length); | |
| 18 chrome.test.assertEq(0, secondBookmark.children.length); | |
| 19 var firstNestedBookmark = firstBookmark.children[0]; | |
| 20 | |
| 21 // Check titles. | |
| 22 chrome.test.assertEq('First Section', | |
| 23 firstBookmark.title); | |
| 24 chrome.test.assertEq('First Subsection', | |
| 25 firstNestedBookmark.title); | |
| 26 chrome.test.assertEq('Second Section', | |
| 27 secondBookmark.title); | |
| 28 // Check pages. | |
| 29 chrome.test.assertEq(0, firstBookmark.page); | |
| 30 chrome.test.assertEq(1, firstNestedBookmark.page); | |
| 31 chrome.test.assertEq(2, secondBookmark.page); | |
| 32 | |
| 33 chrome.test.succeed(); | |
| 34 } | |
| 35 ]; | |
| 36 | |
| 37 var scriptingAPI = new PDFScriptingAPI(window, window); | |
| 38 scriptingAPI.setLoadCallback(function() { | |
| 39 chrome.test.runTests(tests); | |
| 40 }); | |
| OLD | NEW |