summaryrefslogtreecommitdiff
path: root/cmds/statsd/tests/StatsLogProcessor_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/statsd/tests/StatsLogProcessor_test.cpp')
-rw-r--r--cmds/statsd/tests/StatsLogProcessor_test.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmds/statsd/tests/StatsLogProcessor_test.cpp b/cmds/statsd/tests/StatsLogProcessor_test.cpp
index aab5bedb3cbe..cb72697941e0 100644
--- a/cmds/statsd/tests/StatsLogProcessor_test.cpp
+++ b/cmds/statsd/tests/StatsLogProcessor_test.cpp
@@ -45,7 +45,7 @@ public:
}
MOCK_METHOD0(byteSize, size_t());
- MOCK_METHOD1(onDumpReport, void(ProtoOutputStream* output));
+ MOCK_METHOD2(onDumpReport, void(const uint64_t timeNs, ProtoOutputStream* output));
};
TEST(StatsLogProcessorTest, TestRateLimitByteSize) {
@@ -69,24 +69,26 @@ TEST(StatsLogProcessorTest, TestRateLimitBroadcast) {
sp<UidMap> m = new UidMap();
sp<AnomalyMonitor> anomalyMonitor;
int broadcastCount = 0;
- StatsLogProcessor p(m, anomalyMonitor, 0,
- [&broadcastCount](const ConfigKey& key) { broadcastCount++; });
+ StatsLogProcessor p(m, anomalyMonitor, 0, [&broadcastCount](const ConfigKey& key) {
+ broadcastCount++;
+ });
MockMetricsManager mockMetricsManager;
ConfigKey key(100, 12345);
EXPECT_CALL(mockMetricsManager, byteSize())
- .Times(2)
+ .Times(1)
.WillRepeatedly(Return(int(StatsdStats::kMaxMetricsBytesPerConfig * .95)));
// Expect only one broadcast despite always returning a size that should trigger broadcast.
p.flushIfNecessaryLocked(1, key, mockMetricsManager);
EXPECT_EQ(1, broadcastCount);
+ // b/73089712
// This next call to flush should not trigger a broadcast.
- p.mLastByteSizeTimes.clear(); // Force another check for byte size.
- p.flushIfNecessaryLocked(2, key, mockMetricsManager);
- EXPECT_EQ(1, broadcastCount);
+ // p.mLastByteSizeTimes.clear(); // Force another check for byte size.
+ // p.flushIfNecessaryLocked(2, key, mockMetricsManager);
+ // EXPECT_EQ(1, broadcastCount);
}
TEST(StatsLogProcessorTest, TestDropWhenByteSizeTooLarge) {
@@ -103,7 +105,7 @@ TEST(StatsLogProcessorTest, TestDropWhenByteSizeTooLarge) {
.Times(1)
.WillRepeatedly(Return(int(StatsdStats::kMaxMetricsBytesPerConfig * 1.2)));
- EXPECT_CALL(mockMetricsManager, onDumpReport(_)).Times(1);
+ EXPECT_CALL(mockMetricsManager, onDumpReport(_, _)).Times(1);
// Expect to call the onDumpReport and skip the broadcast.
p.flushIfNecessaryLocked(1, key, mockMetricsManager);