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

Side by Side Diff: chrome/test/media_router/media_router_integration_browsertest.cc

Issue 2674793005: Use allSinks to find a sink in kFindSinkScript. (Closed)
Patch Set: Add null check 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/media_router/media_router_integration_browsertest.h" 5 #include "chrome/test/media_router/media_router_integration_browsertest.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const char kGetRouteIdScript[] = 76 const char kGetRouteIdScript[] =
77 "var routes = window.document.getElementById('media-router-container')." 77 "var routes = window.document.getElementById('media-router-container')."
78 " routeList;" 78 " routeList;"
79 "for (var i=0; i<routes.length; i++) {" 79 "for (var i=0; i<routes.length; i++) {"
80 " if (routes[i].sinkId == '%s') {" 80 " if (routes[i].sinkId == '%s') {"
81 " domAutomationController.send(routes[i].id);" 81 " domAutomationController.send(routes[i].id);"
82 " }" 82 " }"
83 "}" 83 "}"
84 "domAutomationController.send('');"; 84 "domAutomationController.send('');";
85 const char kFindSinkScript[] = 85 const char kFindSinkScript[] =
86 "var sinks = document.getElementById('media-router-container')." 86 "var sinkList = document.getElementById('media-router-container')."
87 " shadowRoot.getElementById('sink-list').getElementsByTagName('span');" 87 " shadowRoot.getElementById('sink-list');"
88 "for (var i=0; i<sinks.length; i++) {" 88 "if (sinkList) {"
89 " if (sinks[i].textContent.trim() == '%s') {" 89 " var sinks = sinkList.getElementsByTagName('span');"
90 " domAutomationController.send(true);" 90 " for (var i=0; i<sinks.length; i++) {"
91 "}}" 91 " if (sinks[i].textContent.trim() == '%s') {"
92 " domAutomationController.send(true);"
93 "}}}"
92 "domAutomationController.send(false);"; 94 "domAutomationController.send(false);";
93 const char kCheckDialogLoadedScript[] = 95 const char kCheckDialogLoadedScript[] =
94 "var container = document.getElementById('media-router-container');" 96 "var container = document.getElementById('media-router-container');"
95 "/** Wait until media router container is not undefined and " 97 "/** Wait until media router container is not undefined and "
96 "* deviceMissingUrl is not undefined, " 98 "* deviceMissingUrl is not undefined, "
97 "* once deviceMissingUrl is not undefined, which means " 99 "* once deviceMissingUrl is not undefined, which means "
98 "* the dialog is fully loaded." 100 "* the dialog is fully loaded."
99 "*/" 101 "*/"
100 "if (container != undefined && container.deviceMissingUrl != undefined) {" 102 "if (container != undefined && container.deviceMissingUrl != undefined) {"
101 " domAutomationController.send(true);" 103 " domAutomationController.send(true);"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 631
630 MediaRouterDialogControllerImpl* controller = 632 MediaRouterDialogControllerImpl* controller =
631 MediaRouterDialogControllerImpl::GetOrCreateForWebContents(web_contents); 633 MediaRouterDialogControllerImpl::GetOrCreateForWebContents(web_contents);
632 EXPECT_TRUE(controller->IsShowingMediaRouterDialog()); 634 EXPECT_TRUE(controller->IsShowingMediaRouterDialog());
633 WaitUntilSinkDiscoveredOnUI(); 635 WaitUntilSinkDiscoveredOnUI();
634 controller->HideMediaRouterDialog(); 636 controller->HideMediaRouterDialog();
635 CheckStartFailed(web_contents, "NotFoundError", "No screens found."); 637 CheckStartFailed(web_contents, "NotFoundError", "No screens found.");
636 } 638 }
637 639
638 } // namespace media_router 640 } // namespace media_router
OLDNEW
« 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