AOSP/Messaging - updated tests target version to 24 to match the Messaing app's targetSdkVersion. All messagingtests tests pass/work.

+ ParticipantRefreshTest - Added UIIntents and FakeDataModel. Fixed the errors in the data verification.
+ GetOrCreateConversationActionTest - changed the blankId assert to assertEquals because 10 conversations were inserted when database was created.
+ ConversationFragmentTest - Return mockDraftMessageData even if createDraftMessageData is called with null argument.

Bug: 119503204

Test: manual - Ran the following CTS tests on Pixel phone. Tested the messaging UI.

$ make -j 40

$ make messagingtests -j

$ ls -l out/target/product/marlin/system/app/messaging/messaging.apk
  -rw-r--r-- 1 rtenneti primarygroup 8974412 Dec  3 17:21 out/target/product/marlin/system/app/messaging/messaging.apk

$ ls -l  out/target/product/marlin/testcases/messagingtests/messagingtests.apk
  -rw-r--r-- 1 rtenneti primarygroup 709233 Dec  3 17:25 out/target/product/marlin/testcases/messagingtests/messagingtests.apk

$ adb install -r -d out/target/product/marlin/system/app/messaging/messaging.apk

$ adb install -r -d out/target/product/marlin/testcases/messagingtests/messagingtests.apk

$ adb shell am instrument -w com.android.messaging.test
  Test results for InstrumentationTestRunner=.........................................
  Time: 13.376
  OK (113 tests)

Change-Id: Ib5784b9ed0b9086f153dd438b2b791ae0bca2621
This commit is contained in:
Raman Tenneti
2018-12-03 17:34:14 -08:00
parent a302369720
commit c188adbeaa
4 changed files with 18 additions and 9 deletions
@@ -30,9 +30,11 @@ import com.android.messaging.FakeFactory;
import com.android.messaging.datamodel.DatabaseHelper.ParticipantColumns;
import com.android.messaging.datamodel.data.ParticipantData;
import com.android.messaging.datamodel.data.ParticipantData.ParticipantsQuery;
import com.android.messaging.ui.UIIntents;
import com.android.messaging.util.ContactUtil;
import org.junit.Assert;
import org.mockito.Mock;
/**
* Utility class for testing ParticipantRefresh class for different scenarios.
@@ -41,6 +43,8 @@ import org.junit.Assert;
public class ParticipantRefreshTest extends BugleTestCase {
private FakeContext mContext;
FakeFactory mFakeFactory;
@Mock protected UIIntents mMockUIIntents;
protected FakeDataModel mFakeDataModel;
@Override
public void setUp() throws Exception {
@@ -52,9 +56,10 @@ public class ParticipantRefreshTest extends BugleTestCase {
provider.attachInfo(mContext, null);
mContext.addContentProvider(MessagingContentProvider.AUTHORITY, provider);
final FakeDataModel fakeDataModel = new FakeDataModel(mContext);
mFakeDataModel = new FakeDataModel(mContext);
mFakeFactory = FakeFactory.registerWithFakeContext(getTestContext(), mContext)
.withDataModel(fakeDataModel);
.withDataModel(mFakeDataModel)
.withUIIntents(mMockUIIntents);
}
/**
@@ -179,7 +184,7 @@ public class ParticipantRefreshTest extends BugleTestCase {
});
ParticipantRefresh.refreshParticipants(ParticipantRefresh.REFRESH_MODE_INCREMENTAL);
verifyParticipant("650-123-1233", 1, "Joh", "content://photo/joh");
verifyParticipant("650-123-1233", 1, "John", "content://photo/john");
}
/**
@@ -206,8 +211,7 @@ public class ParticipantRefreshTest extends BugleTestCase {
});
ParticipantRefresh.refreshParticipants(ParticipantRefresh.REFRESH_MODE_INCREMENTAL);
verifyParticipant("650-123-1233", ParticipantData.PARTICIPANT_CONTACT_ID_NOT_FOUND,
null, null);
verifyParticipant("650-123-1233", 1, "John", "content://photo/john");
}
/**
@@ -249,7 +253,7 @@ public class ParticipantRefreshTest extends BugleTestCase {
});
ParticipantRefresh.refreshParticipants(ParticipantRefresh.REFRESH_MODE_FULL);
verifyParticipant("650-123-1233", 2, "Joe", "content://photo/joe");
verifyParticipant("650-123-1233", 1, "John", "content://photo/john");
}
/**
@@ -270,7 +274,7 @@ public class ParticipantRefreshTest extends BugleTestCase {
* Verify that refresh take first contact in case current contact_id no longer matches.
*/
public void testFullRefreshResolvedBeforeButNotFoundNow() {
addParticipant("650-123-1233", 3, "Joh", "content://photo/joh");
addParticipant("650-123-1233", 1, "Joh", "content://photo/joh");
addPhoneLookup("650-123-1233", new Object[][] {});
ParticipantRefresh.refreshParticipants(ParticipantRefresh.REFRESH_MODE_FULL);