Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 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 ClickDialog(); | |
|
imcheng
2015/10/22 18:44:14
Add some comments explaining what this is doing, e
apacible
2015/10/23 18:03:11
Done.
| |
| 37 CheckDialogIsOpen(web_contents); | |
| 36 | 38 |
| 37 // Verify the route details page. | 39 // Verify the route details page. |
| 38 std::string route_info_script = base::StringPrintf( | 40 std::string route_info_script = base::StringPrintf( |
| 39 "domAutomationController.send(" | 41 "domAutomationController.send(" |
| 40 "window.document.getElementById('media-router-container').shadowRoot." | 42 "window.document.getElementById('media-router-container').shadowRoot." |
| 41 "getElementById('route-details').shadowRoot.getElementById(" | 43 "getElementById('route-details').shadowRoot.getElementById(" |
| 42 "'route-information').getElementsByTagName('span')[0].innerText)"); | 44 "'route-information').getElementsByTagName('span')[0].innerText)"); |
| 43 std::string route_information = ExecuteScriptAndExtractString( | 45 std::string route_information = ExecuteScriptAndExtractString( |
| 44 dialog_contents, route_info_script); | 46 dialog_contents, route_info_script); |
| 45 ASSERT_EQ("Casting: Test Route", route_information); | 47 ASSERT_EQ("Casting: Test Route", route_information); |
| 46 | 48 |
| 47 std::string sink_name_script = base::StringPrintf( | 49 std::string sink_name_script = base::StringPrintf( |
| 48 "domAutomationController.send(" | 50 "domAutomationController.send(" |
| 49 "window.document.getElementById('media-router-container').shadowRoot." | 51 "window.document.getElementById('media-router-container').shadowRoot." |
| 50 "getElementById('route-details').shadowRoot.getElementById(" | 52 "getElementById('route-details').shadowRoot.getElementById(" |
| 51 "'route-details-header').shadowRoot.getElementById('header-text')." | 53 "'route-details-header').shadowRoot.getElementById('header-text')." |
| 52 "innerText)"); | 54 "innerText)"); |
| 53 std::string sink_name = ExecuteScriptAndExtractString( | 55 std::string sink_name = ExecuteScriptAndExtractString( |
| 54 dialog_contents, sink_name_script); | 56 dialog_contents, sink_name_script); |
| 55 ASSERT_EQ(kTestSinkName, sink_name); | 57 ASSERT_EQ(kTestSinkName, sink_name); |
| 56 | 58 |
| 57 // Close route. | 59 // Close route. |
| 58 CloseRouteOnUI(); | 60 CloseRouteOnUI(); |
| 61 CheckDialogIsClosed(web_contents); | |
|
imcheng
2015/10/22 18:44:14
Same here.
apacible
2015/10/23 18:03:11
Done.
| |
| 59 } | 62 } |
| 60 | 63 |
| 61 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, | 64 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, |
| 62 MANUAL_Dialog_RouteCreationTimedOut) { | 65 MANUAL_Dialog_RouteCreationTimedOut) { |
| 63 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); | 66 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); |
| 64 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); | 67 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); |
| 65 content::WebContents* web_contents = | 68 content::WebContents* web_contents = |
| 66 browser()->tab_strip_model()->GetActiveWebContents(); | 69 browser()->tab_strip_model()->GetActiveWebContents(); |
| 67 content::WebContents* dialog_contents = OpenMRDialog(web_contents); | 70 content::WebContents* dialog_contents = OpenMRDialog(web_contents); |
| 68 | 71 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 88 std::string issue_title = GetIssueTitle(); | 91 std::string issue_title = GetIssueTitle(); |
| 89 ASSERT_EQ(l10n_util::GetStringUTF8( | 92 ASSERT_EQ(l10n_util::GetStringUTF8( |
| 90 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), | 93 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), |
| 91 issue_title); | 94 issue_title); |
| 92 | 95 |
| 93 // Route will still get created, it just takes longer than usual. | 96 // Route will still get created, it just takes longer than usual. |
| 94 WaitUntilRouteCreated(); | 97 WaitUntilRouteCreated(); |
| 95 } | 98 } |
| 96 | 99 |
| 97 } // namespace media_router | 100 } // namespace media_router |
| OLD | NEW |