| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 static org.junit.Assert.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
| 8 | 8 |
| 9 import org.junit.Test; | 9 import org.junit.Test; |
| 10 import org.junit.runner.RunWith; | 10 import org.junit.runner.RunWith; |
| 11 import org.robolectric.annotation.Config; | 11 import org.robolectric.annotation.Config; |
| 12 | 12 |
| 13 import org.chromium.base.test.util.Feature; | 13 import org.chromium.base.test.util.Feature; |
| 14 import org.chromium.blink.mojom.MediaSessionAction; | 14 import org.chromium.blink.mojom.MediaSessionAction; |
| 15 import org.chromium.testing.local.LocalRobolectricTestRunner; | 15 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 16 | 16 |
| 17 import java.util.ArrayList; | 17 import java.util.ArrayList; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Robolectric tests for compact view button computation in {@link MediaNotifica
tionManager}. | 20 * Robolectric tests for compact view button computation in {@link MediaNotifica
tionManager}. |
| 21 */ | 21 */ |
| 22 @RunWith(LocalRobolectricTestRunner.class) | 22 @RunWith(LocalRobolectricTestRunner.class) |
| 23 @Config | 23 @Config(manifest = Config.NONE) |
| 24 public class MediaNotificationButtonComputationTest { | 24 public class MediaNotificationButtonComputationTest { |
| 25 @Test | 25 @Test |
| 26 @Feature({"MediaNotification"}) | 26 @Feature({"MediaNotification"}) |
| 27 public void testLessThanThreeActionsWillBeAllShownInCompactView() { | 27 public void testLessThanThreeActionsWillBeAllShownInCompactView() { |
| 28 ArrayList<Integer> actions = new ArrayList<>(); | 28 ArrayList<Integer> actions = new ArrayList<>(); |
| 29 actions.add(MediaSessionAction.NEXT_TRACK); | 29 actions.add(MediaSessionAction.NEXT_TRACK); |
| 30 actions.add(MediaSessionAction.SEEK_FORWARD); | 30 actions.add(MediaSessionAction.SEEK_FORWARD); |
| 31 actions.add(MediaSessionAction.PLAY); | 31 actions.add(MediaSessionAction.PLAY); |
| 32 | 32 |
| 33 int[] compactViewActions = | 33 int[] compactViewActions = |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 int[] compactViewActions = | 88 int[] compactViewActions = |
| 89 MediaNotificationManager.computeCompactViewActionIndices(actions
); | 89 MediaNotificationManager.computeCompactViewActionIndices(actions
); |
| 90 | 90 |
| 91 assertEquals(3, compactViewActions.length); | 91 assertEquals(3, compactViewActions.length); |
| 92 assertEquals(0, compactViewActions[0]); | 92 assertEquals(0, compactViewActions[0]); |
| 93 assertEquals(4, compactViewActions[1]); | 93 assertEquals(4, compactViewActions[1]); |
| 94 assertEquals(1, compactViewActions[2]); | 94 assertEquals(1, compactViewActions[2]); |
| 95 } | 95 } |
| 96 } | 96 } |
| OLD | NEW |