OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.test; | 5 package org.chromium.chrome.test; |
6 | 6 |
7 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_P
HONE; | 7 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_P
HONE; |
8 | 8 |
| 9 import android.os.Build; |
9 import android.support.v7.widget.RecyclerView; | 10 import android.support.v7.widget.RecyclerView; |
10 | 11 |
11 import org.chromium.base.ThreadUtils; | 12 import org.chromium.base.ThreadUtils; |
12 import org.chromium.base.test.util.CommandLineFlags; | 13 import org.chromium.base.test.util.CommandLineFlags; |
| 14 import org.chromium.base.test.util.MinAndroidSdkLevel; |
13 import org.chromium.base.test.util.Restriction; | 15 import org.chromium.base.test.util.Restriction; |
14 import org.chromium.chrome.R; | 16 import org.chromium.chrome.R; |
15 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 17 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
16 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; | 18 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; |
17 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; | 19 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; |
18 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentControll
er; | 20 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentControll
er; |
19 import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils; | 21 import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils; |
20 | 22 |
21 /** | 23 /** |
22 * Base class for instrumentation tests using the bottom sheet. | 24 * Base class for instrumentation tests using the bottom sheet. |
23 */ | 25 */ |
24 @CommandLineFlags.Add({"enable-features=ChromeHome"}) | 26 @CommandLineFlags.Add({"enable-features=ChromeHome"}) |
25 @Restriction(RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones | 27 @Restriction(RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones |
| 28 @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP_MR1) |
26 public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBa
se { | 29 public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBa
se { |
27 /** A handle to the bottom sheet. */ | 30 /** A handle to the bottom sheet. */ |
28 protected BottomSheet mBottomSheet; | 31 protected BottomSheet mBottomSheet; |
29 | 32 |
30 /** A handle to the {@link BottomSheetContentController}. */ | 33 /** A handle to the {@link BottomSheetContentController}. */ |
31 protected BottomSheetContentController mBottomSheetContentController; | 34 protected BottomSheetContentController mBottomSheetContentController; |
32 | 35 |
33 private boolean mOldChromeHomeFlagValue; | 36 private boolean mOldChromeHomeFlagValue; |
34 @Override | 37 @Override |
35 protected void setUp() throws Exception { | 38 protected void setUp() throws Exception { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 */ | 110 */ |
108 protected void selectBottomSheetContent(final int itemId) { | 111 protected void selectBottomSheetContent(final int itemId) { |
109 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 112 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
110 @Override | 113 @Override |
111 public void run() { | 114 public void run() { |
112 mBottomSheetContentController.selectItemForTests(itemId); | 115 mBottomSheetContentController.selectItemForTests(itemId); |
113 } | 116 } |
114 }); | 117 }); |
115 } | 118 } |
116 } | 119 } |
OLD | NEW |