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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 | 74 |
75 std::string sink_name_script = base::StringPrintf( | 75 std::string sink_name_script = base::StringPrintf( |
76 "domAutomationController.send(" | 76 "domAutomationController.send(" |
77 "window.document.getElementById('media-router-container').shadowRoot." | 77 "window.document.getElementById('media-router-container').shadowRoot." |
78 "getElementById('container-header').shadowRoot.getElementById(" | 78 "getElementById('container-header').shadowRoot.getElementById(" |
79 "'header-text').innerText)"); | 79 "'header-text').innerText)"); |
80 std::string sink_name = ExecuteScriptAndExtractString( | 80 std::string sink_name = ExecuteScriptAndExtractString( |
81 dialog_contents, sink_name_script); | 81 dialog_contents, sink_name_script); |
82 ASSERT_EQ(kTestSinkName, sink_name); | 82 ASSERT_EQ(kTestSinkName, sink_name); |
83 | 83 |
84 #if defined(OS_MACOSX) || defined(OS_WIN) | |
84 // Simulate moving the mouse off the dialog. Confirm that the dialog closes | 85 // Simulate moving the mouse off the dialog. Confirm that the dialog closes |
85 // automatically after the route is closed. | 86 // automatically after the route is closed. |
86 // In tests, it sometimes takes too long to CloseRouteOnUI() to finish so | 87 // In tests, it sometimes takes too long to CloseRouteOnUI() to finish so |
87 // the timer started when the route is initially closed times out before the | 88 // the timer started when the route is initially closed times out before the |
88 // mouseleave event is dispatched. In that case, the dialog remains open. | 89 // mouseleave event is dispatched. In that case, the dialog remains open. |
89 std::string mouse_leave_script = base::StringPrintf( | 90 std::string mouse_leave_script = base::StringPrintf( |
90 "domAutomationController.send(" | 91 "domAutomationController.send(" |
91 "window.document.getElementById('media-router-container').dispatchEvent(" | 92 "window.document.getElementById('media-router-container').dispatchEvent(" |
92 "new Event('mouseleave')))"); | 93 "new Event('mouseleave')))"); |
93 ASSERT_TRUE(content::ExecuteScript(dialog_contents, mouse_leave_script)); | 94 ASSERT_TRUE(content::ExecuteScript(dialog_contents, mouse_leave_script)); |
95 #endif | |
94 CloseRouteOnUI(); | 96 CloseRouteOnUI(); |
97 #if defined(OS_MACOSX) || defined(OS_WIN) | |
95 WaitUntilDialogClosed(web_contents); | 98 WaitUntilDialogClosed(web_contents); |
Lei Lei
2016/01/21 19:07:55
I think we should keep this for Linux, because the
apacible
2016/01/21 19:10:02
I removed this for Linux since it appears mouseent
| |
99 #endif | |
96 } | 100 } |
97 | 101 |
98 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, | 102 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, |
99 MANUAL_Dialog_RouteCreationTimedOut) { | 103 MANUAL_Dialog_RouteCreationTimedOut) { |
100 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); | 104 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); |
101 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); | 105 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); |
102 content::WebContents* web_contents = | 106 content::WebContents* web_contents = |
103 browser()->tab_strip_model()->GetActiveWebContents(); | 107 browser()->tab_strip_model()->GetActiveWebContents(); |
104 content::WebContents* dialog_contents = OpenMRDialog(web_contents); | 108 content::WebContents* dialog_contents = OpenMRDialog(web_contents); |
105 | 109 |
(...skipping 19 matching lines...) Expand all Loading... | |
125 std::string issue_title = GetIssueTitle(); | 129 std::string issue_title = GetIssueTitle(); |
126 ASSERT_EQ(l10n_util::GetStringUTF8( | 130 ASSERT_EQ(l10n_util::GetStringUTF8( |
127 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), | 131 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT_FOR_TAB), |
128 issue_title); | 132 issue_title); |
129 | 133 |
130 // Route will still get created, it just takes longer than usual. | 134 // Route will still get created, it just takes longer than usual. |
131 WaitUntilRouteCreated(); | 135 WaitUntilRouteCreated(); |
132 } | 136 } |
133 | 137 |
134 } // namespace media_router | 138 } // namespace media_router |
OLD | NEW |