Chromium Code Reviews| 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 cr.define('settings_about_page', function() { | 5 cr.define('settings_about_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.AboutPageBrowserProxy} | 8 * @implements {settings.AboutPageBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| 11 var TestAboutPageBrowserProxy = function() { | 11 var TestAboutPageBrowserProxy = function() { |
| 12 settings.TestBrowserProxy.call(this, [ | 12 settings.TestBrowserProxy.call(this, [ |
| 13 'refreshUpdateStatus', | |
| 14 'getCurrentChannel', | 13 'getCurrentChannel', |
| 15 'getVersionInfo', | 14 'getVersionInfo', |
| 15 'openFeedbackDialog', | |
|
tommycli
2016/05/17 00:36:48
nit: Can we make this match the interface order?
dpapad
2016/05/17 00:45:13
Done.
| |
| 16 'openHelpPage', | |
| 17 'refreshUpdateStatus', | |
| 16 ]); | 18 ]); |
| 17 | 19 |
| 18 /** @type {!VersionInfo} */ | 20 /** @type {!VersionInfo} */ |
| 19 this.versionInfo_ = { | 21 this.versionInfo_ = { |
| 20 arcVersion: '', | 22 arcVersion: '', |
| 21 osFirmware: '', | 23 osFirmware: '', |
| 22 osVersion: '', | 24 osVersion: '', |
| 23 }; | 25 }; |
| 24 }; | 26 }; |
| 25 | 27 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 40 getCurrentChannel: function() { | 42 getCurrentChannel: function() { |
| 41 this.methodCalled('getCurrentChannel'); | 43 this.methodCalled('getCurrentChannel'); |
| 42 return Promise.resolve(BrowserChannel.BETA); | 44 return Promise.resolve(BrowserChannel.BETA); |
| 43 }, | 45 }, |
| 44 | 46 |
| 45 /** @override */ | 47 /** @override */ |
| 46 getVersionInfo: function() { | 48 getVersionInfo: function() { |
| 47 this.methodCalled('getVersionInfo'); | 49 this.methodCalled('getVersionInfo'); |
| 48 return Promise.resolve(this.versionInfo_); | 50 return Promise.resolve(this.versionInfo_); |
| 49 }, | 51 }, |
| 52 | |
| 53 /** @override */ | |
| 54 openFeedbackDialog: function() { | |
| 55 this.methodCalled('openFeedbackDialog'); | |
| 56 }, | |
| 57 | |
| 58 /** @override */ | |
| 59 openHelpPage: function() { | |
| 60 this.methodCalled('openHelpPage'); | |
| 61 }, | |
| 50 }; | 62 }; |
| 51 | 63 |
| 52 function registerAboutPageTests() { | 64 function registerAboutPageTests() { |
| 53 suite('AboutPageTest', function() { | 65 suite('AboutPageTest', function() { |
| 54 test('Initialization', function() { | 66 var page = null; |
| 55 // TODO(dpapad): Implement this test once <settings-about-page> is | 67 var browserProxy = null; |
| 56 // ready. Currently this is needed to avoid failing with | 68 |
| 57 // "Failure: Mocha ran, but no mocha tests were run!" on non-ChromeOS | 69 setup(function() { |
| 58 // test bots. | 70 browserProxy = new TestAboutPageBrowserProxy(); |
| 59 }); | 71 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; |
| 72 PolymerTest.clearBody(); | |
| 73 page = document.createElement('settings-about-page'); | |
| 74 document.body.appendChild(page); | |
| 60 }); | 75 }); |
| 76 | |
| 77 test('GetHelp', function() { | |
| 78 assertTrue(!!page.$.help); | |
| 79 MockInteractions.tap(page.$.help); | |
| 80 return browserProxy.whenCalled('openHelpPage'); | |
| 81 }); | |
| 82 }); | |
| 83 } | |
| 84 | |
| 85 function registerOfficialBuildTests() { | |
| 86 suite('AboutPageTest_OfficialBuild', function() { | |
| 87 var page = null; | |
| 88 var browserProxy = null; | |
| 89 | |
| 90 setup(function() { | |
| 91 browserProxy = new TestAboutPageBrowserProxy(); | |
| 92 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; | |
| 93 PolymerTest.clearBody(); | |
| 94 page = document.createElement('settings-about-page'); | |
| 95 document.body.appendChild(page); | |
| 96 }); | |
| 97 | |
| 98 test('ReportAnIssue', function() { | |
| 99 assertTrue(!!page.$.reportIssue); | |
| 100 MockInteractions.tap(page.$.reportIssue); | |
| 101 return browserProxy.whenCalled('openFeedbackDialog'); | |
| 102 }); | |
| 103 }); | |
| 61 } | 104 } |
| 62 | 105 |
| 63 if (cr.isChromeOS) { | 106 if (cr.isChromeOS) { |
| 64 function registerDetailedBuildInfoTests() { | 107 function registerDetailedBuildInfoTests() { |
| 65 suite('DetailedBuildInfoTest', function() { | 108 suite('DetailedBuildInfoTest', function() { |
| 66 var page = null; | 109 var page = null; |
| 67 var browserProxy = null; | 110 var browserProxy = null; |
| 68 | 111 |
| 69 setup(function() { | 112 setup(function() { |
| 70 browserProxy = new TestAboutPageBrowserProxy(); | 113 browserProxy = new TestAboutPageBrowserProxy(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 99 } | 142 } |
| 100 } | 143 } |
| 101 | 144 |
| 102 return { | 145 return { |
| 103 registerTests: function() { | 146 registerTests: function() { |
| 104 if (cr.isChromeOS) { | 147 if (cr.isChromeOS) { |
| 105 registerDetailedBuildInfoTests(); | 148 registerDetailedBuildInfoTests(); |
| 106 } | 149 } |
| 107 registerAboutPageTests(); | 150 registerAboutPageTests(); |
| 108 }, | 151 }, |
| 152 registerOfficialBuildTests: registerOfficialBuildTests, | |
| 109 }; | 153 }; |
| 110 }); | 154 }); |
| OLD | NEW |