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
3 // found in the LICENSE file.
5 #include "chrome/test/media_router/media_router_integration_browsertest.h"
7 #include "base/files/file_util.h"
8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "content/public/test/browser_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
14 namespace media_router
{
16 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest
, MANUAL_Dialog_Basic
) {
17 OpenTestPage(FILE_PATH_LITERAL("basic_test.html"));
18 content::WebContents
* web_contents
=
19 browser()->tab_strip_model()->GetActiveWebContents();
20 content::WebContents
* dialog_contents
= OpenMRDialog(web_contents
);
22 // Verify the sink list.
24 script
= base::StringPrintf(
25 "domAutomationController.send(window.document.getElementById("
26 "'media-router-container').sinkList.length)");
27 ASSERT_EQ(2, ExecuteScriptAndExtractInt(dialog_contents
, script
));
29 ChooseSink(web_contents
, "id1", "");
30 WaitUntilRouteCreated();
32 // Verify the new route.
33 script
= base::StringPrintf(
34 "domAutomationController.send(window.document.getElementById("
35 "'media-router-container').routeList[0].description)");
36 std::string route_description
= ExecuteScriptAndExtractString(
37 dialog_contents
, script
);
38 ASSERT_EQ("Test Route", route_description
);
40 script
= base::StringPrintf(
41 "domAutomationController.send(window.document.getElementById("
42 "'media-router-container').routeList[0].id)");
43 std::string route_id
= ExecuteScriptAndExtractString(dialog_contents
, script
);
44 std::string current_route
= base::StringPrintf(
45 "{'id': '%s', 'sinkId': '%s', 'description': '%s', 'isLocal': '%s'}",
46 route_id
.c_str(), "id1", route_description
.c_str(), "false");
48 ChooseSink(web_contents
, "id1", current_route
);
49 // TODO(leilei): Verify the router details dialog, including the title and
50 // the text, also close the route.
53 } // namespace media_router