| OLD | NEW |
| 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() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 plugin.getAttribute('src').indexOf('/pdf/test.pdf') != -1); | 35 plugin.getAttribute('src').indexOf('/pdf/test.pdf') != -1); |
| 36 chrome.test.succeed(); | 36 chrome.test.succeed(); |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Test that shouldIgnoreKeyEvents correctly searches through the shadow DOM | 40 * Test that shouldIgnoreKeyEvents correctly searches through the shadow DOM |
| 41 * to find input fields. | 41 * to find input fields. |
| 42 */ | 42 */ |
| 43 function testIgnoreKeyEvents() { | 43 function testIgnoreKeyEvents() { |
| 44 // Test that the traversal through the shadow DOM works correctly. | 44 // Test that the traversal through the shadow DOM works correctly. |
| 45 var toolbar = document.getElementById('material-toolbar'); | 45 var toolbar = document.getElementById('toolbar'); |
| 46 toolbar.$.pageselector.$.input.focus(); | 46 toolbar.$.pageselector.$.input.focus(); |
| 47 chrome.test.assertTrue(shouldIgnoreKeyEvents(toolbar)); | 47 chrome.test.assertTrue(shouldIgnoreKeyEvents(toolbar)); |
| 48 | 48 |
| 49 // Test case where the active element has a shadow root of its own. | 49 // Test case where the active element has a shadow root of its own. |
| 50 toolbar.$.buttons.children[1].focus(); | 50 toolbar.$.buttons.children[1].focus(); |
| 51 chrome.test.assertFalse(shouldIgnoreKeyEvents(toolbar)); | 51 chrome.test.assertFalse(shouldIgnoreKeyEvents(toolbar)); |
| 52 | 52 |
| 53 chrome.test.assertFalse( | 53 chrome.test.assertFalse( |
| 54 shouldIgnoreKeyEvents(document.getElementById('plugin'))); | 54 shouldIgnoreKeyEvents(document.getElementById('plugin'))); |
| 55 | 55 |
| 56 chrome.test.succeed(); | 56 chrome.test.succeed(); |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Test that the bookmarks menu can be closed by clicking the plugin and | 60 * Test that the bookmarks menu can be closed by clicking the plugin and |
| 61 * pressing escape. | 61 * pressing escape. |
| 62 */ | 62 */ |
| 63 function testOpenCloseBookmarks() { | 63 function testOpenCloseBookmarks() { |
| 64 var toolbar = $('material-toolbar'); | 64 var toolbar = $('toolbar'); |
| 65 toolbar.show(); | 65 toolbar.show(); |
| 66 var dropdown = toolbar.$.bookmarks; | 66 var dropdown = toolbar.$.bookmarks; |
| 67 var plugin = $('plugin'); | 67 var plugin = $('plugin'); |
| 68 var ESC_KEY = 27; | 68 var ESC_KEY = 27; |
| 69 | 69 |
| 70 // Clicking on the plugin should close the bookmarks menu. | 70 // Clicking on the plugin should close the bookmarks menu. |
| 71 chrome.test.assertFalse(dropdown.dropdownOpen); | 71 chrome.test.assertFalse(dropdown.dropdownOpen); |
| 72 MockInteractions.tap(dropdown.$.icon); | 72 MockInteractions.tap(dropdown.$.icon); |
| 73 chrome.test.assertTrue(dropdown.dropdownOpen); | 73 chrome.test.assertTrue(dropdown.dropdownOpen); |
| 74 MockInteractions.tap(plugin); | 74 MockInteractions.tap(plugin); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 'invalid%EDname.pdf', | 119 'invalid%EDname.pdf', |
| 120 getFilenameFromURL('http://example.com/invalid%EDname.pdf')); | 120 getFilenameFromURL('http://example.com/invalid%EDname.pdf')); |
| 121 | 121 |
| 122 chrome.test.succeed(); | 122 chrome.test.succeed(); |
| 123 } | 123 } |
| 124 ]; | 124 ]; |
| 125 | 125 |
| 126 importTestHelpers().then(function() { | 126 importTestHelpers().then(function() { |
| 127 chrome.test.runTests(tests); | 127 chrome.test.runTests(tests); |
| 128 }); | 128 }); |
| OLD | NEW |