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

Commit f43ec7e5 authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Fixed check for empty title."

parents a31c591f c8e2b609
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -786,7 +786,8 @@ public class BugreportProgressService extends Service {
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setType(mimeType);
        intent.setType(mimeType);


        final String subject = info.title != null ? info.title : bugreportUri.getLastPathSegment();
        final String subject = !TextUtils.isEmpty(info.title) ?
                info.title : bugreportUri.getLastPathSegment();
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);


        // EXTRA_TEXT should be an ArrayList, but some clients are expecting a single String.
        // EXTRA_TEXT should be an ArrayList, but some clients are expecting a single String.
+28 −9
Original line number Original line Diff line number Diff line
@@ -114,6 +114,8 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
    private static final String NO_SCREENSHOT = null;
    private static final String NO_SCREENSHOT = null;
    private static final String NO_TITLE = null;
    private static final String NO_TITLE = null;
    private static final Integer NO_PID = null;
    private static final Integer NO_PID = null;
    private static final boolean RENAMED_SCREENSHOTS = true;
    private static final boolean DIDNT_RENAME_SCREENSHOTS = false;


    private String mDescription;
    private String mDescription;


@@ -171,7 +173,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
        Bundle extras =
        Bundle extras =
                sendBugreportFinishedAndGetSharedIntent(PID, mPlainTextPath, mScreenshotPath);
                sendBugreportFinishedAndGetSharedIntent(PID, mPlainTextPath, mScreenshotPath);
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, ZIP_FILE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, ZIP_FILE,
                NAME, NO_TITLE, NO_DESCRIPTION, 1, true);
                NAME, NO_TITLE, NO_DESCRIPTION, 1, RENAMED_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }
@@ -202,7 +204,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {


        Bundle extras = acceptBugreportAndGetSharedIntent();
        Bundle extras = acceptBugreportAndGetSharedIntent();
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, ZIP_FILE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, ZIP_FILE,
                NAME, NO_TITLE, NO_DESCRIPTION, 2, true);
                NAME, NO_TITLE, NO_DESCRIPTION, 2, RENAMED_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }
@@ -231,13 +233,12 @@ public class BugreportReceiverTest extends InstrumentationTestCase {


        Bundle extras = acceptBugreportAndGetSharedIntent();
        Bundle extras = acceptBugreportAndGetSharedIntent();
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, NO_SCREENSHOT, PID, ZIP_FILE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, NO_SCREENSHOT, PID, ZIP_FILE,
                NAME, NO_TITLE, NO_DESCRIPTION, 1, true);
                NAME, NO_TITLE, NO_DESCRIPTION, 1, RENAMED_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }


    public void testProgress_changeDetailsInvalidInput() throws Exception {
    public void testProgress_changeDetailsInvalidInput() throws Exception {

        resetProperties();
        resetProperties();
        sendBugreportStarted(1000);
        sendBugreportStarted(1000);
        waitForScreenshotButtonEnabled(true);
        waitForScreenshotButtonEnabled(true);
@@ -277,7 +278,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
        Bundle extras = sendBugreportFinishedAndGetSharedIntent(PID, mPlainTextPath,
        Bundle extras = sendBugreportFinishedAndGetSharedIntent(PID, mPlainTextPath,
                mScreenshotPath);
                mScreenshotPath);
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
                NEW_NAME, TITLE, mDescription, 1, true);
                NEW_NAME, TITLE, mDescription, 1, RENAMED_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }
@@ -291,7 +292,6 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
    }
    }


    public void changeDetailsTest(boolean plainText) throws Exception {
    public void changeDetailsTest(boolean plainText) throws Exception {

        resetProperties();
        resetProperties();
        sendBugreportStarted(1000);
        sendBugreportStarted(1000);
        waitForScreenshotButtonEnabled(true);
        waitForScreenshotButtonEnabled(true);
@@ -316,7 +316,26 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
        Bundle extras = sendBugreportFinishedAndGetSharedIntent(PID,
        Bundle extras = sendBugreportFinishedAndGetSharedIntent(PID,
                plainText? mPlainTextPath : mZipPath, mScreenshotPath);
                plainText? mPlainTextPath : mZipPath, mScreenshotPath);
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
                NEW_NAME, TITLE, mDescription, 1, true);
                NEW_NAME, TITLE, mDescription, 1, RENAMED_SCREENSHOTS);

        assertServiceNotRunning();
    }

    public void testProgress_changeJustDetails() throws Exception {
        resetProperties();
        sendBugreportStarted(1000);
        waitForScreenshotButtonEnabled(true);

        DetailsUi detailsUi = new DetailsUi(mUiBot);

        detailsUi.nameField.setText("");
        detailsUi.titleField.setText("");
        detailsUi.descField.setText(mDescription);
        detailsUi.clickOk();

        Bundle extras = sendBugreportFinishedAndGetSharedIntent(PID, mZipPath, mScreenshotPath);
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, ZIP_FILE,
                NO_NAME, NO_TITLE, mDescription, 1, DIDNT_RENAME_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }
@@ -367,7 +386,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
        // Finally, share bugreport.
        // Finally, share bugreport.
        Bundle extras = acceptBugreportAndGetSharedIntent();
        Bundle extras = acceptBugreportAndGetSharedIntent();
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, PID, TITLE,
                NAME, TITLE, mDescription, 1, true);
                NAME, TITLE, mDescription, 1, RENAMED_SCREENSHOTS);


        assertServiceNotRunning();
        assertServiceNotRunning();
    }
    }
@@ -539,7 +558,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
    private void assertActionSendMultiple(Bundle extras, String bugreportContent,
    private void assertActionSendMultiple(Bundle extras, String bugreportContent,
            String screenshotContent) throws IOException {
            String screenshotContent) throws IOException {
        assertActionSendMultiple(extras, bugreportContent, screenshotContent, PID, ZIP_FILE,
        assertActionSendMultiple(extras, bugreportContent, screenshotContent, PID, ZIP_FILE,
                NO_NAME, NO_TITLE, NO_DESCRIPTION, 0, false);
                NO_NAME, NO_TITLE, NO_DESCRIPTION, 0, DIDNT_RENAME_SCREENSHOTS);
    }
    }


    /**
    /**