Commit bad14634 authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

[Media Router] Remove the extensionview route controller

This removes the extension_view_wrapper view that hosted the extensionview route controller.

This also removes the MediaRouterUIRouteController feature that was used for enabling/disabling the WebUI route controller; it will now always be enabled.
MediaRoute's custom_controller_path attribute will be removed in a separate patch.

Bug: 787588
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I47ac68774dc47d4574125b0ba7730c7567443332
Reviewed-on: https://chromium-review.googlesource.com/775553Reviewed-by: default avatarDerek Cheng <imcheng@chromium.org>
Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520986}
parent 23c523b0
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
<include name="IDR_ROUTE_CONTROLS_HTML" file="resources\media_router\elements\route_controls\route_controls.html" type="BINDATA" /> <include name="IDR_ROUTE_CONTROLS_HTML" file="resources\media_router\elements\route_controls\route_controls.html" type="BINDATA" />
<include name="IDR_ROUTE_CONTROLS_CSS" file="resources\media_router\elements\route_controls\route_controls.css" type="BINDATA" /> <include name="IDR_ROUTE_CONTROLS_CSS" file="resources\media_router\elements\route_controls\route_controls.css" type="BINDATA" />
<include name="IDR_ROUTE_CONTROLS_JS" file="resources\media_router\elements\route_controls\route_controls.js" type="BINDATA" /> <include name="IDR_ROUTE_CONTROLS_JS" file="resources\media_router\elements\route_controls\route_controls.js" type="BINDATA" />
<include name="IDR_EXTENSION_VIEW_WRAPPER_HTML" file="resources\media_router\elements\route_details\extension_view_wrapper\extension_view_wrapper.html" type="BINDATA" />
<include name="IDR_EXTENSION_VIEW_WRAPPER_CSS" file="resources\media_router\elements\route_details\extension_view_wrapper\extension_view_wrapper.css" type="BINDATA" />
<include name="IDR_EXTENSION_VIEW_WRAPPER_JS" file="resources\media_router\elements\route_details\extension_view_wrapper\extension_view_wrapper.js" type="BINDATA" />
<include name="IDR_ROUTE_DETAILS_HTML" file="resources\media_router\elements\route_details\route_details.html" type="BINDATA" /> <include name="IDR_ROUTE_DETAILS_HTML" file="resources\media_router\elements\route_details\route_details.html" type="BINDATA" />
<include name="IDR_ROUTE_DETAILS_CSS" file="resources\media_router\elements\route_details\route_details.css" type="BINDATA" /> <include name="IDR_ROUTE_DETAILS_CSS" file="resources\media_router\elements\route_details\route_details.css" type="BINDATA" />
<include name="IDR_ROUTE_DETAILS_JS" file="resources\media_router\elements\route_details\route_details.js" type="BINDATA" /> <include name="IDR_ROUTE_DETAILS_JS" file="resources\media_router\elements\route_details\route_details.js" type="BINDATA" />
......
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#route-title { #route-title {
color: rgb(125, 125, 125); color: rgb(125, 125, 125);
margin: 3px 8px; margin: 3px 8px;
overflow: hidden;
} }
#route-volume-slider { #route-volume-slider {
......
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
<link rel="import" type="css" href="route_controls.css"> <link rel="import" type="css" href="route_controls.css">
<template> <template>
<div id="media-controls"> <div id="media-controls">
<!--
TODO(crbug.com/786208): Remove the div below and always render the
description in the details element. And, possibly combine details and
controls elements.
-->
<div class="ellipsis" id="route-description" <div class="ellipsis" id="route-description"
title="[[routeDescription_]]"> title="[[routeDescription_]]">
[[routeDescription_]] [[routeDescription_]]
......
...@@ -20,16 +20,6 @@ Polymer({ ...@@ -20,16 +20,6 @@ Polymer({
value: 0, value: 0,
}, },
/**
* The route description to display. Uses the media route description if
* none is provided by the media route status object.
* @private {string}
*/
routeDescription_: {
type: String,
value: '',
},
/** /**
* The volume shown in the volume control, between 0 and 1. * The volume shown in the volume control, between 0 and 1.
* @private {number} * @private {number}
...@@ -49,15 +39,6 @@ Polymer({ ...@@ -49,15 +39,6 @@ Polymer({
value: false, value: false,
}, },
/**
* Keep in sync with media remoting individual user setting.
* @private {boolean}
*/
mediaRemotingEnabled_: {
type: Boolean,
value: true,
},
/** /**
* The timestamp for when the initial media status was loaded. * The timestamp for when the initial media status was loaded.
* @private {number} * @private {number}
...@@ -115,6 +96,15 @@ Polymer({ ...@@ -115,6 +96,15 @@ Polymer({
value: 0, value: 0,
}, },
/**
* Keep in sync with media remoting individual user setting.
* @private {boolean}
*/
mediaRemotingEnabled_: {
type: Boolean,
value: true,
},
/** /**
* The route currently associated with this controller. * The route currently associated with this controller.
* @type {?media_router.Route|undefined} * @type {?media_router.Route|undefined}
...@@ -124,6 +114,16 @@ Polymer({ ...@@ -124,6 +114,16 @@ Polymer({
observer: 'onRouteUpdated_', observer: 'onRouteUpdated_',
}, },
/**
* The route description to display. Uses the media route description if
* none is provided by the media route status object.
* @private {string}
*/
routeDescription_: {
type: String,
value: '',
},
/** /**
* The timestamp for when the route details view was opened. * The timestamp for when the route details view was opened.
* @type {number} * @type {number}
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
{ {
'target_name': 'route_details', 'target_name': 'route_details',
'dependencies': [ 'dependencies': [
'extension_view_wrapper/compiled_resources2.gyp:extension_view_wrapper',
'../../compiled_resources2.gyp:media_router_data', '../../compiled_resources2.gyp:media_router_data',
'../../compiled_resources2.gyp:media_router_ui_interface', '../../compiled_resources2.gyp:media_router_ui_interface',
'../route_controls/compiled_resources2.gyp:route_controls', '../route_controls/compiled_resources2.gyp:route_controls',
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'extension_view_wrapper',
'dependencies': [
'../../../compiled_resources2.gyp:media_router_data',
],
'includes': ['../../../../../../../third_party/closure_compiler/compile_js2.gypi'],
},
],
}
/* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
#custom-controller {
display: inline-block;
height: 142px;
width: 100%;
}
<link rel="import" href="chrome://resources/html/polymer.html">
<dom-module id="extension-view-wrapper">
<link rel="import" type="css" href="extension_view_wrapper.css">
<template>
<extensionview id="custom-controller">
</extensionview>
</template>
<script src="extension_view_wrapper.js"></script>
</dom-module>
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This Polymer element shows the custom controller for a route using
// extensionview.
Polymer({
is: 'extension-view-wrapper',
properties: {
/**
* Whether the extension view is ready to be shown.
* @type {boolean}
*/
isExtensionViewReady: {
type: Boolean,
value: false,
notify: true,
},
/**
* The route to show the custom controller for.
* @type {?media_router.Route|undefined}
*/
route: {
type: Object,
observer: 'maybeLoadExtensionView_',
},
/**
* The timestamp for when the route details view was opened.
* @type {number}
*/
routeDetailsOpenTime: {
type: Number,
value: 0,
},
},
/**
* @return {?string}
*/
getCustomControllerPath_: function() {
if (!this.route || !this.route.customControllerPath) {
return null;
}
return this.route.customControllerPath +
'&requestTimestamp=' + this.routeDetailsOpenTime;
},
/**
* Loads the custom controller if the controller path for the current route is
* valid.
*/
maybeLoadExtensionView_: function() {
/** @const */ var extensionview = this.$['custom-controller'];
/** @const */ var controllerPath = this.getCustomControllerPath_();
// Do nothing if the controller path doesn't exist or is already shown in
// the extension view.
if (!controllerPath || controllerPath == extensionview.src) {
return;
}
/** @const */ var that = this;
extensionview.load(controllerPath)
.then(
function() {
// Load was successful; show the custom controller.
that.isExtensionViewReady = true;
},
function() {
// Load was unsuccessful; fall back to default view.
that.isExtensionViewReady = false;
});
},
});
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="extension_view_wrapper/extension_view_wrapper.html">
<link rel="import" href="../route_controls/route_controls.html"> <link rel="import" href="../route_controls/route_controls.html">
<dom-module id="route-details"> <dom-module id="route-details">
<link rel="import" type="css" href="../../media_router_common.css"> <link rel="import" type="css" href="../../media_router_common.css">
<link rel="import" type="css" href="route_details.css"> <link rel="import" type="css" href="route_details.css">
<template> <template>
<div class="ellipsis" id="route-description" title="[[routeDescription_]]" <div class="ellipsis" id="route-description" title="[[routeDescription_]]"
hidden$="[[!shouldShowRouteDescription_(controllerType_)]]"> hidden$="[[shouldShowWebUiControls_(route)]]">
[[routeDescription_]] [[routeDescription_]]
</div> </div>
<template is="dom-if" if="[[shouldAttemptLoadingExtensionView_(route)]]"> <template is="dom-if" if="[[shouldShowWebUiControls_(route)]]">
<extension-view-wrapper id="extension-view-wrapper" route="[[route]]"
route-details-open-time="[[openTime_]]"
is-extension-view-ready="{{isExtensionViewReady}}"
hidden$="[[!shouldShowExtensionView_(controllerType_)]]">
</extension-view-wrapper>
</template>
<template is="dom-if" if="[[shouldShowWebUiControls_(controllerType_)]]">
<route-controls id="route-controls" <route-controls id="route-controls"
route-details-open-time="[[openTime_]]" route-details-open-time="[[openTime_]]"
route="[[route]]"></route-controls> route="[[route]]"></route-controls>
......
...@@ -27,15 +27,6 @@ Polymer({ ...@@ -27,15 +27,6 @@ Polymer({
'isAnySinkCurrentlyLaunching, shownCastModeValue)', 'isAnySinkCurrentlyLaunching, shownCastModeValue)',
}, },
/**
* An enum value to represent the controller to show.
* @private {number}
*/
controllerType_: {
type: Number,
computed: 'computeControllerType_(route, isExtensionViewReady)',
},
/** /**
* Whether a sink is currently launching in the container. * Whether a sink is currently launching in the container.
* @type {boolean} * @type {boolean}
...@@ -45,15 +36,6 @@ Polymer({ ...@@ -45,15 +36,6 @@ Polymer({
value: false, value: false,
}, },
/**
* Whether the custom controller extensionview is ready to be shown.
* @type {boolean}
*/
isExtensionViewReady: {
type: Boolean,
value: false,
},
/** /**
* The timestamp for when the route details view was opened. We initialize * The timestamp for when the route details view was opened. We initialize
* the value in a function so that the value is set when the element is * the value in a function so that the value is set when the element is
...@@ -149,22 +131,6 @@ Polymer({ ...@@ -149,22 +131,6 @@ Polymer({
(selectedCastMode != route.currentCastMode); (selectedCastMode != route.currentCastMode);
}, },
/**
* @param {?media_router.Route} route
* @param {boolean} isExtensionViewReady
* @return {number} An enum value to represent the controller to show.
* @private
*/
computeControllerType_: function(route, isExtensionViewReady) {
if (route && route.supportsWebUiController) {
return media_router.ControllerType.WEBUI;
}
if (isExtensionViewReady) {
return media_router.ControllerType.EXTENSION;
}
return media_router.ControllerType.NONE;
},
/** /**
* @param {number} castMode User selected cast mode or AUTO. * @param {number} castMode User selected cast mode or AUTO.
* @param {?media_router.Sink} sink Sink to which we will cast. * @param {?media_router.Sink} sink Sink to which we will cast.
...@@ -190,21 +156,11 @@ Polymer({ ...@@ -190,21 +156,11 @@ Polymer({
return castMode & sink.castModes; return castMode & sink.castModes;
}, },
/**
* Updates |routeDescription_| for the default view.
*
* @private
*/
updateRouteDescription_: function() {
this.routeDescription_ = this.route ? this.route.description : '';
},
/** /**
* Called when the route details view is closed. Resets route-controls. * Called when the route details view is closed. Resets route-controls.
*/ */
onClosed: function() { onClosed: function() {
if (this.controllerType_ === media_router.ControllerType.WEBUI && if (this.$$('route-controls')) {
this.$$('route-controls')) {
this.$$('route-controls').reset(); this.$$('route-controls').reset();
} }
}, },
...@@ -213,62 +169,29 @@ Polymer({ ...@@ -213,62 +169,29 @@ Polymer({
* Called when the route details view is opened. * Called when the route details view is opened.
*/ */
onOpened: function() { onOpened: function() {
if (this.controllerType_ === media_router.ControllerType.WEBUI && if (this.$$('route-controls')) {
this.$$('route-controls')) {
media_router.ui.setRouteControls( media_router.ui.setRouteControls(
/** @type {RouteControlsInterface} */ (this.$$('route-controls'))); /** @type {RouteControlsInterface} */ (this.$$('route-controls')));
} }
}, },
/** /**
* Updates either the extensionview or the WebUI route controller, depending * Updates |routeDescription_| for the default view.
* on which should be shown.
* @param {?media_router.Route} newRoute
* @private
*/
onRouteChange_: function(newRoute) {
if (this.controllerType_ !== media_router.ControllerType.WEBUI) {
this.updateRouteDescription_();
}
},
/**
* @param {?media_router.Route} route * @param {?media_router.Route} route
* @return {boolean}
* @private * @private
*/ */
shouldAttemptLoadingExtensionView_: function(route) { onRouteChange_: function(route) {
return !!route && !route.supportsWebUiController; this.routeDescription_ = route ? route.description : '';
}, },
/** /**
* @param {number} controllerType * @param {?media_router.Route} route
* @return {boolean} Whether the extensionview should be shown instead of the
* default route info element or the WebUI route controller.
* @private
*/
shouldShowExtensionView_: function(controllerType) {
return controllerType === media_router.ControllerType.EXTENSION;
},
/**
* @param {number} controllerType
* @return {boolean} Whether the route info element should be shown instead of
* the extensionview or the WebUI route controller.
* @private
*/
shouldShowRouteDescription_: function(controllerType) {
return controllerType === media_router.ControllerType.NONE;
},
/**
* @param {number} controllerType
* @return {boolean} Whether the WebUI route controller should be shown * @return {boolean} Whether the WebUI route controller should be shown
* instead of the default route info element or the extensionview. * instead of the default route description element.
* @private * @private
*/ */
shouldShowWebUiControls_: function(controllerType) { shouldShowWebUiControls_: function(route) {
return controllerType === media_router.ControllerType.WEBUI; return route && route.supportsWebUiController;
}, },
/** /**
......
...@@ -21,12 +21,8 @@ ...@@ -21,12 +21,8 @@
} }
.ellipsis { .ellipsis {
overflow: hidden;
padding: 0 1%; padding: 0 1%;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
#route-description {
background-color: white;
overflow: hidden;
}
...@@ -24,16 +24,6 @@ media_router.CastModeType = { ...@@ -24,16 +24,6 @@ media_router.CastModeType = {
LOCAL_FILE: 0x8, LOCAL_FILE: 0x8,
}; };
/**
* Route controller types that can be shown in the route details view.
* @enum {number}
*/
media_router.ControllerType = {
NONE: 0,
WEBUI: 1,
EXTENSION: 2,
};
/** /**
* The ESC key maps to KeyboardEvent.key value 'Escape'. * The ESC key maps to KeyboardEvent.key value 'Escape'.
* @const {string} * @const {string}
......
...@@ -81,17 +81,6 @@ void AddPolymerElements(content::WebUIDataSource* html_source) { ...@@ -81,17 +81,6 @@ void AddPolymerElements(content::WebUIDataSource* html_source) {
html_source->AddResourcePath( html_source->AddResourcePath(
"elements/media_router_container/pseudo_sink_search_state.js", "elements/media_router_container/pseudo_sink_search_state.js",
IDR_PSEUDO_SINK_SEARCH_STATE_JS); IDR_PSEUDO_SINK_SEARCH_STATE_JS);
html_source->AddResourcePath(
"elements/route_details/extension_view_wrapper/"
"extension_view_wrapper.html",
IDR_EXTENSION_VIEW_WRAPPER_HTML);
html_source->AddResourcePath(
"elements/route_details/extension_view_wrapper/extension_view_wrapper.js",
IDR_EXTENSION_VIEW_WRAPPER_JS);
html_source->AddResourcePath(
"elements/route_details/extension_view_wrapper/"
"extension_view_wrapper.css",
IDR_EXTENSION_VIEW_WRAPPER_CSS);
} }
} // namespace } // namespace
......
...@@ -158,17 +158,14 @@ std::unique_ptr<base::DictionaryValue> RouteToValue( ...@@ -158,17 +158,14 @@ std::unique_ptr<base::DictionaryValue> RouteToValue(
bool can_join, bool can_join,
const std::string& extension_id, const std::string& extension_id,
bool incognito, bool incognito,
int current_cast_mode, int current_cast_mode) {
bool is_web_ui_route_controller_available) {
auto dictionary = base::MakeUnique<base::DictionaryValue>(); auto dictionary = base::MakeUnique<base::DictionaryValue>();
dictionary->SetString("id", route.media_route_id()); dictionary->SetString("id", route.media_route_id());
dictionary->SetString("sinkId", route.media_sink_id()); dictionary->SetString("sinkId", route.media_sink_id());
dictionary->SetString("description", route.description()); dictionary->SetString("description", route.description());
dictionary->SetBoolean("isLocal", route.is_local()); dictionary->SetBoolean("isLocal", route.is_local());
dictionary->SetBoolean( dictionary->SetBoolean("supportsWebUiController",
"supportsWebUiController", route.controller_type() != RouteControllerType::kNone);
is_web_ui_route_controller_available &&
route.controller_type() != RouteControllerType::kNone);
dictionary->SetBoolean("canJoin", can_join); dictionary->SetBoolean("canJoin", can_join);
if (current_cast_mode > 0) { if (current_cast_mode > 0) {
dictionary->SetInteger("currentCastMode", current_cast_mode); dictionary->SetInteger("currentCastMode", current_cast_mode);
...@@ -261,8 +258,6 @@ MediaRouterWebUIMessageHandler::MediaRouterWebUIMessageHandler( ...@@ -261,8 +258,6 @@ MediaRouterWebUIMessageHandler::MediaRouterWebUIMessageHandler(
: incognito_( : incognito_(
Profile::FromWebUI(media_router_ui->web_ui())->IsOffTheRecord()), Profile::FromWebUI(media_router_ui->web_ui())->IsOffTheRecord()),
dialog_closing_(false), dialog_closing_(false),
is_web_ui_route_controller_available_(base::FeatureList::IsEnabled(
features::kMediaRouterUIRouteController)),
media_router_ui_(media_router_ui) {} media_router_ui_(media_router_ui) {}
MediaRouterWebUIMessageHandler::~MediaRouterWebUIMessageHandler() {} MediaRouterWebUIMessageHandler::~MediaRouterWebUIMessageHandler() {}
...@@ -305,7 +300,7 @@ void MediaRouterWebUIMessageHandler::OnCreateRouteResponseReceived( ...@@ -305,7 +300,7 @@ void MediaRouterWebUIMessageHandler::OnCreateRouteResponseReceived(
route->media_route_id(), media_router_ui_->routes_and_cast_modes()); route->media_route_id(), media_router_ui_->routes_and_cast_modes());
std::unique_ptr<base::DictionaryValue> route_value(RouteToValue( std::unique_ptr<base::DictionaryValue> route_value(RouteToValue(
*route, false, media_router_ui_->GetRouteProviderExtensionId(), *route, false, media_router_ui_->GetRouteProviderExtensionId(),
incognito_, current_cast_mode, is_web_ui_route_controller_available_)); incognito_, current_cast_mode));
web_ui()->CallJavascriptFunctionUnsafe(kOnCreateRouteResponseReceived, web_ui()->CallJavascriptFunctionUnsafe(kOnCreateRouteResponseReceived,
base::Value(sink_id), *route_value, base::Value(sink_id), *route_value,
base::Value(route->for_display())); base::Value(route->for_display()));
...@@ -1132,9 +1127,8 @@ std::unique_ptr<base::ListValue> MediaRouterWebUIMessageHandler::RoutesToValue( ...@@ -1132,9 +1127,8 @@ std::unique_ptr<base::ListValue> MediaRouterWebUIMessageHandler::RoutesToValue(
base::ContainsValue(joinable_route_ids, route.media_route_id()); base::ContainsValue(joinable_route_ids, route.media_route_id());
int current_cast_mode = int current_cast_mode =
CurrentCastModeForRouteId(route.media_route_id(), current_cast_modes); CurrentCastModeForRouteId(route.media_route_id(), current_cast_modes);
std::unique_ptr<base::DictionaryValue> route_val( std::unique_ptr<base::DictionaryValue> route_val(RouteToValue(
RouteToValue(route, can_join, extension_id, incognito_, route, can_join, extension_id, incognito_, current_cast_mode));
current_cast_mode, is_web_ui_route_controller_available_));
value->Append(std::move(route_val)); value->Append(std::move(route_val));
} }
......
...@@ -166,9 +166,6 @@ class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { ...@@ -166,9 +166,6 @@ class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler {
// Keeps track of whether a command to close the dialog has been issued. // Keeps track of whether a command to close the dialog has been issued.
bool dialog_closing_; bool dialog_closing_;
// Whether the WebUI version of route controller is available for use.
const bool is_web_ui_route_controller_available_;
// The media status currently shown in the UI. // The media status currently shown in the UI.
base::Optional<MediaStatus> current_media_status_; base::Optional<MediaStatus> current_media_status_;
......
...@@ -329,12 +329,6 @@ const base::Feature kMaterialDesignIncognitoNTP{ ...@@ -329,12 +329,6 @@ const base::Feature kMaterialDesignIncognitoNTP{
// during Cast Tab Mirroring. // during Cast Tab Mirroring.
const base::Feature kMediaRemoting{"MediaRemoting", const base::Feature kMediaRemoting{"MediaRemoting",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, replaces the <extensionview> controller in the route details view
// of the Media Router dialog with the controller bundled with the WebUI
// resources.
const base::Feature kMediaRouterUIRouteController{
"MediaRouterUIRouteController", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
// Enables or disables modal permission prompts. // Enables or disables modal permission prompts.
......
...@@ -169,7 +169,6 @@ extern const base::Feature kMaterialDesignIncognitoNTP; ...@@ -169,7 +169,6 @@ extern const base::Feature kMaterialDesignIncognitoNTP;
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
extern const base::Feature kMediaRemoting; extern const base::Feature kMediaRemoting;
extern const base::Feature kMediaRouterUIRouteController;
#endif #endif
extern const base::Feature kModalPermissionPrompts; extern const base::Feature kModalPermissionPrompts;
......
...@@ -73,19 +73,6 @@ cr.define('route_details', function() { ...@@ -73,19 +73,6 @@ cr.define('route_details', function() {
.hasAttribute('hidden')); .hasAttribute('hidden'));
}; };
// Checks the custom controller is shown.
var checkCustomControllerIsShown = function() {
assertTrue(details.$$('#route-description').hasAttribute('hidden'));
assertFalse(
details.$$('extension-view-wrapper').hasAttribute('hidden'));
};
// Checks whether |expected| and the text in the |elementId| element
// are equal given an id.
var checkElementTextWithId = function(expected, elementId) {
assertEquals(expected, details.$$('#' + elementId).innerText);
};
// Import route_details.html before running suite. // Import route_details.html before running suite.
suiteSetup(function() { suiteSetup(function() {
return PolymerTest.importHtml( return PolymerTest.importHtml(
...@@ -213,49 +200,6 @@ cr.define('route_details', function() { ...@@ -213,49 +200,6 @@ cr.define('route_details', function() {
checkDefaultViewIsShown(); checkDefaultViewIsShown();
checkStartCastButtonIsShown(); checkStartCastButtonIsShown();
}); });
// Tests when |route| exists, has a custom controller, and it loads.
test('route has custom controller and loading succeeds', function(done) {
// Get the extension-view-wrapper stamped first, so that we can mock out
// the load method.
details.route = fakeRouteTwo;
setTimeout(function() {
details.$$('extension-view-wrapper').$$('#custom-controller').load =
function(url) {
setTimeout(function() {
assertEquals(
fakeRouteOneControllerPath,
url.substring(0, fakeRouteOneControllerPath.length));
checkCustomControllerIsShown();
done();
});
return Promise.resolve();
};
details.route = fakeRouteOne;
});
});
// Tests when |route| exists, has a custom controller, but fails to load.
test('route has custom controller but loading fails', function(done) {
// Get the extension-view-wrapper stamped first, so that we can mock out
// the load method.
details.route = fakeRouteTwo;
setTimeout(function() {
details.$$('extension-view-wrapper').$$('#custom-controller').load =
function(url) {
setTimeout(function() {
checkDefaultViewIsShown();
done();
});
return Promise.reject();
};
details.route = fakeRouteOne;
});
});
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment