From 34d014a126510ba4cfc4e6c077411f8b60f77ef3 Mon Sep 17 00:00:00 2001 From: apacible Date: Sat, 1 Aug 2015 08:05:33 -0700 Subject: [PATCH] Update Media Router route-details element for no custom controller. Review URL: https://codereview.chromium.org/1253003004 Cr-Commit-Position: refs/heads/master@{#341467} --- chrome/app/media_router_strings.grdp | 2 +- .../elements/route_details/route_details.css | 16 +++------- .../elements/route_details/route_details.html | 7 +---- .../elements/route_details/route_details.js | 16 ++++------ .../data/webui/media_router/route_details_tests.js | 35 +++++++++------------- 5 files changed, 25 insertions(+), 51 deletions(-) diff --git a/chrome/app/media_router_strings.grdp b/chrome/app/media_router_strings.grdp index 527678425459..e364110e0202 100644 --- a/chrome/app/media_router_strings.grdp +++ b/chrome/app/media_router_strings.grdp @@ -61,7 +61,7 @@ - Casting to $1Living Room TV + Casting: $1Video Stop casting diff --git a/chrome/browser/resources/media_router/elements/route_details/route_details.css b/chrome/browser/resources/media_router/elements/route_details/route_details.css index 01b53357bc7f..ce7884ae4b3b 100644 --- a/chrome/browser/resources/media_router/elements/route_details/route_details.css +++ b/chrome/browser/resources/media_router/elements/route_details/route_details.css @@ -21,17 +21,9 @@ #route-information { -webkit-padding-start: 30px; - height: 75px; - line-height: 1.125em; -} - -#route-status { - color: rgb(125, 125, 125); - margin: 8px 0; -} - -#route-title { - font-weight: bold; - margin: 8px 0; + background-color: white; + font-size: 1.2em; + height: 40px; overflow: hidden; + padding: 20px 30px; } diff --git a/chrome/browser/resources/media_router/elements/route_details/route_details.html b/chrome/browser/resources/media_router/elements/route_details/route_details.html index 3e87f3fc0149..0930546efb06 100644 --- a/chrome/browser/resources/media_router/elements/route_details/route_details.html +++ b/chrome/browser/resources/media_router/elements/route_details/route_details.html @@ -13,12 +13,7 @@ [[sink.name]]
-
- [[route.title]] -
-
- [[activityStatus_]] -
+ [[activityStatus_]]
diff --git a/chrome/browser/resources/media_router/elements/route_details/route_details.js b/chrome/browser/resources/media_router/elements/route_details/route_details.js index b90700e30f5a..686ee01dbb80 100644 --- a/chrome/browser/resources/media_router/elements/route_details/route_details.js +++ b/chrome/browser/resources/media_router/elements/route_details/route_details.js @@ -34,7 +34,6 @@ Polymer({ sink: { type: Object, value: null, - observer: 'updateActivityStatus_', }, /** @@ -89,10 +88,15 @@ Polymer({ /** * Loads the custom controller if |route.customControllerPath| exists. * Falls back to the default route details view otherwise, or if load fails. + * Updates |activityStatus_| for the default view. * * @private */ maybeLoadCustomController_: function() { + this.activityStatus_ = this.route ? + loadTimeData.getStringF('castingActivityStatus', this.route.title) : + ''; + if (!this.route || !this.route.customControllerPath || !this.routeProviderExtensionId) { this.isCustomControllerHidden_ = true; @@ -115,14 +119,4 @@ Polymer({ that.isCustomControllerHidden_ = true; }); }, - - /** - * Updates |activityStatus_| with the name of |sink|. - * - * @private - */ - updateActivityStatus_: function() { - this.activityStatus_ = this.sink ? - loadTimeData.getStringF('castingActivityStatus', this.sink.name) : ''; - } }); diff --git a/chrome/test/data/webui/media_router/route_details_tests.js b/chrome/test/data/webui/media_router/route_details_tests.js index 6a234aa2d0a7..fca3214da512 100644 --- a/chrome/test/data/webui/media_router/route_details_tests.js +++ b/chrome/test/data/webui/media_router/route_details_tests.js @@ -111,8 +111,7 @@ cr.define('route_details', function() { // text is styled as upper case. checkSpanText(loadTimeData.getString('stopCastingButton') .toUpperCase(), 'close-route-button'); - checkSpanText('', 'route-title'); - checkSpanText('', 'route-status'); + checkSpanText('', 'route-information'); checkElementTextWithId('', 'sink-name'); }); @@ -120,22 +119,21 @@ cr.define('route_details', function() { test('route is set', function() { // |route| is null. assertEquals(null, details.route); - checkSpanText('', 'route-title'); checkDefaultViewIsShown(); - // Set |route| to be non-null. 'route-title' text should be updated. + // Set |route| to be non-null. details.route = fakeRouteOne; assertEquals(fakeRouteOne, details.route); - checkSpanText(fakeRouteOne.title, 'route-title'); - checkSpanText('', 'route-status'); + checkSpanText(loadTimeData.getStringF('castingActivityStatus', + fakeRouteOne.title), 'route-information'); assertEquals(null, details.sink); checkDefaultViewIsShown(); - // Set |route| to a different route. 'route-title' text should - // be updated. + // Set |route| to a different route. details.route = fakeRouteTwo; assertEquals(fakeRouteTwo, details.route); - checkSpanText(fakeRouteTwo.title, 'route-title'); + checkSpanText(loadTimeData.getStringF('castingActivityStatus', + fakeRouteTwo.title), 'route-information'); checkDefaultViewIsShown(); }); @@ -143,24 +141,21 @@ cr.define('route_details', function() { test('sink is set', function() { // |sink| is null. assertEquals(null, details.sink); - checkSpanText('', 'route-status'); + checkSpanText('', 'route-information'); - // Set |sink| to be non-null. 'route-status' should be updated. + // Set |sink| to be non-null. 'route-information' should be updated. details.sink = fakeSinkOne; assertEquals(fakeSinkOne, details.sink); assertEquals(null, details.route); - checkSpanText('', 'route-title'); checkElementTextWithId(fakeSinkOne.name, 'sink-name'); - checkSpanText(loadTimeData.getStringF('castingActivityStatus', - fakeSinkOne.name), 'route-status'); + checkSpanText('', 'route-information'); - // Set |sink| to be a different sink. 'route-status' text should + // Set |sink| to be a different sink. 'route-information' text should // be updated. details.sink = fakeSinkTwo; assertEquals(fakeSinkTwo, details.sink); checkElementTextWithId(fakeSinkTwo.name, 'sink-name'); - checkSpanText(loadTimeData.getStringF('castingActivityStatus', - fakeSinkTwo.name), 'route-status'); + checkSpanText('', 'route-information'); }); // Tests when |route| and |sink| both exist. @@ -169,18 +164,16 @@ cr.define('route_details', function() { details.sink = fakeSinkOne; assertEquals(fakeSinkOne, details.sink); assertEquals(fakeRouteOne, details.route); - checkSpanText(fakeRouteOne.title, 'route-title'); checkElementTextWithId(fakeSinkOne.name, 'sink-name'); checkSpanText(loadTimeData.getStringF('castingActivityStatus', - fakeSinkOne.name), 'route-status'); + fakeRouteOne.title), 'route-information'); }); // Tests when |route| and |sink| are both null. test('sink and route are null', function() { assertEquals(null, details.route); assertEquals(null, details.sink); - checkSpanText('', 'route-title'); - checkSpanText('', 'route-status'); + checkSpanText('', 'route-information'); }); // Tests when |route| and |sink| both exist and |route| has custom -- 2.11.4.GIT