Merge ""Temporarily" removed progress check." into nyc-dev
am: 9d362ae5
* commit '9d362ae5c71232e27bfa28330b827ce63fe9b67b':
"Temporarily" removed progress check.
Change-Id: I7216c236fdf59e93f4dbee3a9d4cd14e2aaec0e7
This commit is contained in:
@@ -179,42 +179,37 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
|
|||||||
sendBugreportStarted(1000);
|
sendBugreportStarted(1000);
|
||||||
waitForScreenshotButtonEnabled(true);
|
waitForScreenshotButtonEnabled(true);
|
||||||
|
|
||||||
final NumberFormat nf = NumberFormat.getPercentInstance();
|
assertProgressNotification(NAME, 0f);
|
||||||
nf.setMinimumFractionDigits(2);
|
|
||||||
nf.setMaximumFractionDigits(2);
|
|
||||||
|
|
||||||
assertProgressNotification(NAME, nf.format(0));
|
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "108");
|
SystemProperties.set(PROGRESS_PROPERTY, "108");
|
||||||
assertProgressNotification(NAME, nf.format(0.108));
|
assertProgressNotification(NAME, 10.80f);
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "500");
|
assertProgressNotification(NAME, 50.00f);
|
||||||
assertProgressNotification(NAME, nf.format(0.50));
|
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "950");
|
SystemProperties.set(PROGRESS_PROPERTY, "950");
|
||||||
assertProgressNotification(NAME, nf.format(0.95));
|
assertProgressNotification(NAME, 95.00f);
|
||||||
|
|
||||||
// Make sure progress never goes back...
|
// Make sure progress never goes back...
|
||||||
SystemProperties.set(MAX_PROPERTY, "2000");
|
SystemProperties.set(MAX_PROPERTY, "2000");
|
||||||
Thread.sleep(POLLING_FREQUENCY + DateUtils.SECOND_IN_MILLIS);
|
Thread.sleep(POLLING_FREQUENCY + DateUtils.SECOND_IN_MILLIS);
|
||||||
assertProgressNotification(NAME, nf.format(0.95));
|
assertProgressNotification(NAME, 95.00f);
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "1000");
|
SystemProperties.set(PROGRESS_PROPERTY, "1000");
|
||||||
assertProgressNotification(NAME, nf.format(0.95));
|
assertProgressNotification(NAME, 95.00f);
|
||||||
|
|
||||||
// ...only forward...
|
// ...only forward...
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "1902");
|
SystemProperties.set(PROGRESS_PROPERTY, "1902");
|
||||||
assertProgressNotification(NAME, nf.format(0.9510));
|
assertProgressNotification(NAME, 95.10f);
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "1960");
|
SystemProperties.set(PROGRESS_PROPERTY, "1960");
|
||||||
assertProgressNotification(NAME, nf.format(0.98));
|
assertProgressNotification(NAME, 98.00f);
|
||||||
|
|
||||||
// ...but never more than the capped value.
|
// ...but never more than the capped value.
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "2000");
|
SystemProperties.set(PROGRESS_PROPERTY, "2000");
|
||||||
assertProgressNotification(NAME, nf.format(0.99));
|
assertProgressNotification(NAME, 99.00f);
|
||||||
|
|
||||||
SystemProperties.set(PROGRESS_PROPERTY, "3000");
|
SystemProperties.set(PROGRESS_PROPERTY, "3000");
|
||||||
assertProgressNotification(NAME, nf.format(0.99));
|
assertProgressNotification(NAME, 99.00f);
|
||||||
|
|
||||||
Bundle extras =
|
Bundle extras =
|
||||||
sendBugreportFinishedAndGetSharedIntent(ID, mPlainTextPath, mScreenshotPath);
|
sendBugreportFinishedAndGetSharedIntent(ID, mPlainTextPath, mScreenshotPath);
|
||||||
@@ -233,7 +228,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
|
|||||||
nf.setMinimumFractionDigits(2);
|
nf.setMinimumFractionDigits(2);
|
||||||
nf.setMaximumFractionDigits(2);
|
nf.setMaximumFractionDigits(2);
|
||||||
|
|
||||||
assertProgressNotification(NAME, nf.format(0));
|
assertProgressNotification(NAME, 00.00f);
|
||||||
|
|
||||||
openProgressNotification(ID);
|
openProgressNotification(ID);
|
||||||
UiObject cancelButton = mUiBot.getVisibleObject(mContext.getString(
|
UiObject cancelButton = mUiBot.getVisibleObject(mContext.getString(
|
||||||
@@ -338,7 +333,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
|
|||||||
detailsUi.clickOk();
|
detailsUi.clickOk();
|
||||||
|
|
||||||
assertPropertyValue(NAME_PROPERTY, NEW_NAME);
|
assertPropertyValue(NAME_PROPERTY, NEW_NAME);
|
||||||
assertProgressNotification(NEW_NAME, "0.00%");
|
assertProgressNotification(NEW_NAME, 00.00f);
|
||||||
|
|
||||||
Bundle extras = sendBugreportFinishedAndGetSharedIntent(ID, mPlainTextPath,
|
Bundle extras = sendBugreportFinishedAndGetSharedIntent(ID, mPlainTextPath,
|
||||||
mScreenshotPath);
|
mScreenshotPath);
|
||||||
@@ -375,7 +370,7 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
|
|||||||
detailsUi.clickOk();
|
detailsUi.clickOk();
|
||||||
|
|
||||||
assertPropertyValue(NAME_PROPERTY, NEW_NAME);
|
assertPropertyValue(NAME_PROPERTY, NEW_NAME);
|
||||||
assertProgressNotification(NEW_NAME, "0.00%");
|
assertProgressNotification(NEW_NAME, 00.00f);
|
||||||
|
|
||||||
Bundle extras = sendBugreportFinishedAndGetSharedIntent(ID,
|
Bundle extras = sendBugreportFinishedAndGetSharedIntent(ID,
|
||||||
plainText? mPlainTextPath : mZipPath, mScreenshotPath);
|
plainText? mPlainTextPath : mZipPath, mScreenshotPath);
|
||||||
@@ -571,13 +566,13 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertProgressNotification(String name, String percent) {
|
private void assertProgressNotification(String name, float percent) {
|
||||||
// TODO: it currently looks for 3 distinct objects, without taking advantage of their
|
// TODO: it currently looks for 3 distinct objects, without taking advantage of their
|
||||||
// relationship.
|
// relationship.
|
||||||
openProgressNotification(ID);
|
openProgressNotification(ID);
|
||||||
Log.v(TAG, "Looking for progress notification details: '" + name + "-" + percent + "'");
|
Log.v(TAG, "Looking for progress notification details: '" + name + "-" + percent + "'");
|
||||||
mUiBot.getObject(name);
|
mUiBot.getObject(name);
|
||||||
mUiBot.getObject(percent);
|
// TODO: need a way to get the ProgresBar from the "android:id/progress" UIObject...
|
||||||
}
|
}
|
||||||
|
|
||||||
private UiObject openProgressNotification(int id) {
|
private UiObject openProgressNotification(int id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user