Index: chrome/test/data/webui/media_router/media_router_header_tests.js |
diff --git a/chrome/test/data/webui/media_router/media_router_header_tests.js b/chrome/test/data/webui/media_router/media_router_header_tests.js |
index f82ef68ca6232b75c72fc3513339fe538b1d089c..a30065b9af91bfba45704e19128408fe0e059878 100644 |
--- a/chrome/test/data/webui/media_router/media_router_header_tests.js |
+++ b/chrome/test/data/webui/media_router/media_router_header_tests.js |
@@ -20,7 +20,8 @@ cr.define('media_router_header', function() { |
'arrow-drop-icon', |
'back-button', |
'close-button', |
- 'header-text' |
+ 'header-text', |
+ 'user-email-container', |
]; |
// Checks whether the current icon matches the icon used for the view. |
@@ -31,7 +32,7 @@ cr.define('media_router_header', function() { |
// Checks whether |element| is hidden. |
apacible
2016/02/23 21:51:01
Update comment to mention unstamped elements would
amp
2016/02/24 00:29:23
Done.
|
var checkElementHidden = function(hidden, element) { |
- assertEquals(hidden, element.hidden); |
+ assertEquals(hidden, !element || element.hidden); |
}; |
// Checks whether the elements specified in |elementIdList| are visible. |
@@ -49,15 +50,17 @@ cr.define('media_router_header', function() { |
// Import media_router_header.html before running suite. |
suiteSetup(function() { |
return PolymerTest.importHtml( |
- 'chrome://media-router/elements/media_router_header/' + |
- 'media_router_header.html'); |
+ 'chrome://media-router/elements/media_router_container/' + |
+ 'media_router_container.html'); |
}); |
// Initialize an media-router-header before each test. |
setup(function(done) { |
PolymerTest.clearBody(); |
- header = document.createElement('media-router-header'); |
- document.body.appendChild(header); |
+ container = document.createElement('media-router-container'); |
+ document.body.appendChild(container); |
+ header = container.$['container-header']; |
+ header.userEmail = 'user@example.com'; |
apacible
2016/02/23 21:51:01
Set |userEmail| into the tests when relevant since
amp
2016/02/24 00:29:23
Done.
|
// Allow for the media router header to be created and attached. |
setTimeout(done); |
@@ -137,6 +140,15 @@ cr.define('media_router_header', function() { |
done(); |
}); |
+ // Tests for 'header-height-changed' event firing when the header changes |
+ // if email is shown. |
+ test('header height changed with email shown', function(done) { |
+ header.addEventListener('header-height-changed', function() { |
+ done(); |
+ }); |
+ header.showEmail = true; |
+ }); |
+ |
// Tests the |computeArrowDropIcon_| function. |
test('compute arrow drop icon', function() { |
assertEquals('arrow-drop-up', |
@@ -181,6 +193,15 @@ cr.define('media_router_header', function() { |
'close-button', |
'header-text']); |
}); |
+ |
+ // Tests for expected visible UI depending on the email properties. |
+ test('visibility of UI depending on email', function(done) { |
apacible
2016/02/23 21:51:01
We should also test if the header doesn't show the
amp
2016/02/24 00:29:23
Done.
|
+ header.showEmail = true; |
+ setTimeout(function() { |
+ assertFalse(header.$$('#user-email-container').hidden); |
+ done(); |
+ }); |
+ }); |
}); |
} |