Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.documentsui.bots; |
| 18 | |
Brett Chabot | 2027ca0 | 2018-12-13 19:06:31 -0800 | [diff] [blame] | 19 | import static androidx.test.espresso.Espresso.onView; |
| 20 | import static androidx.test.espresso.action.ViewActions.click; |
| 21 | import static androidx.test.espresso.assertion.ViewAssertions.matches; |
| 22 | import static androidx.test.espresso.matcher.ViewMatchers.hasFocus; |
| 23 | import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom; |
| 24 | import static androidx.test.espresso.matcher.ViewMatchers.withClassName; |
| 25 | import static androidx.test.espresso.matcher.ViewMatchers.withId; |
| 26 | import static androidx.test.espresso.matcher.ViewMatchers.withText; |
| 27 | |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 28 | import static junit.framework.Assert.assertEquals; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 29 | import static junit.framework.Assert.assertNotNull; |
Tony Huang | 7b3f074 | 2019-01-25 12:02:44 +0800 | [diff] [blame] | 30 | import static junit.framework.Assert.assertTrue; |
Brett Chabot | 2027ca0 | 2018-12-13 19:06:31 -0800 | [diff] [blame] | 31 | |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 32 | import static org.hamcrest.CoreMatchers.allOf; |
Ben Lin | b8c54e7 | 2016-06-10 12:13:27 -0700 | [diff] [blame] | 33 | import static org.hamcrest.CoreMatchers.is; |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 34 | import static org.hamcrest.Matchers.endsWith; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 35 | |
| 36 | import android.content.Context; |
| 37 | import android.support.test.uiautomator.By; |
| 38 | import android.support.test.uiautomator.UiDevice; |
| 39 | import android.support.test.uiautomator.UiObject; |
| 40 | import android.support.test.uiautomator.UiObject2; |
| 41 | import android.support.test.uiautomator.UiObjectNotFoundException; |
| 42 | import android.support.test.uiautomator.UiSelector; |
Ben Lin | d1736fd | 2016-09-15 10:44:11 -0700 | [diff] [blame] | 43 | import android.support.test.uiautomator.Until; |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 44 | import android.util.TypedValue; |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 45 | import android.view.View; |
Tony Huang | 8d8d92f | 2018-09-13 14:41:16 +0800 | [diff] [blame] | 46 | |
| 47 | import androidx.appcompat.widget.Toolbar; |
Bill Lin | 3432919 | 2019-03-05 22:22:20 +0800 | [diff] [blame] | 48 | import androidx.test.InstrumentationRegistry; |
Brett Chabot | 2027ca0 | 2018-12-13 19:06:31 -0800 | [diff] [blame] | 49 | import androidx.test.espresso.Espresso; |
| 50 | import androidx.test.espresso.action.ViewActions; |
| 51 | import androidx.test.espresso.matcher.BoundedMatcher; |
| 52 | import androidx.test.espresso.matcher.ViewMatchers; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 53 | |
| 54 | import com.android.documentsui.R; |
Ben Lin | b8c54e7 | 2016-06-10 12:13:27 -0700 | [diff] [blame] | 55 | |
Ben Lin | 8952ec6 | 2016-05-11 17:38:18 -0700 | [diff] [blame] | 56 | import org.hamcrest.Description; |
| 57 | import org.hamcrest.Matcher; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 58 | |
| 59 | import java.util.Iterator; |
| 60 | import java.util.List; |
| 61 | |
| 62 | /** |
| 63 | * A test helper class that provides support for controlling DocumentsUI activities |
| 64 | * programmatically, and making assertions against the state of the UI. |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 65 | * <p> |
| 66 | * Support for working directly with Roots and Directory view can be found in the respective bots. |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 67 | */ |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 68 | public class UiBot extends Bots.BaseBot { |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 69 | |
Bill Lin | 3432919 | 2019-03-05 22:22:20 +0800 | [diff] [blame] | 70 | public static String targetPackageName; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 71 | |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 72 | @SuppressWarnings("unchecked") |
| 73 | private static final Matcher<View> TOOLBAR = allOf( |
| 74 | isAssignableFrom(Toolbar.class), |
| 75 | withId(R.id.toolbar)); |
| 76 | |
| 77 | @SuppressWarnings("unchecked") |
| 78 | private static final Matcher<View> ACTIONBAR = allOf( |
| 79 | withClassName(endsWith("ActionBarContextView"))); |
| 80 | |
| 81 | @SuppressWarnings("unchecked") |
| 82 | private static final Matcher<View> TEXT_ENTRY = allOf( |
| 83 | withClassName(endsWith("EditText"))); |
| 84 | |
| 85 | @SuppressWarnings("unchecked") |
| 86 | private static final Matcher<View> TOOLBAR_OVERFLOW = allOf( |
| 87 | withClassName(endsWith("OverflowMenuButton")), |
| 88 | ViewMatchers.isDescendantOfA(TOOLBAR)); |
| 89 | |
| 90 | @SuppressWarnings("unchecked") |
| 91 | private static final Matcher<View> ACTIONBAR_OVERFLOW = allOf( |
| 92 | withClassName(endsWith("OverflowMenuButton")), |
| 93 | ViewMatchers.isDescendantOfA(ACTIONBAR)); |
| 94 | |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 95 | public UiBot(UiDevice device, Context context, int timeout) { |
| 96 | super(device, context, timeout); |
Bill Lin | 3432919 | 2019-03-05 22:22:20 +0800 | [diff] [blame] | 97 | targetPackageName = |
| 98 | InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageName(); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | public void assertWindowTitle(String expected) { |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 102 | onView(TOOLBAR) |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 103 | .check(matches(withToolbarTitle(is(expected)))); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 104 | } |
| 105 | |
Tony Huang | 7b3f074 | 2019-01-25 12:02:44 +0800 | [diff] [blame] | 106 | public void assertSearchBarShow() { |
| 107 | UiSelector selector = new UiSelector().text(mContext.getString(R.string.search_bar_hint)); |
| 108 | UiObject searchHint = mDevice.findObject(selector); |
| 109 | assertTrue(searchHint.exists()); |
| 110 | } |
| 111 | |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 112 | public void assertMenuEnabled(int id, boolean enabled) { |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 113 | UiObject2 menu = findMenuWithName(mContext.getString(id)); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 114 | assertNotNull(menu); |
| 115 | assertEquals(enabled, menu.isEnabled()); |
| 116 | } |
| 117 | |
Aga Wronska | 7e5b963 | 2016-02-26 11:36:07 -0800 | [diff] [blame] | 118 | public void assertInActionMode(boolean inActionMode) { |
Ben Lin | d1736fd | 2016-09-15 10:44:11 -0700 | [diff] [blame] | 119 | assertEquals(inActionMode, waitForActionModeBarToAppear()); |
Aga Wronska | 7e5b963 | 2016-02-26 11:36:07 -0800 | [diff] [blame] | 120 | } |
| 121 | |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 122 | public UiObject openOverflowMenu() throws UiObjectNotFoundException { |
| 123 | UiObject obj = findMenuMoreOptions(); |
| 124 | obj.click(); |
| 125 | mDevice.waitForIdle(mTimeout); |
| 126 | return obj; |
| 127 | } |
| 128 | |
| 129 | public void setDialogText(String text) throws UiObjectNotFoundException { |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 130 | onView(TEXT_ENTRY) |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 131 | .perform(ViewActions.replaceText(text)); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 132 | } |
| 133 | |
Jon Mann | 38f1439 | 2017-01-25 13:51:55 -0800 | [diff] [blame] | 134 | public void assertDialogText(String expected) throws UiObjectNotFoundException { |
| 135 | onView(TEXT_ENTRY) |
| 136 | .check(matches(withText(is(expected)))); |
| 137 | } |
| 138 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 139 | public boolean inFixedLayout() { |
| 140 | TypedValue val = new TypedValue(); |
| 141 | // We alias files_activity to either fixed or drawer layouts based |
| 142 | // on screen dimensions. In order to determine which layout |
| 143 | // has been selected, we check the resolved value. |
| 144 | mContext.getResources().getValue(R.layout.files_activity, val, true); |
| 145 | return val.resourceId == R.layout.fixed_layout; |
| 146 | } |
| 147 | |
| 148 | public boolean inDrawerLayout() { |
| 149 | return !inFixedLayout(); |
Ben Lin | 4c6e4a2 | 2016-05-23 09:49:51 -0700 | [diff] [blame] | 150 | } |
| 151 | |
Garfield, Tan | 28bbd8d | 2016-08-18 15:22:47 -0700 | [diff] [blame] | 152 | public void switchToListMode() { |
| 153 | final UiObject2 listMode = menuListMode(); |
| 154 | if (listMode != null) { |
| 155 | listMode.click(); |
| 156 | } |
| 157 | } |
| 158 | |
Julian Mancini | 30e015a | 2017-06-07 15:14:49 -0700 | [diff] [blame] | 159 | public void clickActionItem(String label) throws UiObjectNotFoundException { |
| 160 | if (!waitForActionModeBarToAppear()) { |
| 161 | throw new UiObjectNotFoundException("ActionMode bar not found"); |
| 162 | } |
| 163 | clickActionbarOverflowItem(label); |
| 164 | mDevice.waitForIdle(); |
| 165 | } |
| 166 | |
Garfield, Tan | 28bbd8d | 2016-08-18 15:22:47 -0700 | [diff] [blame] | 167 | public void switchToGridMode() { |
| 168 | final UiObject2 gridMode = menuGridMode(); |
| 169 | if (gridMode != null) { |
| 170 | gridMode.click(); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 171 | } |
| 172 | } |
| 173 | |
| 174 | UiObject2 menuGridMode() { |
| 175 | // Note that we're using By.desc rather than By.res, because of b/25285770 |
| 176 | return find(By.desc("Grid view")); |
| 177 | } |
| 178 | |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 179 | UiObject2 menuListMode() { |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 180 | // Note that we're using By.desc rather than By.res, because of b/25285770 |
| 181 | return find(By.desc("List view")); |
| 182 | } |
| 183 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 184 | public void clickToolbarItem(int id) { |
| 185 | onView(withId(id)).perform(click()); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 186 | } |
| 187 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 188 | public void clickNewFolder() { |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 189 | onView(ACTIONBAR_OVERFLOW).perform(click()); |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 190 | |
| 191 | // Click the item by label, since Espresso doesn't support lookup by id on overflow. |
| 192 | onView(withText("New folder")).perform(click()); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 193 | } |
| 194 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 195 | public void clickActionbarOverflowItem(String label) { |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 196 | onView(ACTIONBAR_OVERFLOW).perform(click()); |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 197 | // Click the item by label, since Espresso doesn't support lookup by id on overflow. |
| 198 | onView(withText(label)).perform(click()); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 199 | } |
| 200 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 201 | public void clickToolbarOverflowItem(String label) { |
Steve McKay | 502c3b1 | 2016-06-29 16:01:39 -0700 | [diff] [blame] | 202 | onView(TOOLBAR_OVERFLOW).perform(click()); |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 203 | // Click the item by label, since Espresso doesn't support lookup by id on overflow. |
| 204 | onView(withText(label)).perform(click()); |
Ben Lin | b8c54e7 | 2016-06-10 12:13:27 -0700 | [diff] [blame] | 205 | } |
| 206 | |
Ben Lin | d1736fd | 2016-09-15 10:44:11 -0700 | [diff] [blame] | 207 | public boolean waitForActionModeBarToAppear() { |
| 208 | UiObject2 bar = |
Tony Huang | 8d8d92f | 2018-09-13 14:41:16 +0800 | [diff] [blame] | 209 | mDevice.wait(Until.findObject( |
Tony Huang | ed2f31f | 2019-03-27 18:47:37 +0800 | [diff] [blame] | 210 | By.res(mTargetPackage + ":id/action_mode_bar")), mTimeout); |
Ben Lin | d1736fd | 2016-09-15 10:44:11 -0700 | [diff] [blame] | 211 | return (bar != null); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 212 | } |
| 213 | |
Tony Huang | 1bbf37a | 2018-09-12 15:57:55 +0800 | [diff] [blame] | 214 | public void clickRename() throws UiObjectNotFoundException { |
| 215 | if (!waitForActionModeBarToAppear()) { |
| 216 | throw new UiObjectNotFoundException("ActionMode bar not found"); |
| 217 | } |
| 218 | clickActionbarOverflowItem(mContext.getString(R.string.menu_rename)); |
| 219 | mDevice.waitForIdle(); |
| 220 | } |
| 221 | |
| 222 | public void clickDelete() throws UiObjectNotFoundException { |
| 223 | if (!waitForActionModeBarToAppear()) { |
| 224 | throw new UiObjectNotFoundException("ActionMode bar not found"); |
| 225 | } |
| 226 | clickToolbarItem(R.id.action_menu_delete); |
| 227 | mDevice.waitForIdle(); |
| 228 | } |
| 229 | |
Steve McKay | beac223 | 2016-03-11 10:11:52 -0800 | [diff] [blame] | 230 | public UiObject findDownloadRetryDialog() { |
| 231 | UiSelector selector = new UiSelector().text("Couldn't download"); |
| 232 | UiObject title = mDevice.findObject(selector); |
| 233 | title.waitForExists(mTimeout); |
| 234 | return title; |
| 235 | } |
| 236 | |
Jon Mann | 38f1439 | 2017-01-25 13:51:55 -0800 | [diff] [blame] | 237 | public UiObject findFileRenameDialog() { |
| 238 | UiSelector selector = new UiSelector().text("Rename"); |
| 239 | UiObject title = mDevice.findObject(selector); |
| 240 | title.waitForExists(mTimeout); |
| 241 | return title; |
| 242 | } |
| 243 | |
| 244 | public UiObject findRenameErrorMessage() { |
| 245 | UiSelector selector = new UiSelector().text(mContext.getString(R.string.name_conflict)); |
| 246 | UiObject title = mDevice.findObject(selector); |
| 247 | title.waitForExists(mTimeout); |
| 248 | return title; |
| 249 | } |
| 250 | |
Ben Lin | 6f6d578 | 2016-09-28 14:44:32 -0700 | [diff] [blame] | 251 | @SuppressWarnings("unchecked") |
| 252 | public void assertDialogOkButtonFocused() { |
| 253 | onView(withId(android.R.id.button1)).check(matches(hasFocus())); |
| 254 | } |
| 255 | |
Ben Lin | 4c6e4a2 | 2016-05-23 09:49:51 -0700 | [diff] [blame] | 256 | public void clickDialogOkButton() { |
| 257 | // Espresso has flaky results when keyboard shows up, so hiding it for now |
| 258 | // before trying to click on any dialog button |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 259 | Espresso.closeSoftKeyboard(); |
| 260 | onView(withId(android.R.id.button1)).perform(click()); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 261 | } |
| 262 | |
Ben Lin | 4c6e4a2 | 2016-05-23 09:49:51 -0700 | [diff] [blame] | 263 | public void clickDialogCancelButton() throws UiObjectNotFoundException { |
| 264 | // Espresso has flaky results when keyboard shows up, so hiding it for now |
| 265 | // before trying to click on any dialog button |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 266 | Espresso.closeSoftKeyboard(); |
| 267 | onView(withId(android.R.id.button2)).perform(click()); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 268 | } |
| 269 | |
Jun Ono | 418e5a3 | 2017-11-22 10:29:30 +0900 | [diff] [blame] | 270 | public UiObject findMenuLabelWithName(String label) { |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 271 | UiSelector selector = new UiSelector().text(label); |
| 272 | return mDevice.findObject(selector); |
| 273 | } |
| 274 | |
| 275 | UiObject2 findMenuWithName(String label) { |
Tony Huang | d02c8a2 | 2019-11-14 18:49:16 +0800 | [diff] [blame] | 276 | UiObject2 list = mDevice.findObject(By.clazz("android.widget.ListView")); |
| 277 | List<UiObject2> menuItems = list.getChildren(); |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 278 | Iterator<UiObject2> it = menuItems.iterator(); |
| 279 | |
| 280 | UiObject2 menuItem = null; |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 281 | while (it.hasNext()) { |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 282 | menuItem = it.next(); |
| 283 | UiObject2 text = menuItem.findObject(By.text(label)); |
Tony Huang | d02c8a2 | 2019-11-14 18:49:16 +0800 | [diff] [blame] | 284 | if (text != null) { |
| 285 | return menuItem; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 286 | } |
| 287 | } |
Tony Huang | d02c8a2 | 2019-11-14 18:49:16 +0800 | [diff] [blame] | 288 | return null; |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 289 | } |
| 290 | |
Steve McKay | 85ec0d6 | 2016-06-24 15:05:08 -0700 | [diff] [blame] | 291 | boolean hasMenuWithName(String label) { |
| 292 | return findMenuWithName(label) != null; |
| 293 | } |
| 294 | |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 295 | UiObject findMenuMoreOptions() { |
Tony Huang | 8d8d92f | 2018-09-13 14:41:16 +0800 | [diff] [blame] | 296 | UiSelector selector = new UiSelector().className("android.widget.ImageView") |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 297 | .descriptionContains("More options"); |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 298 | // TODO: use the system string ? android.R.string.action_menu_overflow_description |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 299 | return mDevice.findObject(selector); |
| 300 | } |
| 301 | |
Ben Lin | 8952ec6 | 2016-05-11 17:38:18 -0700 | [diff] [blame] | 302 | private static Matcher<Object> withToolbarTitle( |
Steve McKay | aee0e62 | 2016-06-23 14:24:41 -0700 | [diff] [blame] | 303 | final Matcher<CharSequence> textMatcher) { |
| 304 | return new BoundedMatcher<Object, Toolbar>(Toolbar.class) { |
| 305 | @Override |
| 306 | public boolean matchesSafely(Toolbar toolbar) { |
| 307 | return textMatcher.matches(toolbar.getTitle()); |
| 308 | } |
| 309 | |
| 310 | @Override |
| 311 | public void describeTo(Description description) { |
| 312 | description.appendText("with toolbar title: "); |
| 313 | textMatcher.describeTo(description); |
| 314 | } |
| 315 | }; |
Ben Lin | 8952ec6 | 2016-05-11 17:38:18 -0700 | [diff] [blame] | 316 | } |
Steve McKay | 5e1acc9 | 2016-02-19 12:57:05 -0800 | [diff] [blame] | 317 | } |