| 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 cr.define('settings_about_page', function() { |
| 6 /** |
| 7 * @constructor |
| 8 * @implements {settings.AboutPageBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} |
| 10 */ |
| 11 var TestAboutPageBrowserProxy = function() { |
| 12 settings.TestBrowserProxy.call(this, [ |
| 13 'refreshUpdateStatus', |
| 14 'getCurrentChannel', |
| 15 'getVersionInfo', |
| 16 ]); |
| 17 |
| 18 /** @type {!VersionInfo} */ |
| 19 this.versionInfo_ = { |
| 20 arcVersion: '', |
| 21 osFirmware: '', |
| 22 osVersion: '', |
| 23 }; |
| 24 }; |
| 25 |
| 26 TestAboutPageBrowserProxy.prototype = { |
| 27 __proto__: settings.TestBrowserProxy.prototype, |
| 28 |
| 29 /** @param {!VersionInfo} */ |
| 30 setVersionInfo: function(versionInfo) { |
| 31 this.versionInfo_ = versionInfo; |
| 32 }, |
| 33 |
| 34 /** @override */ |
| 35 refreshUpdateStatus: function() { |
| 36 this.methodCalled('refreshUpdateStatus'); |
| 37 }, |
| 38 |
| 39 /** @override */ |
| 40 getCurrentChannel: function() { |
| 41 this.methodCalled('getCurrentChannel'); |
| 42 return Promise.resolve(BrowserChannel.BETA); |
| 43 }, |
| 44 |
| 45 /** @override */ |
| 46 getVersionInfo: function() { |
| 47 this.methodCalled('getVersionInfo'); |
| 48 return Promise.resolve(this.versionInfo_); |
| 49 }, |
| 50 }; |
| 51 |
| 52 function registerAboutPageTests() { |
| 53 suite('AboutPageTest', function() { |
| 54 test('Initialization', function() { |
| 55 // TODO(dpapad): Implement this test once <settings-about-page> is |
| 56 // ready. Currently this is needed to avoid failing with |
| 57 // "Failure: Mocha ran, but no mocha tests were run!" on non-ChromeOS |
| 58 // test bots. |
| 59 }); |
| 60 }); |
| 61 } |
| 62 |
| 63 if (cr.isChromeOS) { |
| 64 function registerDetailedBuildInfoTests() { |
| 65 suite('DetailedBuildInfoTest', function() { |
| 66 var page = null; |
| 67 var browserProxy = null; |
| 68 |
| 69 setup(function() { |
| 70 browserProxy = new TestAboutPageBrowserProxy(); |
| 71 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; |
| 72 PolymerTest.clearBody(); |
| 73 }); |
| 74 |
| 75 teardown(function() { page.remove(); }); |
| 76 |
| 77 test('Initialization', function() { |
| 78 var versionInfo = { |
| 79 arcVersion: 'dummyArcVersion', |
| 80 osFirmware: 'dummyOsFirmware', |
| 81 osVersion: 'dummyOsVersion', |
| 82 }; |
| 83 browserProxy.setVersionInfo(versionInfo); |
| 84 |
| 85 page = document.createElement('settings-detailed-build-info'); |
| 86 document.body.appendChild(page); |
| 87 |
| 88 return Promise.all([ |
| 89 browserProxy.whenCalled('refreshUpdateStatus'), |
| 90 browserProxy.whenCalled('getVersionInfo'), |
| 91 browserProxy.whenCalled('getCurrentChannel'), |
| 92 ]).then(function() { |
| 93 assertEquals(versionInfo.arcVersion, page.$.arcVersion.textContent); |
| 94 assertEquals(versionInfo.osVersion, page.$.osVersion.textContent); |
| 95 assertEquals(versionInfo.osFirmware, page.$.osFirmware.textContent); |
| 96 }); |
| 97 }); |
| 98 }); |
| 99 } |
| 100 } |
| 101 |
| 102 return { |
| 103 registerTests: function() { |
| 104 if (cr.isChromeOS) { |
| 105 registerDetailedBuildInfoTests(); |
| 106 } |
| 107 registerAboutPageTests(); |
| 108 }, |
| 109 }; |
| 110 }); |
| OLD | NEW |