Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/VideoFullscreenOrientationLockTest.java

Issue 2573983002: Media: do not lock the screen orientation when a video goes fullscreen on a tablet. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.graphics.Rect; 7 import android.graphics.Rect;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 9
10 import org.chromium.base.test.util.CommandLineFlags; 10 import org.chromium.base.test.util.CommandLineFlags;
11 import org.chromium.base.test.util.Feature; 11 import org.chromium.base.test.util.Feature;
12 import org.chromium.content.browser.test.util.Criteria; 12 import org.chromium.content.browser.test.util.Criteria;
13 import org.chromium.content.browser.test.util.CriteriaHelper; 13 import org.chromium.content.browser.test.util.CriteriaHelper;
14 import org.chromium.content.browser.test.util.DOMUtils; 14 import org.chromium.content.browser.test.util.DOMUtils;
15 import org.chromium.content.browser.test.util.JavaScriptUtils; 15 import org.chromium.content.browser.test.util.JavaScriptUtils;
16 import org.chromium.content.browser.test.util.UiUtils; 16 import org.chromium.content.browser.test.util.UiUtils;
17 import org.chromium.content.common.ContentSwitches; 17 import org.chromium.content.common.ContentSwitches;
18 import org.chromium.content_shell_apk.ContentShellTestBase; 18 import org.chromium.content_shell_apk.ContentShellTestBase;
19 import org.chromium.ui.base.DeviceFormFactor;
19 20
20 import java.util.concurrent.Callable; 21 import java.util.concurrent.Callable;
21 import java.util.concurrent.TimeoutException; 22 import java.util.concurrent.TimeoutException;
22 23
23 /** 24 /**
24 * Integration tests for the feature that auto lock the orientation when a video goes fullscreen. 25 * Integration tests for the feature that auto lock the orientation when a video goes fullscreen.
25 */ 26 */
26 @CommandLineFlags.Add({ "enable-features=VideoFullscreenOrientationLock", 27 @CommandLineFlags.Add({ "enable-features=VideoFullscreenOrientationLock",
27 ContentSwitches.DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PL AYBACK }) 28 ContentSwitches.DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PL AYBACK })
28 public class VideoFullscreenOrientationLockTest extends ContentShellTestBase { 29 public class VideoFullscreenOrientationLockTest extends ContentShellTestBase {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 @Override 98 @Override
98 public void setUp() throws Exception { 99 public void setUp() throws Exception {
99 super.setUp(); 100 super.setUp();
100 101
101 startActivityWithTestUrl(TEST_URL); 102 startActivityWithTestUrl(TEST_URL);
102 } 103 }
103 104
104 @MediumTest 105 @MediumTest
105 @Feature({"VideoFullscreenOrientationLock"}) 106 @Feature({"VideoFullscreenOrientationLock"})
106 public void testEnterExitFullscreenWithControlsButton() throws Exception { 107 public void testEnterExitFullscreenWithControlsButton() throws Exception {
108 if (DeviceFormFactor.isTablet(getInstrumentation().getContext())) return ;
109
107 // Start playback to guarantee it's properly loaded. 110 // Start playback to guarantee it's properly loaded.
108 assertTrue(DOMUtils.isMediaPaused(getWebContents(), VIDEO_ID)); 111 assertTrue(DOMUtils.isMediaPaused(getWebContents(), VIDEO_ID));
109 DOMUtils.playMedia(getWebContents(), VIDEO_ID); 112 DOMUtils.playMedia(getWebContents(), VIDEO_ID);
110 DOMUtils.waitForMediaPlay(getWebContents(), VIDEO_ID); 113 DOMUtils.waitForMediaPlay(getWebContents(), VIDEO_ID);
111 114
112 // Simulate click on fullscreen button. 115 // Simulate click on fullscreen button.
113 assertTrue(clickFullscreenButton()); 116 assertTrue(clickFullscreenButton());
114 waitForContentsFullscreenState(true); 117 waitForContentsFullscreenState(true);
115 118
116 // Should be landscape now, `waitForLandscapeOrientation` will throw oth erwise. 119 // Should be landscape now, `waitForLandscapeOrientation` will throw oth erwise.
117 waitForLandscapeOrientation(); 120 waitForLandscapeOrientation();
118 121
119 // Because of the fullscreen animation, the click on the exit fullscreen button will fail 122 // Because of the fullscreen animation, the click on the exit fullscreen button will fail
120 // roughly 10% of the time. Settling down the UI reduces the flake to 0% . 123 // roughly 10% of the time. Settling down the UI reduces the flake to 0% .
121 UiUtils.settleDownUI(getInstrumentation()); 124 UiUtils.settleDownUI(getInstrumentation());
122 125
123 // Leave fullscreen by clicking back on the button. 126 // Leave fullscreen by clicking back on the button.
124 assertTrue(clickFullscreenButton()); 127 assertTrue(clickFullscreenButton());
125 waitForContentsFullscreenState(false); 128 waitForContentsFullscreenState(false);
126 } 129 }
127 130
128 @MediumTest 131 @MediumTest
129 @Feature({"VideoFullscreenOrientationLock"}) 132 @Feature({"VideoFullscreenOrientationLock"})
130 public void testEnterExitFullscreenWithAPI() throws Exception { 133 public void testEnterExitFullscreenWithAPI() throws Exception {
134 if (DeviceFormFactor.isTablet(getInstrumentation().getContext())) return ;
135
131 // Start playback to guarantee it's properly loaded. 136 // Start playback to guarantee it's properly loaded.
132 assertTrue(DOMUtils.isMediaPaused(getWebContents(), VIDEO_ID)); 137 assertTrue(DOMUtils.isMediaPaused(getWebContents(), VIDEO_ID));
133 DOMUtils.playMedia(getWebContents(), VIDEO_ID); 138 DOMUtils.playMedia(getWebContents(), VIDEO_ID);
134 DOMUtils.waitForMediaPlay(getWebContents(), VIDEO_ID); 139 DOMUtils.waitForMediaPlay(getWebContents(), VIDEO_ID);
135 140
136 // Trigger requestFullscreen() via a click on a button. 141 // Trigger requestFullscreen() via a click on a button.
137 assertTrue(DOMUtils.clickNode(this, getContentViewCore(), "fullscreen")) ; 142 assertTrue(DOMUtils.clickNode(this, getContentViewCore(), "fullscreen")) ;
138 waitForContentsFullscreenState(true); 143 waitForContentsFullscreenState(true);
139 144
140 // Should be landscape now, `waitForLandscapeOrientation` will throw oth erwise. 145 // Should be landscape now, `waitForLandscapeOrientation` will throw oth erwise.
141 waitForLandscapeOrientation(); 146 waitForLandscapeOrientation();
142 147
143 // Leave fullscreen from API. 148 // Leave fullscreen from API.
144 DOMUtils.exitFullscreen(getWebContents()); 149 DOMUtils.exitFullscreen(getWebContents());
145 waitForContentsFullscreenState(false); 150 waitForContentsFullscreenState(false);
146 } 151 }
147 } 152 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698