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

Unified Diff: chrome/test/media_router/media_router_integration_browsertest.cc

Issue 2674793005: Use allSinks to find a sink in kFindSinkScript. (Closed)
Patch Set: Add try-finally to kFindSinkScript to avoid exception. Created 3 years, 10 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/media_router/media_router_integration_browsertest.cc
diff --git a/chrome/test/media_router/media_router_integration_browsertest.cc b/chrome/test/media_router/media_router_integration_browsertest.cc
index 32a5e7de342edaa59860ce9dde37854c184687d2..9cf897cdfa58415bade22877f0929934151589e4 100644
--- a/chrome/test/media_router/media_router_integration_browsertest.cc
+++ b/chrome/test/media_router/media_router_integration_browsertest.cc
@@ -83,13 +83,15 @@ const char kGetRouteIdScript[] =
"}"
"domAutomationController.send('');";
const char kFindSinkScript[] =
- "var sinks = document.getElementById('media-router-container')."
- " shadowRoot.getElementById('sink-list').getElementsByTagName('span');"
- "for (var i=0; i<sinks.length; i++) {"
- " if (sinks[i].textContent.trim() == '%s') {"
- " domAutomationController.send(true);"
- "}}"
- "domAutomationController.send(false);";
+ "try {"
+ " var sinks = document.getElementById('media-router-container')."
imcheng 2017/02/09 18:18:31 Why not do a null check? e.g., const sinkList = d
cliffordcheng1 2017/02/09 20:03:48 Done.
+ " shadowRoot.getElementById('sink-list').getElementsByTagName('span');"
+ " for (var i=0; i<sinks.length; i++) {"
+ " if (sinks[i].textContent.trim() == '%s') {"
+ " domAutomationController.send(true);"
+ " }}}"
+ "finally {"
+ "domAutomationController.send(false);}";
const char kCheckDialogLoadedScript[] =
"var container = document.getElementById('media-router-container');"
"/** Wait until media router container is not undefined and "
« 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