OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser; |
| 6 |
| 7 import android.test.FlakyTest; |
| 8 |
| 9 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 10 import org.chromium.chrome.test.util.TestHttpServerClient; |
| 11 import org.chromium.chrome.test.util.browser.TabTitleObserver; |
| 12 import org.chromium.content.browser.test.util.DOMUtils; |
| 13 |
| 14 import java.util.concurrent.TimeoutException; |
| 15 |
| 16 /** |
| 17 * Simple HTML5 audio tests. |
| 18 */ |
| 19 public class AudioTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
| 20 |
| 21 public AudioTest() { |
| 22 super(ChromeActivity.class); |
| 23 } |
| 24 |
| 25 /** |
| 26 * Test playing a small mp3 audio file. |
| 27 * http://crbug.com/331122 |
| 28 * @Feature({"Media", "Media-Audio", "Main"}) |
| 29 * @MediumTest |
| 30 */ |
| 31 @FlakyTest |
| 32 public void testPlayMp3() throws InterruptedException, TimeoutException { |
| 33 Tab tab = getActivity().getActivityTab(); |
| 34 TabTitleObserver titleObserver = new TabTitleObserver(tab, "ready_to_pla
y"); |
| 35 loadUrl(TestHttpServerClient.getUrl("chrome/test/data/android/media/mp3-
play.html")); |
| 36 titleObserver.waitForTitleUpdate(5); |
| 37 assertEquals("ready_to_play", tab.getTitle()); |
| 38 |
| 39 titleObserver = new TabTitleObserver(tab, "ended"); |
| 40 DOMUtils.clickNode(this, tab.getContentViewCore(), "button1"); |
| 41 |
| 42 // Make sure that the audio playback "ended" and title is changed. |
| 43 titleObserver.waitForTitleUpdate(15); |
| 44 assertEquals("ended", tab.getTitle()); |
| 45 } |
| 46 |
| 47 @Override |
| 48 public void startMainActivity() throws InterruptedException { |
| 49 startMainActivityOnBlankPage(); |
| 50 } |
| 51 } |
OLD | NEW |