Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: chrome/test/data/pdf/basic_test.js

Issue 266413002: Refactor pdf_scripting_api.js to remove the PDFMessagingHost in OOP PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 some key elements exist and that they have the appropriate 7 * Test that some key elements exist and that they have the appropriate
8 * constructor name. This verifies that polymer is working correctly. 8 * constructor name. This verifies that polymer is working correctly.
9 */ 9 */
10 function testHasElements() { 10 function testHasElements() {
11 var elementNames = [ 11 var elementNames = [
12 'viewer-toolbar', 12 'viewer-toolbar',
13 'viewer-page-indicator', 13 'viewer-page-indicator',
14 'viewer-progress-bar', 14 'viewer-progress-bar',
15 'viewer-password-screen', 15 'viewer-password-screen',
16 'viewer-error-screen' 16 'viewer-error-screen'
17 ]; 17 ];
18 for (var i = 0; i < elementNames.length; i++) { 18 for (var i = 0; i < elementNames.length; i++) {
19 var elements = document.querySelectorAll(elementNames[i]); 19 var elements = document.querySelectorAll(elementNames[i]);
20 chrome.test.assertEq(1, elements.length); 20 chrome.test.assertEq(1, elements.length);
21 var element = elements[0]; 21 var element = elements[0];
22 chrome.test.assertTrue( 22 chrome.test.assertTrue(
23 String(element.constructor).indexOf(elementNames[i]) != -1); 23 String(element.constructor).indexOf(elementNames[i]) != -1);
24 } 24 }
25 chrome.test.succeed();
25 }, 26 },
26 27
27 /** 28 /**
28 * Test that the plugin element exists and is navigated to the correct URL. 29 * Test that the plugin element exists and is navigated to the correct URL.
29 */ 30 */
30 function testPluginElement() { 31 function testPluginElement() {
31 var plugin = document.getElementById('plugin'); 32 var plugin = document.getElementById('plugin');
32 chrome.test.assertEq('object', plugin.localName); 33 chrome.test.assertEq('object', plugin.localName);
33 34
34 chrome.test.assertTrue( 35 chrome.test.assertTrue(
35 plugin.getAttribute('src').indexOf('/pdf/test.pdf') != -1); 36 plugin.getAttribute('src').indexOf('/pdf/test.pdf') != -1);
37 chrome.test.succeed();
36 }, 38 },
37 ]; 39 ];
38 40
39 function runTests() { 41 chrome.test.runTests(tests);
40 for (var i = 0; i < tests.length; ++i) {
41 console.log('Running: ' + tests[i].name);
42 tests[i]();
43 }
44 chrome.test.notifyPass();
45 }
46
47 runTests();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698