| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @constructor |
| 7 * @implements {settings.FontsBrowserProxy} |
| 8 * @extends {settings.TestBrowserProxy} |
| 9 */ |
| 10 var TestFontsBrowserProxy = function() { |
| 11 settings.TestBrowserProxy.call(this, [ |
| 12 'fetchFontsData', |
| 13 'observeAdvancedFontExtensionAvailable', |
| 14 'openAdvancedFontSettings', |
| 15 ]); |
| 16 |
| 17 /** @private {!FontsData} */ |
| 18 this.fontsData_ = { |
| 19 'fontList': [['font name', 'alternate', 'ltr']], |
| 20 'encodingList': [['encoding name', 'alternate', 'ltr']], |
| 21 }; |
| 22 }; |
| 23 |
| 24 TestFontsBrowserProxy.prototype = { |
| 25 __proto__: settings.TestBrowserProxy.prototype, |
| 26 |
| 27 /** @override */ |
| 28 fetchFontsData: function() { |
| 29 this.methodCalled('fetchFontsData'); |
| 30 return Promise.resolve(this.fontsData_); |
| 31 }, |
| 32 |
| 33 /** @override */ |
| 34 observeAdvancedFontExtensionAvailable: function() { |
| 35 this.methodCalled('observeAdvancedFontExtensionAvailable'); |
| 36 }, |
| 37 |
| 38 /** @override */ |
| 39 openAdvancedFontSettings: function() { |
| 40 this.methodCalled('openAdvancedFontSettings'); |
| 41 }, |
| 42 }; |
| 43 |
| 44 var fontsPage = null; |
| 45 |
| 46 /** @type {?TestFontsBrowserProxy} */ |
| 47 var fontsBrowserProxy = null; |
| 48 |
| 49 suite('AppearanceFontHandler', function() { |
| 50 setup(function() { |
| 51 fontsBrowserProxy = new TestFontsBrowserProxy(); |
| 52 settings.FontsBrowserProxyImpl.instance_ = fontsBrowserProxy; |
| 53 |
| 54 PolymerTest.clearBody(); |
| 55 |
| 56 fontsPage = document.createElement('settings-appearance-fonts-page'); |
| 57 document.body.appendChild(fontsPage); |
| 58 }); |
| 59 |
| 60 teardown(function() { fontsPage.remove(); }); |
| 61 |
| 62 test('fetchFontsData', function() { |
| 63 return fontsBrowserProxy.whenCalled('fetchFontsData'); |
| 64 }); |
| 65 |
| 66 test('openAdvancedFontSettings', function() { |
| 67 cr.webUIListenerCallback('advanced-font-settings-installed', [true]); |
| 68 Polymer.dom.flush(); |
| 69 var button = fontsPage.$$('#advancedButton'); |
| 70 assert(!!button); |
| 71 MockInteractions.tap(button); |
| 72 return fontsBrowserProxy.whenCalled('openAdvancedFontSettings'); |
| 73 }); |
| 74 }); |
| OLD | NEW |