* commit 'e316204c0ef8cbf6f7b3958840454233f2421ae9': SysUI Tests: Make tests not break SysUI
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<com.android.systemui.recent.RecentsPanelView
|
<com.android.systemui.recent.RecentsPanelView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/recents_root"
|
android:id="@+id/recents_root"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<!-- navigation bar for sw600dp (small tablets) -->
|
<!-- navigation bar for sw600dp (small tablets) -->
|
||||||
<com.android.systemui.statusbar.phone.NavigationBarView
|
<com.android.systemui.statusbar.phone.NavigationBarView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/system_bar_background"
|
android:background="@drawable/system_bar_background"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<com.android.systemui.statusbar.phone.NavigationBarView
|
<com.android.systemui.statusbar.phone.NavigationBarView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/system_bar_background"
|
android:background="@drawable/system_bar_background"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
style="@style/BrightnessDialogContainer">
|
style="@style/BrightnessDialogContainer">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<!-- Extends RelativeLayout -->
|
<!-- Extends RelativeLayout -->
|
||||||
<com.android.systemui.statusbar.phone.StatusBarHeaderView
|
<com.android.systemui.statusbar.phone.StatusBarHeaderView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/header"
|
android:id="@+id/header"
|
||||||
android:layout_width="@dimen/notification_panel_width"
|
android:layout_width="@dimen/notification_panel_width"
|
||||||
android:layout_height="@dimen/status_bar_header_height"
|
android:layout_height="@dimen/status_bar_header_height"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<com.android.systemui.recent.RecentsPanelView
|
<com.android.systemui.recent.RecentsPanelView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/recents_root"
|
android:id="@+id/recents_root"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -179,13 +179,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
public NetworkControllerImpl(Context context) {
|
public NetworkControllerImpl(Context context) {
|
||||||
this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE),
|
this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE),
|
||||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE),
|
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE),
|
||||||
(WifiManager) context.getSystemService(Context.WIFI_SERVICE));
|
(WifiManager) context.getSystemService(Context.WIFI_SERVICE),
|
||||||
|
new AccessPointController(context), new MobileDataController(context));
|
||||||
registerListeners();
|
registerListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
NetworkControllerImpl(Context context, ConnectivityManager connectivityManager,
|
NetworkControllerImpl(Context context, ConnectivityManager connectivityManager,
|
||||||
TelephonyManager telephonyManager, WifiManager wifiManager) {
|
TelephonyManager telephonyManager, WifiManager wifiManager,
|
||||||
|
AccessPointController accessPointController,
|
||||||
|
MobileDataController mobileDataController) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
|
|
||||||
@@ -224,8 +227,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
updateAirplaneMode();
|
updateAirplaneMode();
|
||||||
|
|
||||||
mLastLocale = mContext.getResources().getConfiguration().locale;
|
mLastLocale = mContext.getResources().getConfiguration().locale;
|
||||||
mAccessPoints = new AccessPointController(mContext);
|
mAccessPoints = accessPointController;
|
||||||
mMobileDataController = new MobileDataController(mContext);
|
mMobileDataController = mobileDataController;
|
||||||
mMobileDataController.setCallback(new MobileDataController.Callback() {
|
mMobileDataController.setCallback(new MobileDataController.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onMobileDataEnabled(boolean enabled) {
|
public void onMobileDataEnabled(boolean enabled) {
|
||||||
|
|||||||
@@ -17,14 +17,20 @@ include $(CLEAR_VARS)
|
|||||||
|
|
||||||
LOCAL_MODULE_TAGS := tests
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.android.systemui:com.android.keyguard
|
||||||
|
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
|
||||||
|
$(call all-java-files-under, ../src) \
|
||||||
|
src/com/android/systemui/EventLogTags.logtags
|
||||||
|
|
||||||
|
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
|
||||||
|
frameworks/base/packages/SystemUI/res \
|
||||||
|
frameworks/base/packages/Keyguard/res
|
||||||
|
|
||||||
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
|
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
|
||||||
|
|
||||||
LOCAL_PACKAGE_NAME := SystemUITests
|
LOCAL_PACKAGE_NAME := SystemUITests
|
||||||
LOCAL_INSTRUMENTATION_FOR := SystemUI
|
|
||||||
|
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES := mockito-target
|
LOCAL_STATIC_JAVA_LIBRARIES := mockito-target Keyguard
|
||||||
|
|
||||||
# sign this with platform cert, so this test is allowed to inject key events into
|
# sign this with platform cert, so this test is allowed to inject key events into
|
||||||
# UI it doesn't own. This is necessary to allow screenshots to be taken
|
# UI it doesn't own. This is necessary to allow screenshots to be taken
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</application>
|
</application>
|
||||||
|
|
||||||
<instrumentation android:name="android.test.InstrumentationTestRunner"
|
<instrumentation android:name="android.test.InstrumentationTestRunner"
|
||||||
android:targetPackage="com.android.systemui"
|
android:targetPackage="com.android.systemui.tests"
|
||||||
android:label="Tests for SystemUI">
|
android:label="Tests for SystemUI">
|
||||||
</instrumentation>
|
</instrumentation>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../src/com/android/systemui/EventLogTags.logtags
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.systemui.screenshot;
|
package com.android.systemui.screenshot;
|
||||||
|
|
||||||
import com.android.systemui.tests.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
|||||||
mSignalCluster = mock(SignalCluster.class);
|
mSignalCluster = mock(SignalCluster.class);
|
||||||
mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class);
|
mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class);
|
||||||
|
|
||||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm);
|
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
|
||||||
|
mock(AccessPointController.class), mock(MobileDataController.class));
|
||||||
setupNetworkController();
|
setupNetworkController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.android.systemui.statusbar.policy;
|
package com.android.systemui.statusbar.policy;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SignalStrength;
|
import android.telephony.SignalStrength;
|
||||||
@@ -15,7 +17,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
|||||||
// Turn off mobile network support.
|
// Turn off mobile network support.
|
||||||
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||||
// Create a new NetworkController as this is currently handled in constructor.
|
// Create a new NetworkController as this is currently handled in constructor.
|
||||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm);
|
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
|
||||||
|
mock(AccessPointController.class), mock(MobileDataController.class));
|
||||||
setupNetworkController();
|
setupNetworkController();
|
||||||
|
|
||||||
verifyLastMobileDataIndicators(false, 0, 0);
|
verifyLastMobileDataIndicators(false, 0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user