OLD | NEW |
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 "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Verify the sink list. | 27 // Verify the sink list. |
28 std::string sink_length_script = base::StringPrintf( | 28 std::string sink_length_script = base::StringPrintf( |
29 "domAutomationController.send(" | 29 "domAutomationController.send(" |
30 "window.document.getElementById('media-router-container')." | 30 "window.document.getElementById('media-router-container')." |
31 "sinksToShow_.length)"); | 31 "sinksToShow_.length)"); |
32 ASSERT_EQ(2, ExecuteScriptAndExtractInt(dialog_contents, sink_length_script)); | 32 ASSERT_EQ(2, ExecuteScriptAndExtractInt(dialog_contents, sink_length_script)); |
33 | 33 |
34 ChooseSink(web_contents, kTestSinkName); | 34 ChooseSink(web_contents, kTestSinkName); |
35 WaitUntilRouteCreated(); | 35 WaitUntilRouteCreated(); |
36 | 36 |
| 37 // Simulate a click on the dialog to prevent it from automatically closing |
| 38 // after the route has been created. Then, check that the dialog remains |
| 39 // open. |
| 40 ClickDialog(); |
| 41 CheckDialogRemainsOpen(web_contents); |
| 42 |
37 // Verify the route details page. | 43 // Verify the route details page. |
38 std::string route_info_script = base::StringPrintf( | 44 std::string route_info_script = base::StringPrintf( |
39 "domAutomationController.send(" | 45 "domAutomationController.send(" |
40 "window.document.getElementById('media-router-container').shadowRoot." | 46 "window.document.getElementById('media-router-container').shadowRoot." |
41 "getElementById('route-details').shadowRoot.getElementById(" | 47 "getElementById('route-details').shadowRoot.getElementById(" |
42 "'route-information').getElementsByTagName('span')[0].innerText)"); | 48 "'route-information').getElementsByTagName('span')[0].innerText)"); |
43 std::string route_information = ExecuteScriptAndExtractString( | 49 std::string route_information = ExecuteScriptAndExtractString( |
44 dialog_contents, route_info_script); | 50 dialog_contents, route_info_script); |
45 ASSERT_EQ("Casting: Test Route", route_information); | 51 ASSERT_EQ("Casting: Test Route", route_information); |
46 | 52 |
47 std::string sink_name_script = base::StringPrintf( | 53 std::string sink_name_script = base::StringPrintf( |
48 "domAutomationController.send(" | 54 "domAutomationController.send(" |
49 "window.document.getElementById('media-router-container').shadowRoot." | 55 "window.document.getElementById('media-router-container').shadowRoot." |
50 "getElementById('route-details').shadowRoot.getElementById(" | 56 "getElementById('route-details').shadowRoot.getElementById(" |
51 "'route-details-header').shadowRoot.getElementById('header-text')." | 57 "'route-details-header').shadowRoot.getElementById('header-text')." |
52 "innerText)"); | 58 "innerText)"); |
53 std::string sink_name = ExecuteScriptAndExtractString( | 59 std::string sink_name = ExecuteScriptAndExtractString( |
54 dialog_contents, sink_name_script); | 60 dialog_contents, sink_name_script); |
55 ASSERT_EQ(kTestSinkName, sink_name); | 61 ASSERT_EQ(kTestSinkName, sink_name); |
56 | 62 |
57 // Close route. | 63 // Close route. |
58 CloseRouteOnUI(); | 64 CloseRouteOnUI(); |
| 65 |
| 66 // Do not simulate a click on the dialog. Confirm that the dialog closes |
| 67 // automatically after the route is closed. |
| 68 WaitUntilDialogClosed(web_contents); |
59 } | 69 } |
60 | 70 |
61 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, | 71 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, |
62 MANUAL_Dialog_RouteCreationTimedOut) { | 72 MANUAL_Dialog_RouteCreationTimedOut) { |
63 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); | 73 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); |
64 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); | 74 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); |
65 content::WebContents* web_contents = | 75 content::WebContents* web_contents = |
66 browser()->tab_strip_model()->GetActiveWebContents(); | 76 browser()->tab_strip_model()->GetActiveWebContents(); |
67 content::WebContents* dialog_contents = OpenMRDialog(web_contents); | 77 content::WebContents* dialog_contents = OpenMRDialog(web_contents); |
68 | 78 |
(...skipping 19 matching lines...) Expand all Loading... |
88 std::string issue_title = GetIssueTitle(); | 98 std::string issue_title = GetIssueTitle(); |
89 ASSERT_EQ(l10n_util::GetStringUTF8( | 99 ASSERT_EQ(l10n_util::GetStringUTF8( |
90 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), | 100 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), |
91 issue_title); | 101 issue_title); |
92 | 102 |
93 // Route will still get created, it just takes longer than usual. | 103 // Route will still get created, it just takes longer than usual. |
94 WaitUntilRouteCreated(); | 104 WaitUntilRouteCreated(); |
95 } | 105 } |
96 | 106 |
97 } // namespace media_router | 107 } // namespace media_router |
OLD | NEW |