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 /** | 5 /** |
6 * @fileoverview Tests for chrome://plugins | 6 * @fileoverview Tests for chrome://plugins |
7 */ | 7 */ |
8 | 8 |
9 /** @const {string} Path to source root. */ | 9 /** @const {string} Path to source root. */ |
10 var ROOT_PATH = '../../../../'; | 10 var ROOT_PATH = '../../../../'; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 'getPluginsData', | 51 'getPluginsData', |
52 'getShowDetails', | 52 'getShowDetails', |
53 'saveShowDetailsToPrefs', | 53 'saveShowDetailsToPrefs', |
54 ]); | 54 ]); |
55 | 55 |
56 /** | 56 /** |
57 * The data to be returned by |getPluginsData_|. | 57 * The data to be returned by |getPluginsData_|. |
58 * @private | 58 * @private |
59 */ | 59 */ |
60 this.pluginsData_ = []; | 60 this.pluginsData_ = []; |
61 | |
62 this.pageProxy = null; | |
63 }; | 61 }; |
64 | 62 |
65 TestBrowserProxy.prototype = { | 63 TestBrowserProxy.prototype = { |
66 __proto__: settings.TestBrowserProxy.prototype, | 64 __proto__: settings.TestBrowserProxy.prototype, |
67 | 65 |
68 getPluginsData: function() { | 66 getPluginsData: function() { |
69 this.methodCalled('getPluginsData'); | 67 this.methodCalled('getPluginsData'); |
70 return Promise.resolve({plugins: this.pluginsData_}); | 68 return Promise.resolve({plugins: this.pluginsData_}); |
71 }, | 69 }, |
72 | 70 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 browserProxy.whenCalled('getShowDetails'), | 158 browserProxy.whenCalled('getShowDetails'), |
161 ]); | 159 ]); |
162 }); | 160 }); |
163 | 161 |
164 teardown(function() { browserProxy.reset(); }); | 162 teardown(function() { browserProxy.reset(); }); |
165 | 163 |
166 test('PluginsUpdated', function() { | 164 test('PluginsUpdated', function() { |
167 var plugins = document.querySelectorAll('.plugin'); | 165 var plugins = document.querySelectorAll('.plugin'); |
168 assertEquals(EXPECTED_PLUGINS, plugins.length); | 166 assertEquals(EXPECTED_PLUGINS, plugins.length); |
169 | 167 |
170 pageProxy.onPluginsUpdated([fakePluginData]); | 168 pageImpl.onPluginsUpdated([fakePluginData]); |
171 plugins = document.querySelectorAll('.plugin'); | 169 plugins = document.querySelectorAll('.plugin'); |
172 assertEquals(1, plugins.length); | 170 assertEquals(1, plugins.length); |
173 }); | 171 }); |
174 | 172 |
175 /** | 173 /** |
176 * Test that clicking on the +/- icons results in the expected calls to the | 174 * Test that clicking on the +/- icons results in the expected calls to the |
177 * browser. | 175 * browser. |
178 */ | 176 */ |
179 test('ToggleDetails', function() { | 177 test('ToggleDetails', function() { |
180 var collapseEl = document.querySelector('#collapse'); | 178 var collapseEl = document.querySelector('#collapse'); |
(...skipping 19 matching lines...) Expand all Loading... |
200 return browserProxy.whenCalled('saveShowDetailsToPrefs'); | 198 return browserProxy.whenCalled('saveShowDetailsToPrefs'); |
201 }).then(function(expanded) { | 199 }).then(function(expanded) { |
202 assertFalse(Boolean(expanded)); | 200 assertFalse(Boolean(expanded)); |
203 }); | 201 }); |
204 }); | 202 }); |
205 }); | 203 }); |
206 | 204 |
207 // Run all registered tests. | 205 // Run all registered tests. |
208 mocha.run(); | 206 mocha.run(); |
209 }); | 207 }); |
OLD | NEW |