| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** @fileoverview Suite of tests for extensions-detail-view. */ | 5 /** @fileoverview Suite of tests for extensions-detail-view. */ |
| 6 cr.define('extension_detail_view_tests', function() { | 6 cr.define('extension_detail_view_tests', function() { |
| 7 /** @enum {string} */ | 7 /** @enum {string} */ |
| 8 var TestNames = { | 8 var TestNames = { |
| 9 Layout: 'layout', | 9 Layout: 'layout', |
| 10 ClickableElements: 'clickable elements', | 10 ClickableElements: 'clickable elements', |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 document.body.appendChild(item); | 47 document.body.appendChild(item); |
| 48 }); | 48 }); |
| 49 | 49 |
| 50 test(assert(TestNames.Layout), function() { | 50 test(assert(TestNames.Layout), function() { |
| 51 Polymer.dom.flush(); | 51 Polymer.dom.flush(); |
| 52 | 52 |
| 53 extension_test_util.testIronIcons(item); | 53 extension_test_util.testIronIcons(item); |
| 54 | 54 |
| 55 var testIsVisible = extension_test_util.isVisible.bind(null, item); | 55 var testIsVisible = extension_test_util.isVisible.bind(null, item); |
| 56 expectTrue(testIsVisible('#close-button')); | 56 expectTrue(testIsVisible('#close-button')); |
| 57 expectTrue(testIsVisible('#open-in-webstore')); | 57 expectFalse(testIsVisible('#open-homepage')); |
| 58 expectFalse(testIsVisible('#options')); | 58 expectFalse(testIsVisible('#options')); |
| 59 | 59 |
| 60 // Check the checkboxes visibility and state. They should be visible | 60 // Check the checkboxes visibility and state. They should be visible |
| 61 // only if the associated option is enabled, and checked if the | 61 // only if the associated option is enabled, and checked if the |
| 62 // associated option is active. | 62 // associated option is active. |
| 63 var accessOptions = [ | 63 var accessOptions = [ |
| 64 {key: 'incognitoAccess', id: '#allow-incognito'}, | 64 {key: 'incognitoAccess', id: '#allow-incognito'}, |
| 65 {key: 'fileAccess', id: '#allow-on-file-urls'}, | 65 {key: 'fileAccess', id: '#allow-on-file-urls'}, |
| 66 {key: 'runOnAllUrls', id: '#allow-on-all-sites'}, | 66 {key: 'runOnAllUrls', id: '#allow-on-all-sites'}, |
| 67 {key: 'errorCollection', id: '#collect-errors'}, | 67 {key: 'errorCollection', id: '#collect-errors'}, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 expectTrue(testIsVisible('#permissions-list')); | 101 expectTrue(testIsVisible('#permissions-list')); |
| 102 expectEquals(2, | 102 expectEquals(2, |
| 103 item.$$('#permissions-list').querySelectorAll('li'). | 103 item.$$('#permissions-list').querySelectorAll('li'). |
| 104 length); | 104 length); |
| 105 expectFalse(testIsVisible('#no-permissions')); | 105 expectFalse(testIsVisible('#no-permissions')); |
| 106 | 106 |
| 107 var optionsUrl = | 107 var optionsUrl = |
| 108 'chrome-extension://' + extensionData.id + '/options.html'; | 108 'chrome-extension://' + extensionData.id + '/options.html'; |
| 109 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); | 109 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); |
| 110 expectTrue(testIsVisible('#options')); | 110 expectTrue(testIsVisible('#options')); |
| 111 |
| 112 var homepageUrl = 'https://www.example.com/'; |
| 113 item.set('data.homePage', {specified: true, url: homepageUrl}); |
| 114 expectTrue(testIsVisible('#open-homepage')); |
| 115 expectEquals(homepageUrl, item.$$('#open-homepage').href); |
| 111 }); | 116 }); |
| 112 | 117 |
| 113 test(assert(TestNames.ClickableElements), function() { | 118 test(assert(TestNames.ClickableElements), function() { |
| 114 var optionsUrl = | 119 var optionsUrl = |
| 115 'chrome-extension://' + extensionData.id + '/options.html'; | 120 'chrome-extension://' + extensionData.id + '/options.html'; |
| 116 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); | 121 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); |
| 117 Polymer.dom.flush(); | 122 Polymer.dom.flush(); |
| 118 mockDelegate.testClickingCalls( | 123 mockDelegate.testClickingCalls( |
| 119 item.$$('#allow-incognito'), 'setItemAllowedIncognito', | 124 item.$$('#allow-incognito'), 'setItemAllowedIncognito', |
| 120 [extensionData.id, true]); | 125 [extensionData.id, true]); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 item.$$('#options'), 'showItemOptionsPage', [extensionData.id]); | 136 item.$$('#options'), 'showItemOptionsPage', [extensionData.id]); |
| 132 }); | 137 }); |
| 133 }); | 138 }); |
| 134 } | 139 } |
| 135 | 140 |
| 136 return { | 141 return { |
| 137 registerTests: registerTests, | 142 registerTests: registerTests, |
| 138 TestNames: TestNames, | 143 TestNames: TestNames, |
| 139 }; | 144 }; |
| 140 }); | 145 }); |
| OLD | NEW |