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

Commit a074d8c5 authored by Roozbeh Pournader's avatar Roozbeh Pournader Committed by Android (Google) Code Review
Browse files

Merge "Trying to fix flaky tests related to testCharSequence*"

parents e2950d17 c38d390c
Loading
Loading
Loading
Loading
+40 −19
Original line number Diff line number Diff line
@@ -363,14 +363,23 @@ public class TextUtilsTest {
    @Test
    public void testCharSequenceCreator() {
        Parcel p = Parcel.obtain();
        CharSequence text;
        try {
            TextUtils.writeToParcel(null, p, 0);
        CharSequence text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            assertNull("null CharSequence should generate null from parcel", text);
        } finally {
            p.recycle();
        }
        p = Parcel.obtain();
        try {
            TextUtils.writeToParcel("test", p, 0);
            p.setDataPosition(0);
            text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            assertEquals("conversion to/from parcel failed", "test", text);
        } finally {
            p.recycle();
        }
    }

    @Test
@@ -378,10 +387,14 @@ public class TextUtilsTest {
        Parcel p;
        CharSequence text;
        p = Parcel.obtain();
        try {
            TextUtils.writeToParcel(null, p, 0);
            p.setDataPosition(0);
            text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            assertNull("null CharSequence should generate null from parcel", text);
        } finally {
            p.recycle();
        }
    }

    @Test
@@ -389,10 +402,14 @@ public class TextUtilsTest {
        Parcel p;
        CharSequence text;
        p = Parcel.obtain();
        try {
            TextUtils.writeToParcel(new SpannableString("test"), p, 0);
            p.setDataPosition(0);
            text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            assertEquals("conversion to/from parcel failed", "test", text.toString());
        } finally {
            p.recycle();
        }
    }

    @Test
@@ -400,10 +417,14 @@ public class TextUtilsTest {
        Parcel p;
        CharSequence text;
        p = Parcel.obtain();
        try {
            TextUtils.writeToParcel("test", p, 0);
            p.setDataPosition(0);
            text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
            assertEquals("conversion to/from parcel failed", "test", text.toString());
        } finally {
            p.recycle();
        }
    }

    /**