summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2017-06-29 13:26:35 -0700
committerEtan Cohen <etancohen@google.com>2017-06-30 17:00:28 -0700
commit7a44d3fab050e1aca22317a604a68016c79f5925 (patch)
tree4dd9811d5dd141dcbc4b8d955738257a9a8147d9 /tests
parentdca9963c7292e17318f5ba0dee6c3683c7c9f941 (diff)
[AWARE] Add metrics for data-path session duration
NPD (NAN data-path) session duration metrics: measured from a successful completion (confirm) to termination notification. Bug: 26565416 Test: unit tests passing Change-Id: I30d7a8417789789662e9252fcafbd626a9377d23
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java10
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
index 8d70f97e3..0ddf765d7 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
@@ -712,7 +712,9 @@ public class WifiAwareDataPathStateManagerTest {
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).endDataPath(transactionId.capture(), eq(ndpId));
mDut.onEndDataPathResponse(transactionId.getValue(), true, 0);
+ mDut.onDataPathEndNotification(ndpId);
mMockLooper.dispatchAll();
+ inOrderM.verify(mAwareMetricsMock).recordNdpSessionDuration(anyLong());
}
verifyNoMoreInteractions(mMockNative, mMockCm, mAwareMetricsMock);
@@ -809,7 +811,9 @@ public class WifiAwareDataPathStateManagerTest {
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).endDataPath(transactionId.capture(), eq(ndpId));
mDut.onEndDataPathResponse(transactionId.getValue(), true, 0);
+ mDut.onDataPathEndNotification(ndpId);
mMockLooper.dispatchAll();
+ inOrderM.verify(mAwareMetricsMock).recordNdpSessionDuration(anyLong());
}
verifyNoMoreInteractions(mMockNative, mMockCm, mAwareMetricsMock);
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
index 10db1a7b3..8cd1e1097 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
@@ -425,6 +425,13 @@ public class WifiAwareMetricsTest {
mDut.recordNdpStatus(NanStatusType.INTERNAL_FAILURE, false, 0);
mDut.recordNdpStatus(NanStatusType.NO_RESOURCES_AVAILABLE, false, 0);
+ // and some durations
+ setTime(150);
+ mDut.recordNdpSessionDuration(7); // 143ms
+ mDut.recordNdpSessionDuration(10); // 140ms
+ mDut.recordNdpSessionDuration(25); // 125ms
+ mDut.recordNdpSessionDuration(140); // 10ms
+
//verify
log = mDut.consolidateProto();
@@ -453,6 +460,9 @@ public class WifiAwareMetricsTest {
validateProtoHistBucket("Creation[1]", log.histogramNdpCreationTimeMs[1], 2, 3, 1);
validateProtoHistBucket("Creation[2]", log.histogramNdpCreationTimeMs[2], 3, 4, 1);
validateProtoHistBucket("Creation[3]", log.histogramNdpCreationTimeMs[3], 10, 20, 2);
+
+ validateProtoHistBucket("Duration[0]", log.histogramNdpSessionDurationMs[0], 10, 20, 1);
+ validateProtoHistBucket("Duration[1]", log.histogramNdpSessionDurationMs[1], 100, 200, 3);
}
/**