| 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_e2e_browsertest.h" | 5 #include "chrome/test/media_router/media_router_e2e_browsertest.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 8 #include "content/public/test/browser_test_utils.h" | 8 #include "content/public/test/browser_test_utils.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace media_router { | 11 namespace media_router { |
| 12 | 12 |
| 13 IN_PROC_BROWSER_TEST_F(MediaRouterE2EBrowserTest, MANUAL_MirrorHTML5Video) { | 13 IN_PROC_BROWSER_TEST_F(MediaRouterE2EBrowserTest, MANUAL_MirrorHTML5Video) { |
| 14 OpenMediaPage(); | |
| 15 content::WebContents* web_contents = | 14 content::WebContents* web_contents = |
| 16 browser()->tab_strip_model()->GetActiveWebContents(); | 15 browser()->tab_strip_model()->GetActiveWebContents(); |
| 17 | 16 |
| 18 // Play the video on loop. | |
| 19 std::string script = "document.getElementsByTagName('video')[0].loop=true;"; | |
| 20 ExecuteScript(web_contents, script); | |
| 21 // Wait for 5s to the video is playing smoothly. | |
| 22 Wait(base::TimeDelta::FromSeconds(5)); | |
| 23 content::WebContents* dialog_contents = OpenMRDialog(web_contents); | 17 content::WebContents* dialog_contents = OpenMRDialog(web_contents); |
| 24 // Wait for 10s to make sure the dialog finishes rendering. | |
| 25 Wait(base::TimeDelta::FromSeconds(10)); | |
| 26 ASSERT_TRUE(dialog_contents); | 18 ASSERT_TRUE(dialog_contents); |
| 19 |
| 20 // Wait util the dialog finishes rendering. |
| 21 WaitUntilDialogFullyLoaded(dialog_contents); |
| 27 WaitUntilSinkDiscoveredOnUI(); | 22 WaitUntilSinkDiscoveredOnUI(); |
| 28 ChooseSink(web_contents, receiver()); | 23 ChooseSink(web_contents, receiver()); |
| 29 WaitUntilRouteCreated(); | |
| 30 | 24 |
| 31 // Mirror tab for 10s. | 25 // Mirror tab for 10s. |
| 32 Wait(base::TimeDelta::FromSeconds(10)); | 26 Wait(base::TimeDelta::FromSeconds(10)); |
| 27 dialog_contents = OpenMRDialog(web_contents); |
| 28 WaitUntilDialogFullyLoaded(dialog_contents); |
| 33 | 29 |
| 34 // Go to full screen. | 30 // Check the mirroring session has started successfully. |
| 31 ASSERT_TRUE(!GetRouteId(receiver()).empty()); |
| 32 OpenMediaPage(); |
| 33 |
| 34 // Play the video on loop and wait 5s for it to play smoothly. |
| 35 std::string script = "document.getElementsByTagName('video')[0].loop=true;"; |
| 36 ExecuteScript(web_contents, script); |
| 37 Wait(base::TimeDelta::FromSeconds(5)); |
| 38 |
| 39 // Go to full screen and wait 5s for it to play smoothly. |
| 35 script = "document.getElementsByTagName('video')[0]." | 40 script = "document.getElementsByTagName('video')[0]." |
| 36 "webkitRequestFullScreen();"; | 41 "webkitRequestFullScreen();"; |
| 37 ExecuteScript(web_contents, script); | 42 ExecuteScript(web_contents, script); |
| 38 // Wait for 5s to the video is playing smoothly in full screen. | |
| 39 Wait(base::TimeDelta::FromSeconds(5)); | 43 Wait(base::TimeDelta::FromSeconds(5)); |
| 40 OpenMRDialog(web_contents); | 44 dialog_contents = OpenMRDialog(web_contents); |
| 41 // Wait for 5s to make sure the dialog finishes rendering. | 45 WaitUntilDialogFullyLoaded(dialog_contents); |
| 42 Wait(base::TimeDelta::FromSeconds(5)); | |
| 43 | 46 |
| 44 // Check the mirroring session is still live. | 47 // Check the mirroring session is still live. |
| 45 ASSERT_TRUE(!GetRouteId(receiver()).empty()); | 48 ASSERT_TRUE(!GetRouteId(receiver()).empty()); |
| 46 Wait(base::TimeDelta::FromSeconds(20)); | 49 Wait(base::TimeDelta::FromSeconds(20)); |
| 47 CloseRouteOnUI(); | 50 CloseRouteOnUI(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 } // namespace media_router | 53 } // namespace media_router |
| OLD | NEW |