| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.media.AudioManager; | 8 import android.media.AudioManager; |
| 9 import android.test.suitebuilder.annotation.MediumTest; | 9 import android.test.suitebuilder.annotation.MediumTest; |
| 10 import android.test.suitebuilder.annotation.SmallTest; | 10 import android.test.suitebuilder.annotation.SmallTest; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 mAudioFocusState = focusType; | 61 mAudioFocusState = focusType; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 public void abandonAudioFocus() { | 65 public void abandonAudioFocus() { |
| 66 getAudioManager().abandonAudioFocus(this); | 66 getAudioManager().abandonAudioFocus(this); |
| 67 mAudioFocusState = AudioManager.AUDIOFOCUS_LOSS; | 67 mAudioFocusState = AudioManager.AUDIOFOCUS_LOSS; |
| 68 } | 68 } |
| 69 | 69 |
| 70 public void waitForFocusStateChange(int focusType) throws InterruptedExc
eption { | 70 public void waitForFocusStateChange(int focusType) throws InterruptedExc
eption { |
| 71 CriteriaHelper.pollForCriteria(Criteria.equals(focusType, new Callab
le<Integer>() { | 71 CriteriaHelper.pollInstrumentationThread( |
| 72 @Override | 72 Criteria.equals(focusType, new Callable<Integer>() { |
| 73 public Integer call() { | 73 @Override |
| 74 return getAudioFocusState(); | 74 public Integer call() { |
| 75 } | 75 return getAudioFocusState(); |
| 76 })); | 76 } |
| 77 })); |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 | 80 |
| 80 private MockAudioFocusChangeListener mAudioFocusChangeListener; | 81 private MockAudioFocusChangeListener mAudioFocusChangeListener; |
| 81 | 82 |
| 82 @Override | 83 @Override |
| 83 public void setUp() throws Exception { | 84 public void setUp() throws Exception { |
| 84 super.setUp(); | 85 super.setUp(); |
| 85 | 86 |
| 86 try { | 87 try { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 366 |
| 366 DOMUtils.waitForMediaPauseBeforeEnd(getWebContents(), LONG_AUDIO); | 367 DOMUtils.waitForMediaPauseBeforeEnd(getWebContents(), LONG_AUDIO); |
| 367 DOMUtils.waitForMediaPauseBeforeEnd(getWebContents(), LONG_VIDEO); | 368 DOMUtils.waitForMediaPauseBeforeEnd(getWebContents(), LONG_VIDEO); |
| 368 | 369 |
| 369 mAudioFocusChangeListener.abandonAudioFocus(); | 370 mAudioFocusChangeListener.abandonAudioFocus(); |
| 370 | 371 |
| 371 DOMUtils.waitForMediaPlay(getWebContents(), LONG_AUDIO); | 372 DOMUtils.waitForMediaPlay(getWebContents(), LONG_AUDIO); |
| 372 DOMUtils.waitForMediaPlay(getWebContents(), LONG_VIDEO); | 373 DOMUtils.waitForMediaPlay(getWebContents(), LONG_VIDEO); |
| 373 } | 374 } |
| 374 } | 375 } |
| OLD | NEW |