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.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.content.pm.ActivityInfo; | 8 import android.content.pm.ActivityInfo; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.support.test.filters.MediumTest; | 10 import android.support.test.filters.MediumTest; |
11 import android.view.KeyEvent; | 11 import android.view.KeyEvent; |
12 | 12 |
13 import org.chromium.base.test.util.CommandLineFlags; | 13 import org.chromium.base.test.util.CommandLineFlags; |
14 import org.chromium.base.test.util.Feature; | 14 import org.chromium.base.test.util.Feature; |
15 import org.chromium.base.test.util.UrlUtils; | 15 import org.chromium.base.test.util.UrlUtils; |
16 import org.chromium.chrome.browser.download.DownloadUtils; | 16 import org.chromium.chrome.browser.download.DownloadUtils; |
17 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; | 17 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; |
18 import org.chromium.content.browser.test.util.Criteria; | 18 import org.chromium.content.browser.test.util.Criteria; |
19 import org.chromium.content.browser.test.util.CriteriaHelper; | 19 import org.chromium.content.browser.test.util.CriteriaHelper; |
20 import org.chromium.content.browser.test.util.DOMUtils; | 20 import org.chromium.content.browser.test.util.DOMUtils; |
21 import org.chromium.content.browser.test.util.JavaScriptUtils; | 21 import org.chromium.content.browser.test.util.JavaScriptUtils; |
| 22 import org.chromium.content.common.ContentSwitches; |
22 import org.chromium.content_public.browser.WebContents; | 23 import org.chromium.content_public.browser.WebContents; |
23 import org.chromium.media.MediaSwitches; | |
24 import org.chromium.ui.base.DeviceFormFactor; | 24 import org.chromium.ui.base.DeviceFormFactor; |
25 | 25 |
26 import java.util.concurrent.Callable; | 26 import java.util.concurrent.Callable; |
27 import java.util.concurrent.TimeoutException; | 27 import java.util.concurrent.TimeoutException; |
28 | 28 |
29 /** | 29 /** |
30 * Integration tests for the feature that auto locks the orientation when a vide
o goes fullscreen. | 30 * Integration tests for the feature that auto locks the orientation when a vide
o goes fullscreen. |
31 * See also content layer org.chromium.content.browser.VideoFullscreenOrientatio
nLockTest | 31 * See also content layer org.chromium.content.browser.VideoFullscreenOrientatio
nLockTest |
32 */ | 32 */ |
33 @CommandLineFlags.Add({"enable-features=VideoFullscreenOrientationLock", | 33 @CommandLineFlags.Add({"enable-features=VideoFullscreenOrientationLock", |
34 MediaSwitches.IGNORE_AUTOPLAY_RESTRICTIONS_FOR_TESTS}) | 34 ContentSwitches.DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PLAYBACK}) |
35 public class VideoFullscreenOrientationLockChromeTest extends ChromeTabbedActivi
tyTestBase { | 35 public class VideoFullscreenOrientationLockChromeTest extends ChromeTabbedActivi
tyTestBase { |
36 private static final String TEST_URL = "content/test/data/media/video-player
.html"; | 36 private static final String TEST_URL = "content/test/data/media/video-player
.html"; |
37 private static final String VIDEO_URL = "content/test/data/media/bear.webm"; | 37 private static final String VIDEO_URL = "content/test/data/media/bear.webm"; |
38 private static final String VIDEO_ID = "video"; | 38 private static final String VIDEO_ID = "video"; |
39 | 39 |
40 private WebContents getWebContents() { | 40 private WebContents getWebContents() { |
41 return getActivity().getCurrentContentViewCore().getWebContents(); | 41 return getActivity().getCurrentContentViewCore().getWebContents(); |
42 } | 42 } |
43 | 43 |
44 private void waitForContentsFullscreenState(boolean fullscreenValue) | 44 private void waitForContentsFullscreenState(boolean fullscreenValue) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DownloadUtils.getMediaViewerIntentForDownloadItem(fileUri, fileU
ri, mimeType); | 120 DownloadUtils.getMediaViewerIntentForDownloadItem(fileUri, fileU
ri, mimeType); |
121 IntentHandler.startActivityForTrustedIntent(intent); | 121 IntentHandler.startActivityForTrustedIntent(intent); |
122 waitUntilUnlocked(); | 122 waitUntilUnlocked(); |
123 | 123 |
124 // Sometimes the web page doesn't transition out of fullscreen until we
exit the download | 124 // Sometimes the web page doesn't transition out of fullscreen until we
exit the download |
125 // activity and return to the web page. | 125 // activity and return to the web page. |
126 sendKeys(KeyEvent.KEYCODE_BACK); | 126 sendKeys(KeyEvent.KEYCODE_BACK); |
127 waitForContentsFullscreenState(false); | 127 waitForContentsFullscreenState(false); |
128 } | 128 } |
129 } | 129 } |
OLD | NEW |