diff options
author | haibinlu <haibinlu@chromium.org> | 2015-07-29 17:09:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-30 00:09:46 +0000 |
commit | 14fd066dc6ecf407dd37def1fcd98a68a0a1cd5f (patch) | |
tree | b4f84f68885eb87cdbffbc5b9ffa475dc09abcf8 /chrome/test/data | |
parent | a77725d25b3f921c8284f5094d79cb9f61152135 (diff) | |
download | chromium_src-14fd066dc6ecf407dd37def1fcd98a68a0a1cd5f.zip chromium_src-14fd066dc6ecf407dd37def1fcd98a68a0a1cd5f.tar.gz chromium_src-14fd066dc6ecf407dd37def1fcd98a68a0a1cd5f.tar.bz2 |
[MediaRouter] Adds extensionview in route detail page if route provides it.
BUG=515165
Review URL: https://codereview.chromium.org/1253233003
Cr-Commit-Position: refs/heads/master@{#341030}
Diffstat (limited to 'chrome/test/data')
-rw-r--r-- | chrome/test/data/webui/media_router/route_details_tests.js | 56 |
1 files changed, 56 insertions, 0 deletions
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 12a9271..6a234aa 100644 --- a/chrome/test/data/webui/media_router/route_details_tests.js +++ b/chrome/test/data/webui/media_router/route_details_tests.js @@ -43,6 +43,18 @@ cr.define('route_details', function() { details.$[elementId].querySelector('span').innerText); }; + // Checks the default route view is shown. + var checkDefaultViewIsShown = function() { + assertFalse(details.$['route-information'].hasAttribute('hidden')); + assertTrue(details.$['custom-controller'].hasAttribute('hidden')); + }; + + // Checks the custom controller is shown. + var checkCustomControllerIsShown = function() { + assertTrue(details.$['route-information'].hasAttribute('hidden')); + assertFalse(details.$['custom-controller'].hasAttribute('hidden')); + }; + // Checks whether |expected| and the text in the |elementId| element // are equal given an id. var checkElementTextWithId = function(expected, elementId) { @@ -109,6 +121,7 @@ cr.define('route_details', function() { // |route| is null. assertEquals(null, details.route); checkSpanText('', 'route-title'); + checkDefaultViewIsShown(); // Set |route| to be non-null. 'route-title' text should be updated. details.route = fakeRouteOne; @@ -116,12 +129,14 @@ cr.define('route_details', function() { checkSpanText(fakeRouteOne.title, 'route-title'); checkSpanText('', 'route-status'); assertEquals(null, details.sink); + checkDefaultViewIsShown(); // Set |route| to a different route. 'route-title' text should // be updated. details.route = fakeRouteTwo; assertEquals(fakeRouteTwo, details.route); checkSpanText(fakeRouteTwo.title, 'route-title'); + checkDefaultViewIsShown(); }); // Tests when |sink| exists but |route| is null. @@ -167,6 +182,47 @@ cr.define('route_details', function() { checkSpanText('', 'route-title'); checkSpanText('', 'route-status'); }); + + // Tests when |route| and |sink| both exist and |route| has custom + // controller and it loads. + test('route has custom controller and loading succeeds', function(done) { + details.routeProviderExtensionId = '123'; + fakeRouteOne.customControllerPath = 'custom_view.html'; + var loadInvoked = false; + details.$['custom-controller'].load = function(url) { + loadInvoked = true; + assertEquals('chrome-extension://123/custom_view.html', url); + return Promise.resolve(); + }; + + details.route = fakeRouteOne; + details.sink = fakeSinkOne; + setTimeout(function() { + assertTrue(loadInvoked); + checkCustomControllerIsShown(); + done(); + }); + }); + + // Tests when |route| and |sink| both exist and |route| has custom + // controller but it fails to load. + test('route has custom controller but loading fails', function(done) { + details.routeProviderExtensionId = '123'; + fakeRouteOne.customControllerPath = 'custom_view.html'; + var loadInvoked = false; + details.$['custom-controller'].load = function(url) { + loadInvoked = true; + return Promise.reject(); + }; + + details.route = fakeRouteOne; + details.sink = fakeSinkOne; + setTimeout(function() { + assertTrue(loadInvoked); + checkDefaultViewIsShown(); + done(); + }); + }); }); } |