| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.pm.ActivityInfo; | 7 import android.content.pm.ActivityInfo; |
| 8 import android.support.test.filters.MediumTest; | 8 import android.support.test.filters.MediumTest; |
| 9 | 9 |
| 10 import org.junit.After; | 10 import org.junit.After; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); | 86 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); |
| 87 } | 87 } |
| 88 }); | 88 }); |
| 89 } | 89 } |
| 90 | 90 |
| 91 @Test | 91 @Test |
| 92 @MediumTest | 92 @MediumTest |
| 93 @Feature({"VideoRotateToFullscreen"}) | 93 @Feature({"VideoRotateToFullscreen"}) |
| 94 public void testPortraitToLandscapeAndBack() throws Exception { | 94 public void testPortraitToLandscapeAndBack() throws Exception { |
| 95 // TODO(johnme): Use RESTRICTION_TYPE_PHONE once crbug.com/673917 moves
it out of chrome/. | 95 // TODO(johnme): Use RESTRICTION_TYPE_PHONE once crbug.com/673917 moves
it out of chrome/. |
| 96 if (DeviceFormFactor.isTablet(mRule.getActivity())) { | 96 if (DeviceFormFactor.isTablet()) { |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Start off in portrait screen orientation. | 100 // Start off in portrait screen orientation. |
| 101 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_PORTRAIT); | 101 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_PORTRAIT); |
| 102 waitForScreenOrientation("\"portrait\""); | 102 waitForScreenOrientation("\"portrait\""); |
| 103 | 103 |
| 104 // Start playback. | 104 // Start playback. |
| 105 Assert.assertTrue(DOMUtils.isMediaPaused(mRule.getWebContents(), VIDEO_I
D)); | 105 Assert.assertTrue(DOMUtils.isMediaPaused(mRule.getWebContents(), VIDEO_I
D)); |
| 106 DOMUtils.playMedia(mRule.getWebContents(), VIDEO_ID); | 106 DOMUtils.playMedia(mRule.getWebContents(), VIDEO_ID); |
| 107 DOMUtils.waitForMediaPlay(mRule.getWebContents(), VIDEO_ID); | 107 DOMUtils.waitForMediaPlay(mRule.getWebContents(), VIDEO_ID); |
| 108 | 108 |
| 109 // Rotate screen from portrait to landscape. | 109 // Rotate screen from portrait to landscape. |
| 110 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_LANDSCAPE); | 110 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_LANDSCAPE); |
| 111 waitForScreenOrientation("\"landscape\""); | 111 waitForScreenOrientation("\"landscape\""); |
| 112 | 112 |
| 113 // Should enter fullscreen. | 113 // Should enter fullscreen. |
| 114 waitForContentsFullscreenState(true); | 114 waitForContentsFullscreenState(true); |
| 115 | 115 |
| 116 // Rotate screen from landscape to portrait(?). | 116 // Rotate screen from landscape to portrait(?). |
| 117 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_PORTRAIT); | 117 mRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTAT
ION_PORTRAIT); |
| 118 waitForScreenOrientation("\"portrait\""); | 118 waitForScreenOrientation("\"portrait\""); |
| 119 | 119 |
| 120 // Should exit fullscreen. | 120 // Should exit fullscreen. |
| 121 waitForContentsFullscreenState(false); | 121 waitForContentsFullscreenState(false); |
| 122 } | 122 } |
| 123 } | 123 } |
| OLD | NEW |