Chromium Code Reviews| Index: chrome/test/data/webui/settings/about_page_tests.js |
| diff --git a/chrome/test/data/webui/settings/about_page_tests.js b/chrome/test/data/webui/settings/about_page_tests.js |
| index 07f3e54fecf1385a8931590823b4735ad181278d..6a478f278d69e0c96282a331b6d0cd98d11bc666 100644 |
| --- a/chrome/test/data/webui/settings/about_page_tests.js |
| +++ b/chrome/test/data/webui/settings/about_page_tests.js |
| @@ -143,12 +143,21 @@ cr.define('settings_about_page', function() { |
| suite('AboutPageTest', function() { |
| var page = null; |
| - var browserProxy = null; |
| + |
| + /** @type {?settings.TestAboutPageBrowserProxy} */ |
| + var aboutBrowserProxy = null; |
|
tommycli
2016/06/15 16:02:35
nit: in about_page.js this is just called browserP
dpapad
2016/06/15 17:30:19
Done, renamed it accordingly in about_page.js.
|
| + |
| + /** @type {?settings.TestLifetimeBrowserProxy} */ |
| + var lifetimeBrowserProxy = null; |
| + |
| var SPINNER_ICON = 'chrome://resources/images/throbber_small.svg'; |
| setup(function() { |
| - browserProxy = new TestAboutPageBrowserProxy(); |
| - settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; |
| + lifetimeBrowserProxy = new settings.TestLifetimeBrowserProxy(); |
| + settings.LifetimeBrowserProxyImpl.instance_ = lifetimeBrowserProxy; |
| + |
| + aboutBrowserProxy = new TestAboutPageBrowserProxy(); |
| + settings.AboutPageBrowserProxyImpl.instance_ = aboutBrowserProxy; |
| return initNewPage(); |
| }); |
| @@ -163,11 +172,12 @@ cr.define('settings_about_page', function() { |
| /** @return {!Promise} */ |
| function initNewPage() { |
| - browserProxy.reset(); |
| + aboutBrowserProxy.reset(); |
| + lifetimeBrowserProxy.reset(); |
| PolymerTest.clearBody(); |
| page = document.createElement('settings-about-page'); |
| document.body.appendChild(page); |
| - return browserProxy.whenCalled('refreshUpdateStatus'); |
| + return aboutBrowserProxy.whenCalled('refreshUpdateStatus'); |
| } |
| /** |
| @@ -292,6 +302,18 @@ cr.define('settings_about_page', function() { |
| }); |
| }); |
| + test('Relaunch', function() { |
| + var relaunch = page.$.relaunch; |
| + assertTrue(!!relaunch); |
| + assertTrue(relaunch.hidden); |
| + |
| + fireStatusChanged(UpdateStatus.NEARLY_UPDATED); |
| + assertFalse(relaunch.hidden); |
| + |
| + MockInteractions.tap(relaunch); |
| + return lifetimeBrowserProxy.whenCalled('relaunch'); |
| + }); |
| + |
| if (cr.isChromeOS) { |
| /** |
| * Test that all buttons update according to incoming |
| @@ -352,8 +374,9 @@ cr.define('settings_about_page', function() { |
| * is more stable than current channel. |
| */ |
| test('ButtonsUpdate_BetaToStable', function() { |
| - browserProxy.setChannels(BrowserChannel.BETA, BrowserChannel.STABLE); |
| - browserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| + aboutBrowserProxy.setChannels( |
| + BrowserChannel.BETA, BrowserChannel.STABLE); |
| + aboutBrowserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| return initNewPage().then(function() { |
| assertTrue(!!page.$.relaunch); |
| @@ -361,6 +384,9 @@ cr.define('settings_about_page', function() { |
| assertTrue(page.$.relaunch.hidden); |
| assertFalse(page.$.relaunchAndPowerwash.hidden); |
| + |
| + MockInteractions.tap(page.$.relaunchAndPowerwash); |
| + return lifetimeBrowserProxy.whenCalled('factoryReset'); |
| }); |
| }); |
| @@ -370,8 +396,9 @@ cr.define('settings_about_page', function() { |
| * is less stable than current channel. |
| */ |
| test('ButtonsUpdate_StableToBeta', function() { |
| - browserProxy.setChannels(BrowserChannel.STABLE, BrowserChannel.BETA); |
| - browserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| + aboutBrowserProxy.setChannels( |
| + BrowserChannel.STABLE, BrowserChannel.BETA); |
| + aboutBrowserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| return initNewPage().then(function() { |
| assertTrue(!!page.$.relaunch); |
| @@ -379,6 +406,9 @@ cr.define('settings_about_page', function() { |
| assertFalse(page.$.relaunch.hidden); |
| assertTrue(page.$.relaunchAndPowerwash.hidden); |
| + |
| + MockInteractions.tap(page.$.relaunch); |
| + return lifetimeBrowserProxy.whenCalled('relaunch'); |
| }); |
| }); |
| @@ -388,8 +418,9 @@ cr.define('settings_about_page', function() { |
| * <settings-channel-switcher-dialog>). |
| */ |
| test('ButtonsUpdate_TargetChannelChangedEvent', function() { |
| - browserProxy.setChannels(BrowserChannel.BETA, BrowserChannel.BETA); |
| - browserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| + aboutBrowserProxy.setChannels( |
| + BrowserChannel.BETA, BrowserChannel.BETA); |
| + aboutBrowserProxy.setUpdateStatus(UpdateStatus.NEARLY_UPDATED); |
| return initNewPage().then(function() { |
| assertFalse(page.$.relaunch.hidden); |
| @@ -415,7 +446,7 @@ cr.define('settings_about_page', function() { |
| * @return {!Promise} |
| */ |
| function checkRegulatoryInfo(isShowing) { |
| - return browserProxy.whenCalled('getRegulatoryInfo').then( |
| + return aboutBrowserProxy.whenCalled('getRegulatoryInfo').then( |
| function() { |
| var regulatoryInfoEl = page.$.regulatoryInfo; |
| assertTrue(!!regulatoryInfoEl); |
| @@ -432,7 +463,7 @@ cr.define('settings_about_page', function() { |
| return checkRegulatoryInfo(false).then(function() { |
| regulatoryInfo = {text: 'foo', url: 'bar'}; |
| - browserProxy.setRegulatoryInfo(regulatoryInfo); |
| + aboutBrowserProxy.setRegulatoryInfo(regulatoryInfo); |
| return initNewPage(); |
| }).then(function() { |
| return checkRegulatoryInfo(true); |
| @@ -475,7 +506,7 @@ cr.define('settings_about_page', function() { |
| test('GetHelp', function() { |
| assertTrue(!!page.$.help); |
| MockInteractions.tap(page.$.help); |
| - return browserProxy.whenCalled('openHelpPage'); |
| + return aboutBrowserProxy.whenCalled('openHelpPage'); |
| }); |
| }); |
| } |