Merge "Removing unnecessary period from strings" into pi-car-dev
diff --git a/tests/robotests/src/com/android/car/settings/bluetooth/BluetoothSettingsFragmentTest.java b/tests/robotests/src/com/android/car/settings/bluetooth/BluetoothSettingsFragmentTest.java
index 1438d87..fd19141 100644
--- a/tests/robotests/src/com/android/car/settings/bluetooth/BluetoothSettingsFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/bluetooth/BluetoothSettingsFragmentTest.java
@@ -48,6 +48,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadow.api.Shadow;
@@ -237,6 +238,8 @@
Intent intent = new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
intent.putExtra(BluetoothAdapter.EXTRA_STATE, state);
mContext.sendBroadcast(intent);
+
+ Robolectric.flushForegroundThreadScheduler();
}
private MenuItem findSwitch(Activity activity) {
diff --git a/tests/robotests/src/com/android/car/settings/wifi/AddWifiFragmentTest.java b/tests/robotests/src/com/android/car/settings/wifi/AddWifiFragmentTest.java
index a0bc881..7ea6296 100644
--- a/tests/robotests/src/com/android/car/settings/wifi/AddWifiFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/wifi/AddWifiFragmentTest.java
@@ -36,6 +36,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@@ -122,6 +123,8 @@
intent.putExtra(NetworkNamePreferenceController.KEY_NETWORK_NAME, networkName);
mLocalBroadcastManager.sendBroadcastSync(intent);
+ Robolectric.flushForegroundThreadScheduler();
+
assertThat(getAddWifiButton().isEnabled()).isTrue();
}
diff --git a/tests/robotests/src/com/android/car/settings/wifi/WifiTetherFragmentTest.java b/tests/robotests/src/com/android/car/settings/wifi/WifiTetherFragmentTest.java
index ed3e706..bbe5cf6 100644
--- a/tests/robotests/src/com/android/car/settings/wifi/WifiTetherFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/wifi/WifiTetherFragmentTest.java
@@ -40,6 +40,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadow.api.Shadow;
@@ -122,9 +123,7 @@
ShadowCarWifiManager.setInstance(mCarWifiManager);
mFragmentController.setup();
- Intent intent = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
- intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_ENABLING);
- mContext.sendBroadcast(intent);
+ sendStateChangedIntent(WifiManager.WIFI_AP_STATE_ENABLING);
assertThat(findSwitch(mFragment.requireActivity()).isEnabled()).isFalse();
}
@@ -135,9 +134,7 @@
ShadowCarWifiManager.setInstance(mCarWifiManager);
mFragmentController.setup();
- Intent intent = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
- intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_ENABLED);
- mContext.sendBroadcast(intent);
+ sendStateChangedIntent(WifiManager.WIFI_AP_STATE_ENABLED);
assertThat(findSwitch(mFragment.requireActivity()).isEnabled()).isTrue();
assertThat(findSwitch(mFragment.requireActivity()).isChecked()).isTrue();
@@ -149,9 +146,7 @@
ShadowCarWifiManager.setInstance(mCarWifiManager);
mFragmentController.setup();
- Intent intent = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
- intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_DISABLED);
- mContext.sendBroadcast(intent);
+ sendStateChangedIntent(WifiManager.WIFI_AP_STATE_DISABLED);
assertThat(findSwitch(mFragment.requireActivity()).isEnabled()).isTrue();
assertThat(findSwitch(mFragment.requireActivity()).isChecked()).isFalse();
@@ -163,18 +158,22 @@
ShadowCarWifiManager.setInstance(mCarWifiManager);
mFragmentController.setup();
- Intent intent = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
- intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_ENABLING);
- mContext.sendBroadcast(intent);
+ sendStateChangedIntent(WifiManager.WIFI_AP_STATE_ENABLING);
- Intent intent2 = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
- intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_FAILED);
- mContext.sendBroadcast(intent2);
+ sendStateChangedIntent(WifiManager.WIFI_AP_STATE_FAILED);
assertThat(findSwitch(mFragment.requireActivity()).isEnabled()).isTrue();
assertThat(findSwitch(mFragment.requireActivity()).isChecked()).isFalse();
}
+ private void sendStateChangedIntent(int state) {
+ Intent intent = new Intent(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
+ intent.putExtra(WifiManager.EXTRA_WIFI_AP_STATE, state);
+ mContext.sendBroadcast(intent);
+
+ Robolectric.flushForegroundThreadScheduler();
+ }
+
private MenuItem findSwitch(Activity activity) {
Toolbar toolbar = activity.requireViewById(R.id.toolbar);
return toolbar.getMenuItems().get(0);