Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [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 | package com.android.systemui.qs.external; |
| 17 | |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 18 | import static junit.framework.Assert.assertFalse; |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 19 | import static junit.framework.Assert.assertTrue; |
Jason Monk | e978928 | 2016-11-09 08:59:56 -0500 | [diff] [blame] | 20 | |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 21 | import static org.junit.Assert.assertEquals; |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 22 | import static org.mockito.Mockito.any; |
| 23 | import static org.mockito.Mockito.anyInt; |
| 24 | import static org.mockito.Mockito.anyString; |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 25 | import static org.mockito.Mockito.never; |
| 26 | import static org.mockito.Mockito.times; |
| 27 | import static org.mockito.Mockito.verify; |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 28 | import static org.mockito.Mockito.when; |
| 29 | |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 30 | import android.content.ComponentName; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 31 | import android.content.Intent; |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 32 | import android.content.pm.PackageInfo; |
| 33 | import android.content.pm.ServiceInfo; |
| 34 | import android.net.Uri; |
| 35 | import android.os.Bundle; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 36 | import android.os.Handler; |
| 37 | import android.os.HandlerThread; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 38 | import android.os.UserHandle; |
Jason Monk | fe8f682 | 2015-12-21 15:12:01 -0500 | [diff] [blame] | 39 | import android.service.quicksettings.IQSService; |
| 40 | import android.service.quicksettings.IQSTileService; |
| 41 | import android.service.quicksettings.Tile; |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 42 | import android.service.quicksettings.TileService; |
Jason Monk | 0c6e099 | 2016-03-29 15:49:02 -0400 | [diff] [blame] | 43 | import android.test.suitebuilder.annotation.SmallTest; |
Jason Monk | e978928 | 2016-11-09 08:59:56 -0500 | [diff] [blame] | 44 | |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 45 | import androidx.test.runner.AndroidJUnit4; |
| 46 | |
Jason Monk | e978928 | 2016-11-09 08:59:56 -0500 | [diff] [blame] | 47 | import com.android.systemui.SysuiTestCase; |
| 48 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 49 | import org.junit.After; |
| 50 | import org.junit.Before; |
| 51 | import org.junit.Test; |
| 52 | import org.junit.runner.RunWith; |
Jason Monk | a3453b8b | 2016-06-17 12:42:59 -0400 | [diff] [blame] | 53 | import org.mockito.Mockito; |
| 54 | |
Jason Monk | 0c6e099 | 2016-03-29 15:49:02 -0400 | [diff] [blame] | 55 | @SmallTest |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 56 | @RunWith(AndroidJUnit4.class) |
Jason Monk | e978928 | 2016-11-09 08:59:56 -0500 | [diff] [blame] | 57 | public class TileLifecycleManagerTest extends SysuiTestCase { |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 58 | private static final int TEST_FAIL_TIMEOUT = 5000; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 59 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 60 | private final PackageManagerAdapter mMockPackageManagerAdapter = |
| 61 | Mockito.mock(PackageManagerAdapter.class); |
| 62 | private final IQSTileService.Stub mMockTileService = Mockito.mock(IQSTileService.Stub.class); |
| 63 | private ComponentName mTileServiceComponentName; |
| 64 | private Intent mTileServiceIntent; |
| 65 | private UserHandle mUser; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 66 | private HandlerThread mThread; |
| 67 | private Handler mHandler; |
| 68 | private TileLifecycleManager mStateManager; |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 69 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 70 | @Before |
| 71 | public void setUp() throws Exception { |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 72 | setPackageEnabled(true); |
Jason Monk | e978928 | 2016-11-09 08:59:56 -0500 | [diff] [blame] | 73 | mTileServiceComponentName = new ComponentName(mContext, "FakeTileService.class"); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 74 | |
| 75 | // Stub.asInterface will just return itself. |
| 76 | when(mMockTileService.queryLocalInterface(anyString())).thenReturn(mMockTileService); |
| 77 | |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 78 | mContext.addMockService(mTileServiceComponentName, mMockTileService); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 79 | |
| 80 | |
| 81 | mTileServiceIntent = new Intent().setComponent(mTileServiceComponentName); |
| 82 | mUser = new UserHandle(UserHandle.myUserId()); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 83 | mThread = new HandlerThread("TestThread"); |
| 84 | mThread.start(); |
Jason Monk | 6dceace | 2018-05-15 20:24:07 -0400 | [diff] [blame] | 85 | mHandler = Handler.createAsync(mThread.getLooper()); |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 86 | mStateManager = new TileLifecycleManager(mHandler, mContext, |
Jason Monk | ee68fd8 | 2016-06-23 13:12:23 -0400 | [diff] [blame] | 87 | Mockito.mock(IQSService.class), new Tile(), |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 88 | mTileServiceIntent, |
| 89 | mUser, |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 90 | mMockPackageManagerAdapter); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 91 | } |
| 92 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 93 | @After |
| 94 | public void tearDown() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 95 | mThread.quit(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 96 | } |
| 97 | |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 98 | private void setPackageEnabled(boolean enabled) throws Exception { |
| 99 | ServiceInfo defaultServiceInfo = null; |
| 100 | if (enabled) { |
| 101 | defaultServiceInfo = new ServiceInfo(); |
| 102 | defaultServiceInfo.metaData = new Bundle(); |
| 103 | defaultServiceInfo.metaData.putBoolean(TileService.META_DATA_ACTIVE_TILE, true); |
Fabian Kozynski | 05843f0 | 2019-06-28 13:19:57 -0400 | [diff] [blame] | 104 | defaultServiceInfo.metaData.putBoolean(TileService.META_DATA_BOOLEAN_TILE, true); |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 105 | } |
| 106 | when(mMockPackageManagerAdapter.getServiceInfo(any(), anyInt(), anyInt())) |
| 107 | .thenReturn(defaultServiceInfo); |
| 108 | when(mMockPackageManagerAdapter.getServiceInfo(any(), anyInt())) |
| 109 | .thenReturn(defaultServiceInfo); |
| 110 | PackageInfo defaultPackageInfo = new PackageInfo(); |
| 111 | when(mMockPackageManagerAdapter.getPackageInfoAsUser(anyString(), anyInt(), anyInt())) |
| 112 | .thenReturn(defaultPackageInfo); |
| 113 | } |
| 114 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 115 | private void verifyBind(int times) { |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 116 | assertEquals(times > 0, mContext.isBound(mTileServiceComponentName)); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 117 | } |
| 118 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 119 | @Test |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 120 | public void testBind() { |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 121 | mStateManager.setBindService(true); |
| 122 | verifyBind(1); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 123 | } |
| 124 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 125 | @Test |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 126 | public void testUnbind() { |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 127 | mStateManager.setBindService(true); |
| 128 | mStateManager.setBindService(false); |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 129 | assertFalse(mContext.isBound(mTileServiceComponentName)); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 130 | } |
| 131 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 132 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 133 | public void testTileServiceCallbacks() throws Exception { |
| 134 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 135 | mStateManager.onTileAdded(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 136 | verify(mMockTileService).onTileAdded(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 137 | mStateManager.onStartListening(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 138 | verify(mMockTileService).onStartListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 139 | mStateManager.onClick(null); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 140 | verify(mMockTileService).onClick(null); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 141 | mStateManager.onStopListening(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 142 | verify(mMockTileService).onStopListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 143 | mStateManager.onTileRemoved(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 144 | verify(mMockTileService).onTileRemoved(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 145 | } |
| 146 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 147 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 148 | public void testAddedBeforeBind() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 149 | mStateManager.onTileAdded(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 150 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 151 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 152 | verifyBind(1); |
| 153 | verify(mMockTileService).onTileAdded(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 154 | } |
| 155 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 156 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 157 | public void testListeningBeforeBind() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 158 | mStateManager.onTileAdded(); |
| 159 | mStateManager.onStartListening(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 160 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 161 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 162 | verifyBind(1); |
| 163 | verify(mMockTileService).onTileAdded(); |
| 164 | verify(mMockTileService).onStartListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 165 | } |
| 166 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 167 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 168 | public void testClickBeforeBind() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 169 | mStateManager.onTileAdded(); |
| 170 | mStateManager.onStartListening(); |
| 171 | mStateManager.onClick(null); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 172 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 173 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 174 | verifyBind(1); |
| 175 | verify(mMockTileService).onTileAdded(); |
| 176 | verify(mMockTileService).onStartListening(); |
| 177 | verify(mMockTileService).onClick(null); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 178 | } |
| 179 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 180 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 181 | public void testListeningNotListeningBeforeBind() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 182 | mStateManager.onTileAdded(); |
| 183 | mStateManager.onStartListening(); |
| 184 | mStateManager.onStopListening(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 185 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 186 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 187 | verifyBind(1); |
| 188 | mStateManager.setBindService(false); |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 189 | assertFalse(mContext.isBound(mTileServiceComponentName)); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 190 | verify(mMockTileService, never()).onStartListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 191 | } |
| 192 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 193 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 194 | public void testNoClickOfNotListeningAnymore() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 195 | mStateManager.onTileAdded(); |
| 196 | mStateManager.onStartListening(); |
| 197 | mStateManager.onClick(null); |
| 198 | mStateManager.onStopListening(); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 199 | mStateManager.setBindService(true); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 200 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 201 | verifyBind(1); |
| 202 | mStateManager.setBindService(false); |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 203 | assertFalse(mContext.isBound(mTileServiceComponentName)); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 204 | verify(mMockTileService, never()).onClick(null); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 205 | } |
| 206 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 207 | @Test |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 208 | public void testComponentEnabling() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 209 | mStateManager.onTileAdded(); |
| 210 | mStateManager.onStartListening(); |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 211 | setPackageEnabled(false); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 212 | mStateManager.setBindService(true); |
| 213 | // Package not available, not yet created. |
| 214 | verifyBind(0); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 215 | |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 216 | // Package is re-enabled. |
| 217 | setPackageEnabled(true); |
| 218 | mStateManager.onReceive( |
Jason Monk | 3cfedd7 | 2016-12-09 09:31:37 -0500 | [diff] [blame] | 219 | mContext, |
Geoffrey Pitsch | af2076a | 2016-08-31 12:44:08 -0400 | [diff] [blame] | 220 | new Intent( |
| 221 | Intent.ACTION_PACKAGE_CHANGED, |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 222 | Uri.fromParts( |
| 223 | "package", mTileServiceComponentName.getPackageName(), null))); |
| 224 | verifyBind(1); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 225 | } |
| 226 | |
Geoffrey Pitsch | 2c403db | 2016-08-26 09:09:39 -0400 | [diff] [blame] | 227 | @Test |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 228 | public void testKillProcess() throws Exception { |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 229 | mStateManager.onStartListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 230 | mStateManager.setBindService(true); |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 231 | mStateManager.setBindRetryDelay(0); |
| 232 | mStateManager.onServiceDisconnected(mTileServiceComponentName); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 233 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 234 | // Guarantees mHandler has processed all messages. |
| 235 | assertTrue(mHandler.runWithScissors(()->{}, TEST_FAIL_TIMEOUT)); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 236 | |
Geoffrey Pitsch | ebee1a3 | 2016-09-09 13:04:12 -0400 | [diff] [blame] | 237 | // Two calls: one for the first bind, one for the restart. |
| 238 | verifyBind(2); |
| 239 | verify(mMockTileService, times(2)).onStartListening(); |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 240 | } |
Fabian Kozynski | 05843f0 | 2019-06-28 13:19:57 -0400 | [diff] [blame] | 241 | |
| 242 | @Test |
| 243 | public void testBooleanTile() throws Exception { |
| 244 | assertTrue(mStateManager.isBooleanTile()); |
| 245 | } |
Jason Monk | d5a204f | 2015-12-21 08:50:01 -0500 | [diff] [blame] | 246 | } |