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.video; | 5 package org.chromium.chrome.browser.video; |
6 | 6 |
7 import android.os.Environment; | 7 import android.os.Environment; |
8 import android.test.FlakyTest; | |
9 import android.view.KeyEvent; | 8 import android.view.KeyEvent; |
10 | 9 |
11 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
| 11 import org.chromium.base.test.util.FlakyTest; |
12 import org.chromium.chrome.browser.ChromeActivity; | 12 import org.chromium.chrome.browser.ChromeActivity; |
13 import org.chromium.chrome.browser.tab.EmptyTabObserver; | 13 import org.chromium.chrome.browser.tab.EmptyTabObserver; |
14 import org.chromium.chrome.browser.tab.Tab; | 14 import org.chromium.chrome.browser.tab.Tab; |
15 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 15 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
16 import org.chromium.content.browser.test.util.Criteria; | 16 import org.chromium.content.browser.test.util.Criteria; |
17 import org.chromium.content.browser.test.util.CriteriaHelper; | 17 import org.chromium.content.browser.test.util.CriteriaHelper; |
18 import org.chromium.content.browser.test.util.TestTouchUtils; | 18 import org.chromium.content.browser.test.util.TestTouchUtils; |
19 import org.chromium.net.test.EmbeddedTestServer; | 19 import org.chromium.net.test.EmbeddedTestServer; |
20 | 20 |
21 /** | 21 /** |
(...skipping 17 matching lines...) Expand all Loading... |
39 @Override | 39 @Override |
40 public void startMainActivity() throws InterruptedException { | 40 public void startMainActivity() throws InterruptedException { |
41 startMainActivityOnBlankPage(); | 41 startMainActivityOnBlankPage(); |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
45 * Test that when playing a fullscreen video, hitting the back button will l
et the tab | 45 * Test that when playing a fullscreen video, hitting the back button will l
et the tab |
46 * exit fullscreen mode without changing its URL. | 46 * exit fullscreen mode without changing its URL. |
47 * | 47 * |
48 * @MediumTest | 48 * @MediumTest |
49 * crbug.com/458368. | |
50 */ | 49 */ |
51 @FlakyTest | 50 @FlakyTest(message = "crbug.com/458368") |
52 public void testExitFullscreenNotifiesTabObservers() throws InterruptedExcep
tion { | 51 public void testExitFullscreenNotifiesTabObservers() throws InterruptedExcep
tion { |
53 EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartFileSer
ver( | 52 EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartFileSer
ver( |
54 getInstrumentation().getContext(), Environment.getExternalStorag
eDirectory()); | 53 getInstrumentation().getContext(), Environment.getExternalStorag
eDirectory()); |
55 try { | 54 try { |
56 String url = testServer.getURL( | 55 String url = testServer.getURL( |
57 "/chrome/test/data/android/media/video-fullscreen.html"); | 56 "/chrome/test/data/android/media/video-fullscreen.html"); |
58 loadUrl(url); | 57 loadUrl(url); |
59 Tab tab = getActivity().getActivityTab(); | 58 Tab tab = getActivity().getActivityTab(); |
60 FullscreenTabObserver observer = new FullscreenTabObserver(); | 59 FullscreenTabObserver observer = new FullscreenTabObserver(); |
61 tab.addObserver(observer); | 60 tab.addObserver(observer); |
(...skipping 30 matching lines...) Expand all Loading... |
92 | 91 |
93 void waitForTabToExitFullscreen() throws InterruptedException { | 92 void waitForTabToExitFullscreen() throws InterruptedException { |
94 CriteriaHelper.pollInstrumentationThread(new Criteria() { | 93 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
95 @Override | 94 @Override |
96 public boolean isSatisfied() { | 95 public boolean isSatisfied() { |
97 return !mIsTabFullscreen; | 96 return !mIsTabFullscreen; |
98 } | 97 } |
99 }, TEST_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL); | 98 }, TEST_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL); |
100 } | 99 } |
101 } | 100 } |
OLD | NEW |