Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1e8995b authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Unbundled build fixes for tests

Build tests against current SDK. Use internal copy of LaunchPerformanceBase.
Use android-support-test instead of android.test.runner. Use reflection
to call AsyncTaskLoader.waitForLoader. Use public PhoneNumberUtil APIs.

Bug:23642167
Change-Id: I66841fe9429e374a931a5c6eada5afce932c5bef
(cherry picked from commit 2f8ebf44226b979a214b68189b832429aec04aed)
parent 6fa80392
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_CERTIFICATE := shared

LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test

src_dirs := src \
    ../../ContactsCommon/TestCommon/src
@@ -17,4 +17,6 @@ LOCAL_PACKAGE_NAME := ContactsTests

LOCAL_INSTRUMENTATION_FOR := Contacts

LOCAL_SDK_VERSION := current

include $(BUILD_PACKAGE)
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.test.LaunchPerformanceBase;

import com.android.contacts.common.test.LaunchPerformanceBase;

/**
 * Instrumentation class for Address Book launch performance testing.
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class TestLoaderManager extends TestLoaderManagerBase {
                @Override
                public void run() {
                    try {
                        loader.waitForLoader();
                        AsyncTaskLoader.class.getMethod("waitForLoader").invoke(loader, null);
                    } catch (Throwable e) {
                        Log.e(TAG, "Exception while waiting for loader: " + loader.getId(), e);
                        Assert.fail("Exception while waiting for loader: " + loader.getId());
+6 −9
Original line number Diff line number Diff line
@@ -19,14 +19,14 @@ package com.android.contacts.tests;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.location.CountryDetector;
import android.telephony.PhoneNumberUtils;
import android.util.Log;

import com.android.i18n.phonenumbers.NumberParseException;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.android.contacts.common.GeoUtil;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;

import java.util.LinkedHashSet;
import java.util.Set;
@@ -112,9 +112,6 @@ public class PhoneNumberTestService extends IntentService {
    }

    private String getCurrentCountryCode() {
        final CountryDetector countryDetector =
                (CountryDetector) getSystemService(Context.COUNTRY_DETECTOR);
        return countryDetector.detectCountry().getCountryIso();
        return GeoUtil.getCurrentCountryIso(getApplicationContext());
    }
}