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

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

Issue 1413403003: [Media Router] Auto-close Media Router dialog after starting or stopping a session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 3bda71218de22f9dfc528ab10e5d69504304c148..4125f0b11af43ef7947712c8858bb98e14203d3a 100644
--- a/chrome/test/media_router/media_router_integration_browsertest.cc
+++ b/chrome/test/media_router/media_router_integration_browsertest.cc
@@ -55,7 +55,8 @@ const char kCloseRouteScript[] =
const char kGetRouteLengthScript[] =
"domAutomationController.send(window.document.getElementById("
" 'media-router-container').routeList.length)";
-
+const char kClickDialog[] =
+ "window.document.getElementById('media-router-container').click();";
std::string GetStartedSessionId(content::WebContents* web_contents) {
std::string session_id;
CHECK(content::ExecuteScriptAndExtractString(
@@ -143,6 +144,12 @@ void MediaRouterIntegrationBrowserTest::ChooseSink(
ASSERT_TRUE(content::ExecuteScript(dialog_contents, script));
}
+void MediaRouterIntegrationBrowserTest::ClickDialog() {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ content::WebContents* dialog_contents = GetMRDialog(web_contents);
+ ASSERT_TRUE(content::ExecuteScript(dialog_contents, kClickDialog));
+}
content::WebContents* MediaRouterIntegrationBrowserTest::GetMRDialog(
content::WebContents* web_contents) {
MediaRouterDialogControllerImpl* controller =
@@ -152,6 +159,29 @@ content::WebContents* MediaRouterIntegrationBrowserTest::GetMRDialog(
return dialog_contents;
}
+bool MediaRouterIntegrationBrowserTest::IsDialogClosed(
+ content::WebContents* web_contents) {
+ MediaRouterDialogControllerImpl* controller =
+ MediaRouterDialogControllerImpl::GetOrCreateForWebContents(web_contents);
+ return !controller->GetMediaRouterDialog();
+}
+
+void MediaRouterIntegrationBrowserTest::CheckDialogIsClosed(
imcheng 2015/10/22 18:44:14 naming suggestion: WaitUntilDialogClosed
apacible 2015/10/23 18:03:11 Done.
+ content::WebContents* web_contents) {
+ ASSERT_TRUE(ConditionalWait(
+ base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(1),
+ base::Bind(&MediaRouterIntegrationBrowserTest::IsDialogClosed,
+ base::Unretained(this), web_contents)));
+}
+
+void MediaRouterIntegrationBrowserTest::CheckDialogIsOpen(
imcheng 2015/10/22 18:44:14 CheckDialogRemainsOpen
apacible 2015/10/23 18:03:11 Done.
+ content::WebContents* web_contents) {
+ ASSERT_FALSE(ConditionalWait(
+ base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(1),
+ base::Bind(&MediaRouterIntegrationBrowserTest::IsDialogClosed,
+ base::Unretained(this), web_contents)));
+}
+
void MediaRouterIntegrationBrowserTest::SetTestData(
base::FilePath::StringPieceType test_data_file) {
base::FilePath full_path = GetResourceFile(test_data_file);

Powered by Google App Engine
This is Rietveld 408576698