Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: chrome/test/data/webui/media_router/media_router_container_filter_tests.js

Issue 2016193002: [Media Router WebUI] Add test for search focus when switching windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test comment explaining focus events Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/media_router/media_router_container_filter_tests.js
diff --git a/chrome/test/data/webui/media_router/media_router_container_filter_tests.js b/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
index f4bf4fb2be90436c341b4698a6b5673c4cfe5898..5f54c7a5d07ade109d164c6b72251ca2bbbde37d 100644
--- a/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
+++ b/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
@@ -609,6 +609,39 @@ cr.define('media_router_container_filter', function() {
});
});
+ // Tests that filter view is not entered when switching between windows or
+ // tabs with keyboard focus on the search input and the container is
+ // currently in sink-list view.
+ test('switching window focus does not change view', function(done) {
+ container.allSinks = fakeSinkList;
+ MockInteractions.tap(container.$$('#sink-search-icon'));
+ chainOnAnimationPromise(function() {
+ checkCurrentView(media_router.MediaRouterView.FILTER);
+ pressEscapeOnElement(container);
+ chainOnAnimationPromise(function() {
+ var searchInput = container.$$('#sink-search-input');
+ checkCurrentView(media_router.MediaRouterView.SINK_LIST);
+ assertEquals(container.shadowRoot.activeElement, searchInput);
+ var blur = new FocusEvent('blur');
+ var focus = new FocusEvent('focus');
+ // When this window loses focus, the active element receives a blur
+ // event then the window receives a blur event. When the window
+ // gains focus again, the window receives a focus event first then
+ // the active element receives a focus event. Finally the setTimeout
+ // lets these events run and we check the resulting state of the
+ // dialog.
+ searchInput.dispatchEvent(blur);
+ window.dispatchEvent(blur);
+ window.dispatchEvent(focus);
+ searchInput.dispatchEvent(focus);
+ setTimeout(function() {
+ checkCurrentView(media_router.MediaRouterView.SINK_LIST);
+ done();
+ });
+ });
+ });
+ });
+
// Tests that compareSearchMatches_ works correctly for zero and one
// substring matches from the filter text. Earlier, longer matches should
// be ordered first, in that priority order.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698