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_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 content::WebContents* web_contents = | |
| 15 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 16 | |
| 17 content::WebContents* dialog_contents = OpenMRDialog(web_contents); | |
| 18 ASSERT_TRUE(dialog_contents); | |
| 19 // Wait for 2s to make sure the dialog finishes rendering. | |
|
imcheng
2017/01/24 20:03:31
nit: blank line before comments here and below.
cliffordcheng1
2017/01/24 23:13:18
Done.
| |
| 20 Wait(base::TimeDelta::FromSeconds(2)); | |
|
imcheng
2017/01/24 20:03:31
Can you use WaitUntilDialogFullyLoaded() here and
cliffordcheng1
2017/01/24 23:13:18
Done.
| |
| 21 WaitUntilSinkDiscoveredOnUI(); | |
| 22 ChooseSink(web_contents, receiver()); | |
| 23 // Mirror tab for 10s. | |
| 24 Wait(base::TimeDelta::FromSeconds(10)); | |
| 25 | |
| 26 OpenMRDialog(web_contents); | |
| 27 // Wait for 2s to make sure the dialog finishes rendering. | |
| 28 Wait(base::TimeDelta::FromSeconds(2)); | |
| 29 // Check the mirroring session has started successfully. | |
| 30 ASSERT_TRUE(!GetRouteId(receiver()).empty()); | |
| 31 | |
| 14 OpenMediaPage(); | 32 OpenMediaPage(); |
| 15 content::WebContents* web_contents = | |
| 16 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 17 | |
| 18 // Play the video on loop. | 33 // Play the video on loop. |
| 19 std::string script = "document.getElementsByTagName('video')[0].loop=true;"; | 34 std::string script = "document.getElementsByTagName('video')[0].loop=true;"; |
| 20 ExecuteScript(web_contents, script); | 35 ExecuteScript(web_contents, script); |
| 21 // Wait for 5s to the video is playing smoothly. | 36 // Wait for 5s to the video is playing smoothly. |
| 22 Wait(base::TimeDelta::FromSeconds(5)); | 37 Wait(base::TimeDelta::FromSeconds(5)); |
| 23 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); | |
| 27 WaitUntilSinkDiscoveredOnUI(); | |
| 28 ChooseSink(web_contents, receiver()); | |
| 29 WaitUntilRouteCreated(); | |
| 30 | |
| 31 // Mirror tab for 10s. | |
| 32 Wait(base::TimeDelta::FromSeconds(10)); | |
| 33 | |
| 34 // Go to full screen. | 38 // Go to full screen. |
| 35 script = "document.getElementsByTagName('video')[0]." | 39 script = "document.getElementsByTagName('video')[0]." |
| 36 "webkitRequestFullScreen();"; | 40 "webkitRequestFullScreen();"; |
| 37 ExecuteScript(web_contents, script); | 41 ExecuteScript(web_contents, script); |
| 38 // Wait for 5s to the video is playing smoothly in full screen. | 42 // Wait for 5s to the video is playing smoothly in full screen. |
| 39 Wait(base::TimeDelta::FromSeconds(5)); | 43 Wait(base::TimeDelta::FromSeconds(5)); |
| 44 | |
| 40 OpenMRDialog(web_contents); | 45 OpenMRDialog(web_contents); |
| 41 // Wait for 5s to make sure the dialog finishes rendering. | 46 // Wait for 2s to make sure the dialog finishes rendering. |
| 42 Wait(base::TimeDelta::FromSeconds(5)); | 47 Wait(base::TimeDelta::FromSeconds(2)); |
| 43 | |
| 44 // Check the mirroring session is still live. | 48 // Check the mirroring session is still live. |
| 45 ASSERT_TRUE(!GetRouteId(receiver()).empty()); | 49 ASSERT_TRUE(!GetRouteId(receiver()).empty()); |
| 46 Wait(base::TimeDelta::FromSeconds(20)); | 50 Wait(base::TimeDelta::FromSeconds(20)); |
| 47 CloseRouteOnUI(); | 51 CloseRouteOnUI(); |
| 48 } | 52 } |
| 49 | 53 |
| 50 } // namespace media_router | 54 } // namespace media_router |
| OLD | NEW |