am caf4828c: Merge "SysUI Tests: Make tests not break SysUI" into lmp-mr1-dev

* commit 'caf4828c77b692b6e608a4c6561069783983b7b1':
  SysUI Tests: Make tests not break SysUI
This commit is contained in:
Jason Monk
2014-11-18 16:38:49 +00:00
committed by Android Git Automerger
13 changed files with 31 additions and 17 deletions

View File

@@ -20,7 +20,7 @@
<com.android.systemui.recent.RecentsPanelView
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:layout_height="match_parent"
android:layout_width="match_parent"

View File

@@ -19,7 +19,7 @@
<!-- navigation bar for sw600dp (small tablets) -->
<com.android.systemui.statusbar.phone.NavigationBarView
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_width="match_parent"
android:background="@drawable/system_bar_background"

View File

@@ -20,7 +20,7 @@
<com.android.systemui.statusbar.phone.NavigationBarView
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_width="match_parent"
android:background="@drawable/system_bar_background"

View File

@@ -14,7 +14,7 @@
limitations under the License.
-->
<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:paddingRight="16dp"
style="@style/BrightnessDialogContainer">

View File

@@ -18,7 +18,7 @@
<!-- Extends RelativeLayout -->
<com.android.systemui.statusbar.phone.StatusBarHeaderView
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:layout_width="@dimen/notification_panel_width"
android:layout_height="@dimen/status_bar_header_height"

View File

@@ -20,7 +20,7 @@
<com.android.systemui.recent.RecentsPanelView
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:layout_height="match_parent"
android:layout_width="match_parent"

View File

@@ -179,13 +179,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
public NetworkControllerImpl(Context context) {
this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_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();
}
@VisibleForTesting
NetworkControllerImpl(Context context, ConnectivityManager connectivityManager,
TelephonyManager telephonyManager, WifiManager wifiManager) {
TelephonyManager telephonyManager, WifiManager wifiManager,
AccessPointController accessPointController,
MobileDataController mobileDataController) {
mContext = context;
final Resources res = context.getResources();
@@ -224,8 +227,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
updateAirplaneMode();
mLastLocale = mContext.getResources().getConfiguration().locale;
mAccessPoints = new AccessPointController(mContext);
mMobileDataController = new MobileDataController(mContext);
mAccessPoints = accessPointController;
mMobileDataController = mobileDataController;
mMobileDataController.setCallback(new MobileDataController.Callback() {
@Override
public void onMobileDataEnabled(boolean enabled) {

View File

@@ -17,14 +17,20 @@ include $(CLEAR_VARS)
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_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
# UI it doesn't own. This is necessary to allow screenshots to be taken

View File

@@ -25,7 +25,7 @@
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.systemui"
android:targetPackage="com.android.systemui.tests"
android:label="Tests for SystemUI">
</instrumentation>
</manifest>

View File

@@ -0,0 +1 @@
../../../../../src/com/android/systemui/EventLogTags.logtags

View File

@@ -15,7 +15,7 @@
*/
package com.android.systemui.screenshot;
import com.android.systemui.tests.R;
import com.android.systemui.R;
import android.app.Activity;
import android.os.Bundle;

View File

@@ -62,7 +62,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
mSignalCluster = mock(SignalCluster.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();
}

View File

@@ -1,5 +1,7 @@
package com.android.systemui.statusbar.policy;
import static org.mockito.Mockito.mock;
import android.net.ConnectivityManager;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -15,7 +17,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// 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();
verifyLastMobileDataIndicators(false, 0, 0);