Chromium Code Reviews| Index: chrome/test/data/pdf/bookmarks_test.js |
| diff --git a/chrome/test/data/pdf/bookmarks_test.js b/chrome/test/data/pdf/bookmarks_test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf667171b9b7b5b004e709e871f7b34fd0543a7b |
| --- /dev/null |
| +++ b/chrome/test/data/pdf/bookmarks_test.js |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var tests = [ |
| + |
| + /** |
| + * Test that the correct bookmarks were loaded for the basic pdf |
|
raymes
2015/01/15 05:40:19
nit: Maybe actually specify the name of the pdf fi
Alexandre Carlton
2015/01/16 02:39:07
Done.
|
| + */ |
| + function testHasCorrectBookmarks() { |
| + var bookmarks = viewer.bookmarks_; |
| + |
| + // Loading all relevant bookmarks |
|
raymes
2015/01/15 05:40:19
nit: add full stop
Alexandre Carlton
2015/01/16 02:39:07
Done.
|
| + chrome.test.assertEq(2, bookmarks.length); |
| + var firstBookmark = bookmarks[0]; |
| + var secondBookmark = bookmarks[1]; |
| + chrome.test.assertEq(1, firstBookmark.children.length); |
| + chrome.test.assertEq(0, secondBookmark.children.length); |
| + var firstNestedBookmark = firstBookmark.children[0]; |
| + |
| + // Checking titles |
| + chrome.test.assertEq('First Section', |
| + firstBookmark.title); |
| + chrome.test.assertEq('First Subsection', |
| + firstNestedBookmark.title); |
| + chrome.test.assertEq('Second Section', |
| + secondBookmark.title); |
| + // Checking pages |
| + chrome.test.assertEq(0, firstBookmark.page); |
| + chrome.test.assertEq(1, firstNestedBookmark.page); |
| + chrome.test.assertEq(2, secondBookmark.page); |
| + |
| + chrome.test.succeed(); |
| + } |
| +]; |
| + |
| +var scriptingAPI = new PDFScriptingAPI(window, window); |
| +scriptingAPI.setLoadCallback(function() { |
| + chrome.test.runTests(tests); |
| +}); |