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 package org.chromium.chrome.browser.media.ui; | 5 package org.chromium.chrome.browser.media.ui; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.media.AudioManager; | 8 import android.media.AudioManager; |
9 import android.support.test.filters.SmallTest; | 9 import android.support.test.filters.SmallTest; |
10 | 10 |
11 import org.chromium.base.test.util.CommandLineFlags; | 11 import org.chromium.base.test.util.CommandLineFlags; |
12 import org.chromium.base.test.util.RetryOnFailure; | 12 import org.chromium.base.test.util.RetryOnFailure; |
13 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
14 import org.chromium.chrome.browser.ChromeActivity; | 14 import org.chromium.chrome.browser.ChromeActivity; |
15 import org.chromium.chrome.browser.tab.Tab; | 15 import org.chromium.chrome.browser.tab.Tab; |
16 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 16 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
17 import org.chromium.content.browser.test.util.Criteria; | 17 import org.chromium.content.browser.test.util.Criteria; |
18 import org.chromium.content.browser.test.util.CriteriaHelper; | 18 import org.chromium.content.browser.test.util.CriteriaHelper; |
19 import org.chromium.content.browser.test.util.DOMUtils; | 19 import org.chromium.content.browser.test.util.DOMUtils; |
20 import org.chromium.media.MediaSwitches; | 20 import org.chromium.content.common.ContentSwitches; |
21 import org.chromium.net.test.EmbeddedTestServer; | 21 import org.chromium.net.test.EmbeddedTestServer; |
22 | 22 |
23 import java.util.concurrent.TimeoutException; | 23 import java.util.concurrent.TimeoutException; |
24 | 24 |
25 /** | 25 /** |
26 * Tests for checking whether the media are paused when unplugging the headset | 26 * Tests for checking whether the media are paused when unplugging the headset |
27 */ | 27 */ |
28 @CommandLineFlags.Add(MediaSwitches.IGNORE_AUTOPLAY_RESTRICTIONS_FOR_TESTS) | 28 @CommandLineFlags.Add(ContentSwitches.DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PLAY
BACK) |
29 public class PauseOnHeadsetUnplugTest extends ChromeActivityTestCaseBase<ChromeA
ctivity> { | 29 public class PauseOnHeadsetUnplugTest extends ChromeActivityTestCaseBase<ChromeA
ctivity> { |
30 private static final String TEST_PATH = | 30 private static final String TEST_PATH = |
31 "/content/test/data/media/session/media-session.html"; | 31 "/content/test/data/media/session/media-session.html"; |
32 private static final String VIDEO_ID = "long-video"; | 32 private static final String VIDEO_ID = "long-video"; |
33 | 33 |
34 private EmbeddedTestServer mTestServer; | 34 private EmbeddedTestServer mTestServer; |
35 | 35 |
36 public PauseOnHeadsetUnplugTest() { | 36 public PauseOnHeadsetUnplugTest() { |
37 super(ChromeActivity.class); | 37 super(ChromeActivity.class); |
38 } | 38 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 private void simulateHeadsetUnplug() { | 82 private void simulateHeadsetUnplug() { |
83 Intent i = new Intent(getInstrumentation().getTargetContext(), | 83 Intent i = new Intent(getInstrumentation().getTargetContext(), |
84 MediaNotificationManager.PlaybackListenerService.c
lass); | 84 MediaNotificationManager.PlaybackListenerService.c
lass); |
85 i.setAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); | 85 i.setAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); |
86 | 86 |
87 getInstrumentation().getContext().startService(i); | 87 getInstrumentation().getContext().startService(i); |
88 } | 88 } |
89 } | 89 } |
OLD | NEW |