summaryrefslogtreecommitdiffstats
path: root/tests/DataIdleTest
diff options
context:
space:
mode:
authorTsu Chiang Chuang <tsu@google.com>2011-09-11 12:26:29 -0700
committerTsu Chiang Chuang <tsu@google.com>2011-09-11 12:26:29 -0700
commita14d20f60cd41f1b71e8a228a6e9ac002a1dfb74 (patch)
treed9d5c321285533a4d3aa4634209226db019fdfd4 /tests/DataIdleTest
parent3ae29d455866ce358b42617134610415c04e0d53 (diff)
downloadframeworks_base-a14d20f60cd41f1b71e8a228a6e9ac002a1dfb74.zip
frameworks_base-a14d20f60cd41f1b71e8a228a6e9ac002a1dfb74.tar.gz
frameworks_base-a14d20f60cd41f1b71e8a228a6e9ac002a1dfb74.tar.bz2
aggregating test results when reporting to instrumentation out.
Change-Id: Ic652f893d7cfd469a912bd71a094f337166a6aa5
Diffstat (limited to 'tests/DataIdleTest')
-rw-r--r--tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
index 637f0d2..54adc249 100644
--- a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
+++ b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
@@ -76,7 +76,7 @@ public class DataIdleTest extends InstrumentationTestCase {
Long.MAX_VALUE, false);
reportStats(stats);
} catch (RemoteException e) {
- Log.w(LOG_TAG, "Failed to fetch network stats for wifi.");
+ Log.w(LOG_TAG, "Failed to fetch network stats.");
}
}
@@ -85,16 +85,22 @@ public class DataIdleTest extends InstrumentationTestCase {
* @param stats {@link NetworkorStats} to print
*/
void reportStats(NetworkStats stats) {
+ Bundle result = new Bundle();
+ long rxBytes = 0;
+ long txBytes = 0;
for (int i = 0; i < stats.size(); ++i) {
+ // Label will be iface_uid_tag_set
Entry statsEntry = stats.getValues(i, null);
- Bundle result = new Bundle();
- result.putInt("uid", statsEntry.uid);
- result.putInt("tag", statsEntry.tag);
- result.putInt("set", statsEntry.set);
- result.putString("iface", statsEntry.iface);
- result.putLong("rxBytes", statsEntry.rxBytes);
- result.putLong("txBytes", statsEntry.txBytes);
- getInstrumentation().sendStatus(INSTRUMENTATION_IN_PROGRESS, result);
+ String labelTemplate = String.format("%s_%d_%d_%d", statsEntry.iface, statsEntry.uid,
+ statsEntry.tag, statsEntry.set) + "_%s";
+ result.putLong(String.format(labelTemplate, "rxBytes"), statsEntry.rxBytes);
+ result.putLong(String.format(labelTemplate, "txBytes"), statsEntry.txBytes);
+ rxBytes += statsEntry.rxBytes;
+ txBytes += statsEntry.txBytes;
}
+ result.putLong("Total rxBytes", rxBytes);
+ result.putLong("Total txBytes", txBytes);
+ getInstrumentation().sendStatus(INSTRUMENTATION_IN_PROGRESS, result);
+
}
}