diff options
-rw-r--r-- | cmds/statsd/src/external/StatsPullerManager.cpp | 81 | ||||
-rw-r--r-- | cmds/statsd/src/external/StatsPullerManager.h | 13 | ||||
-rw-r--r-- | cmds/statsd/tests/external/StatsPullerManager_test.cpp | 16 | ||||
-rw-r--r-- | cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp | 38 | ||||
-rw-r--r-- | cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp | 312 | ||||
-rw-r--r-- | cmds/statsd/tests/metrics/metrics_test_helper.h | 9 | ||||
-rw-r--r-- | cmds/statsd/tests/shell/ShellSubscriber_test.cpp | 4 |
7 files changed, 225 insertions, 248 deletions
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp index 8a9ec7456e55..46c377037542 100644 --- a/cmds/statsd/src/external/StatsPullerManager.cpp +++ b/cmds/statsd/src/external/StatsPullerManager.cpp @@ -92,63 +92,43 @@ StatsPullerManager::StatsPullerManager() } bool StatsPullerManager::Pull(int tagId, const ConfigKey& configKey, const int64_t eventTimeNs, - vector<shared_ptr<LogEvent>>* data, bool useUids) { + vector<shared_ptr<LogEvent>>* data) { std::lock_guard<std::mutex> _l(mLock); - return PullLocked(tagId, configKey, eventTimeNs, data, useUids); + return PullLocked(tagId, configKey, eventTimeNs, data); } bool StatsPullerManager::Pull(int tagId, const vector<int32_t>& uids, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids) { + vector<std::shared_ptr<LogEvent>>* data) { std::lock_guard<std::mutex> _l(mLock); - return PullLocked(tagId, uids, eventTimeNs, data, useUids); + return PullLocked(tagId, uids, eventTimeNs, data); } bool StatsPullerManager::PullLocked(int tagId, const ConfigKey& configKey, - const int64_t eventTimeNs, vector<shared_ptr<LogEvent>>* data, - bool useUids) { + const int64_t eventTimeNs, vector<shared_ptr<LogEvent>>* data) { vector<int32_t> uids; - if (useUids) { - auto uidProviderIt = mPullUidProviders.find(configKey); - if (uidProviderIt == mPullUidProviders.end()) { - ALOGE("Error pulling tag %d. No pull uid provider for config key %s", tagId, - configKey.ToString().c_str()); - StatsdStats::getInstance().notePullUidProviderNotFound(tagId); - return false; - } - sp<PullUidProvider> pullUidProvider = uidProviderIt->second.promote(); - if (pullUidProvider == nullptr) { - ALOGE("Error pulling tag %d, pull uid provider for config %s is gone.", tagId, - configKey.ToString().c_str()); - StatsdStats::getInstance().notePullUidProviderNotFound(tagId); - return false; - } - uids = pullUidProvider->getPullAtomUids(tagId); + const auto& uidProviderIt = mPullUidProviders.find(configKey); + if (uidProviderIt == mPullUidProviders.end()) { + ALOGE("Error pulling tag %d. No pull uid provider for config key %s", tagId, + configKey.ToString().c_str()); + StatsdStats::getInstance().notePullUidProviderNotFound(tagId); + return false; } - return PullLocked(tagId, uids, eventTimeNs, data, useUids); + sp<PullUidProvider> pullUidProvider = uidProviderIt->second.promote(); + if (pullUidProvider == nullptr) { + ALOGE("Error pulling tag %d, pull uid provider for config %s is gone.", tagId, + configKey.ToString().c_str()); + StatsdStats::getInstance().notePullUidProviderNotFound(tagId); + return false; + } + uids = pullUidProvider->getPullAtomUids(tagId); + return PullLocked(tagId, uids, eventTimeNs, data); } bool StatsPullerManager::PullLocked(int tagId, const vector<int32_t>& uids, - const int64_t eventTimeNs, vector<shared_ptr<LogEvent>>* data, - bool useUids) { + const int64_t eventTimeNs, vector<shared_ptr<LogEvent>>* data) { VLOG("Initiating pulling %d", tagId); - if (useUids) { - for (int32_t uid : uids) { - PullerKey key = {.atomTag = tagId, .uid = uid}; - auto pullerIt = kAllPullAtomInfo.find(key); - if (pullerIt != kAllPullAtomInfo.end()) { - bool ret = pullerIt->second->Pull(eventTimeNs, data); - VLOG("pulled %zu items", data->size()); - if (!ret) { - StatsdStats::getInstance().notePullFailed(tagId); - } - return ret; - } - } - StatsdStats::getInstance().notePullerNotFound(tagId); - ALOGW("StatsPullerManager: Unknown tagId %d", tagId); - return false; // Return early since we don't know what to pull. - } else { - PullerKey key = {.atomTag = tagId, .uid = -1}; + for (int32_t uid : uids) { + PullerKey key = {.atomTag = tagId, .uid = uid}; auto pullerIt = kAllPullAtomInfo.find(key); if (pullerIt != kAllPullAtomInfo.end()) { bool ret = pullerIt->second->Pull(eventTimeNs, data); @@ -158,9 +138,10 @@ bool StatsPullerManager::PullLocked(int tagId, const vector<int32_t>& uids, } return ret; } - ALOGW("StatsPullerManager: Unknown tagId %d", tagId); - return false; // Return early since we don't know what to pull. } + StatsdStats::getInstance().notePullerNotFound(tagId); + ALOGW("StatsPullerManager: Unknown tagId %d", tagId); + return false; // Return early since we don't know what to pull. } bool StatsPullerManager::PullerForMatcherExists(int tagId) const { @@ -352,8 +333,7 @@ int StatsPullerManager::ClearPullerCacheIfNecessary(int64_t timestampNs) { void StatsPullerManager::RegisterPullAtomCallback(const int uid, const int32_t atomTag, const int64_t coolDownNs, const int64_t timeoutNs, const vector<int32_t>& additiveFields, - const shared_ptr<IPullAtomCallback>& callback, - bool useUid) { + const shared_ptr<IPullAtomCallback>& callback) { std::lock_guard<std::mutex> _l(mLock); VLOG("RegisterPullerCallback: adding puller for tag %d", atomTag); @@ -368,16 +348,15 @@ void StatsPullerManager::RegisterPullAtomCallback(const int uid, const int32_t a sp<StatsCallbackPuller> puller = new StatsCallbackPuller(atomTag, callback, actualCoolDownNs, actualTimeoutNs, additiveFields); - PullerKey key = {.atomTag = atomTag, .uid = useUid ? uid : -1}; + PullerKey key = {.atomTag = atomTag, .uid = uid}; AIBinder_linkToDeath(callback->asBinder().get(), mPullAtomCallbackDeathRecipient.get(), new PullAtomCallbackDeathCookie(this, key, puller)); kAllPullAtomInfo[key] = puller; } -void StatsPullerManager::UnregisterPullAtomCallback(const int uid, const int32_t atomTag, - bool useUids) { +void StatsPullerManager::UnregisterPullAtomCallback(const int uid, const int32_t atomTag) { std::lock_guard<std::mutex> _l(mLock); - PullerKey key = {.atomTag = atomTag, .uid = useUids ? uid : -1}; + PullerKey key = {.atomTag = atomTag, .uid = uid}; if (kAllPullAtomInfo.find(key) != kAllPullAtomInfo.end()) { StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/false); diff --git a/cmds/statsd/src/external/StatsPullerManager.h b/cmds/statsd/src/external/StatsPullerManager.h index 194a0f5edba8..489cbdbe5400 100644 --- a/cmds/statsd/src/external/StatsPullerManager.h +++ b/cmds/statsd/src/external/StatsPullerManager.h @@ -102,11 +102,11 @@ public: // If the metric wants to make any change to the data, like timestamps, they // should make a copy as this data may be shared with multiple metrics. virtual bool Pull(int tagId, const ConfigKey& configKey, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids = true); + vector<std::shared_ptr<LogEvent>>* data); // Same as above, but directly specify the allowed uids to pull from. virtual bool Pull(int tagId, const vector<int32_t>& uids, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids = true); + vector<std::shared_ptr<LogEvent>>* data); // Clear pull data cache immediately. int ForceClearPullerCache(); @@ -118,10 +118,9 @@ public: void RegisterPullAtomCallback(const int uid, const int32_t atomTag, const int64_t coolDownNs, const int64_t timeoutNs, const vector<int32_t>& additiveFields, - const shared_ptr<IPullAtomCallback>& callback, - bool useUid = true); + const shared_ptr<IPullAtomCallback>& callback); - void UnregisterPullAtomCallback(const int uid, const int32_t atomTag, bool useUids = true); + void UnregisterPullAtomCallback(const int uid, const int32_t atomTag); std::map<const PullerKey, sp<StatsPuller>> kAllPullAtomInfo; @@ -153,10 +152,10 @@ private: std::map<ConfigKey, wp<PullUidProvider>> mPullUidProviders; bool PullLocked(int tagId, const ConfigKey& configKey, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids = true); + vector<std::shared_ptr<LogEvent>>* data); bool PullLocked(int tagId, const vector<int32_t>& uids, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids); + vector<std::shared_ptr<LogEvent>>* data); // locks for data receiver and StatsCompanionService changes std::mutex mLock; diff --git a/cmds/statsd/tests/external/StatsPullerManager_test.cpp b/cmds/statsd/tests/external/StatsPullerManager_test.cpp index c76e85ec75e6..0d539f477016 100644 --- a/cmds/statsd/tests/external/StatsPullerManager_test.cpp +++ b/cmds/statsd/tests/external/StatsPullerManager_test.cpp @@ -89,10 +89,10 @@ public: sp<StatsPullerManager> createPullerManagerAndRegister() { sp<StatsPullerManager> pullerManager = new StatsPullerManager(); shared_ptr<FakePullAtomCallback> cb1 = SharedRefBase::make<FakePullAtomCallback>(uid1); - pullerManager->RegisterPullAtomCallback(uid1, pullTagId1, coolDownNs, timeoutNs, {}, cb1, true); + pullerManager->RegisterPullAtomCallback(uid1, pullTagId1, coolDownNs, timeoutNs, {}, cb1); shared_ptr<FakePullAtomCallback> cb2 = SharedRefBase::make<FakePullAtomCallback>(uid2); - pullerManager->RegisterPullAtomCallback(uid2, pullTagId1, coolDownNs, timeoutNs, {}, cb2, true); - pullerManager->RegisterPullAtomCallback(uid1, pullTagId2, coolDownNs, timeoutNs, {}, cb1, true); + pullerManager->RegisterPullAtomCallback(uid2, pullTagId1, coolDownNs, timeoutNs, {}, cb2); + pullerManager->RegisterPullAtomCallback(uid1, pullTagId2, coolDownNs, timeoutNs, {}, cb1); return pullerManager; } } // anonymous namespace @@ -101,14 +101,14 @@ TEST(StatsPullerManagerTest, TestPullInvalidUid) { sp<StatsPullerManager> pullerManager = createPullerManagerAndRegister(); vector<shared_ptr<LogEvent>> data; - EXPECT_FALSE(pullerManager->Pull(pullTagId1, {unregisteredUid}, /*timestamp =*/1, &data, true)); + EXPECT_FALSE(pullerManager->Pull(pullTagId1, {unregisteredUid}, /*timestamp =*/1, &data)); } TEST(StatsPullerManagerTest, TestPullChoosesCorrectUid) { sp<StatsPullerManager> pullerManager = createPullerManagerAndRegister(); vector<shared_ptr<LogEvent>> data; - EXPECT_TRUE(pullerManager->Pull(pullTagId1, {uid1}, /*timestamp =*/1, &data, true)); + EXPECT_TRUE(pullerManager->Pull(pullTagId1, {uid1}, /*timestamp =*/1, &data)); ASSERT_EQ(data.size(), 1); EXPECT_EQ(data[0]->GetTagId(), pullTagId1); ASSERT_EQ(data[0]->getValues().size(), 1); @@ -121,7 +121,7 @@ TEST(StatsPullerManagerTest, TestPullInvalidConfigKey) { pullerManager->RegisterPullUidProvider(configKey, uidProvider); vector<shared_ptr<LogEvent>> data; - EXPECT_FALSE(pullerManager->Pull(pullTagId1, badConfigKey, /*timestamp =*/1, &data, true)); + EXPECT_FALSE(pullerManager->Pull(pullTagId1, badConfigKey, /*timestamp =*/1, &data)); } TEST(StatsPullerManagerTest, TestPullConfigKeyGood) { @@ -130,7 +130,7 @@ TEST(StatsPullerManagerTest, TestPullConfigKeyGood) { pullerManager->RegisterPullUidProvider(configKey, uidProvider); vector<shared_ptr<LogEvent>> data; - EXPECT_TRUE(pullerManager->Pull(pullTagId1, configKey, /*timestamp =*/1, &data, true)); + EXPECT_TRUE(pullerManager->Pull(pullTagId1, configKey, /*timestamp =*/1, &data)); EXPECT_EQ(data[0]->GetTagId(), pullTagId1); ASSERT_EQ(data[0]->getValues().size(), 1); EXPECT_EQ(data[0]->getValues()[0].mValue.int_value, uid2); @@ -142,7 +142,7 @@ TEST(StatsPullerManagerTest, TestPullConfigKeyNoPullerWithUid) { pullerManager->RegisterPullUidProvider(configKey, uidProvider); vector<shared_ptr<LogEvent>> data; - EXPECT_FALSE(pullerManager->Pull(pullTagId2, configKey, /*timestamp =*/1, &data, true)); + EXPECT_FALSE(pullerManager->Pull(pullTagId2, configKey, /*timestamp =*/1, &data)); } } // namespace statsd diff --git a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp index 5997bedcdf2d..caea42dfe032 100644 --- a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp +++ b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp @@ -137,9 +137,9 @@ TEST(GaugeMetricProducerTest, TestPulledEventsNoCondition) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(makeLogEvent(tagId, eventTimeNs + 10, 3, "some value", 11)); @@ -310,10 +310,10 @@ TEST_P(GaugeMetricProducerTest_PartialBucket, TestPulled) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Return(false)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, partialBucketSplitTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, eventTimeNs, 2)); @@ -388,7 +388,7 @@ TEST(GaugeMetricProducerTest, TestPulledWithAppUpgradeDisabled) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(false)); GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, {}, @@ -440,9 +440,9 @@ TEST(GaugeMetricProducerTest, TestPulledEventsWithCondition) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, conditionChangeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, conditionChangeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, eventTimeNs + 10, 100)); return true; @@ -527,9 +527,9 @@ TEST(GaugeMetricProducerTest, TestPulledEventsWithSlicedCondition) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, sliceConditionChangeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, sliceConditionChangeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, eventTimeNs + 10, 1000, 100)); return true; @@ -566,7 +566,7 @@ TEST(GaugeMetricProducerTest, TestPulledEventsAnomalyDetection) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(false)); GaugeMetric metric; @@ -665,16 +665,16 @@ TEST(GaugeMetricProducerTest, TestPullOnTrigger) { atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)}); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, eventTimeNs, 4)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 20); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, eventTimeNs, 5)); @@ -737,23 +737,23 @@ TEST(GaugeMetricProducerTest, TestRemoveDimensionInOutput) { atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)}); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 3); data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, eventTimeNs, 3, 4)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, eventTimeNs, 4, 5)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 20); data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, eventTimeNs, 4, 6)); @@ -815,10 +815,10 @@ TEST(GaugeMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) { atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)}); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 3, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 3, _)) // Bucket start. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, eventTimeNs, 10)); return true; diff --git a/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp b/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp index 5666501d7d51..97757afaf226 100644 --- a/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp +++ b/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp @@ -294,9 +294,9 @@ TEST(ValueMetricProducerTest, TestFirstBucket) { TEST(ValueMetricProducerTest, TestPulledEventsNoCondition) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); return true; @@ -368,19 +368,19 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestPartialBucketCreated) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); int64_t partialBucketSplitTimeNs = bucket2StartTimeNs + 2; - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Initialize bucket. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, 1)); return true; })) // Partial bucket. - .WillOnce(Invoke([partialBucketSplitTimeNs]( - int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + .WillOnce(Invoke([partialBucketSplitTimeNs](int tagId, const ConfigKey&, + const int64_t eventTimeNs, + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, partialBucketSplitTimeNs); data->clear(); data->push_back( @@ -434,9 +434,9 @@ TEST(ValueMetricProducerTest, TestPulledEventsWithFiltering) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, bucketStartTimeNs, 3, 3)); return true; @@ -505,7 +505,7 @@ TEST(ValueMetricProducerTest, TestPulledEventsTakeAbsoluteValueOnReset) { metric.set_use_absolute_value_on_reset(true); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(true)); sp<ValueMetricProducer> valueProducer = ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric); @@ -565,7 +565,7 @@ TEST(ValueMetricProducerTest, TestPulledEventsTakeAbsoluteValueOnReset) { TEST(ValueMetricProducerTest, TestPulledEventsTakeZeroOnReset) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(false)); sp<ValueMetricProducer> valueProducer = ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric); @@ -621,23 +621,23 @@ TEST(ValueMetricProducerTest, TestEventsWithNonSlicedCondition) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); // First condition change. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 1); // Second condition change. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 1, 130)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket3StartTimeNs + 1); // Third condition change. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket3StartTimeNs + 1, 180)); @@ -770,11 +770,11 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestPulledValue) { int64_t partialBucketSplitTimeNs = bucket2StartTimeNs + 150; EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Return(true)) - .WillOnce(Invoke([partialBucketSplitTimeNs]( - int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + .WillOnce(Invoke([partialBucketSplitTimeNs](int tagId, const ConfigKey&, + const int64_t eventTimeNs, + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, partialBucketSplitTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, partialBucketSplitTimeNs, 120)); @@ -830,7 +830,7 @@ TEST(ValueMetricProducerTest, TestPulledWithAppUpgradeDisabled) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillOnce(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(true)); ValueMetricProducer valueProducer(kConfigKey, metric, -1, {}, wizard, logEventMatcherIndex, @@ -854,16 +854,16 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestPulledValueWhileConditionFalse ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 1); // Condition change to true time. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, 100)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs - 100); // Condition change to false time. data->clear(); @@ -1085,7 +1085,7 @@ TEST(ValueMetricProducerTest, TestAnomalyDetection) { TEST(ValueMetricProducerTest, TestBucketBoundaryNoCondition) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Return(true)); sp<ValueMetricProducer> valueProducer = ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric); @@ -1164,10 +1164,10 @@ TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // condition becomes true .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); // First condition change. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); @@ -1175,7 +1175,7 @@ TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition) { })) // condition becomes false .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 1); // Second condition change. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 1, 120)); @@ -1227,10 +1227,10 @@ TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition2) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // condition becomes true .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); @@ -1238,7 +1238,7 @@ TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition2) { })) // condition becomes false .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 1); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 1, 120)); @@ -1246,7 +1246,7 @@ TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition2) { })) // condition becomes true again .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 25); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 25, 130)); @@ -1677,9 +1677,9 @@ TEST(ValueMetricProducerTest, TestUseZeroDefaultBase) { metric.set_use_zero_default_base(true); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, bucketStartTimeNs, 1, 3)); return true; @@ -1753,9 +1753,9 @@ TEST(ValueMetricProducerTest, TestUseZeroDefaultBaseWithPullFailures) { metric.set_use_zero_default_base(true); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, bucketStartTimeNs, 1, 3)); return true; @@ -1858,9 +1858,9 @@ TEST(ValueMetricProducerTest, TestTrimUnusedDimensionKey) { metric.mutable_dimensions_in_what()->add_child()->set_field(1); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, bucketStartTimeNs, 1, 3)); return true; @@ -1961,9 +1961,9 @@ TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange_EndOfB sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); // Used by onConditionChanged. - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 8, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 8, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); return true; @@ -1995,9 +1995,9 @@ TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); // Condition change to true. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); @@ -2034,16 +2034,16 @@ TEST(ValueMetricProducerTest, TestResetBaseOnPullFailBeforeConditionChange) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 50)); return false; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 1); // Condition change to false. data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 100)); @@ -2077,9 +2077,9 @@ TEST(ValueMetricProducerTest, TestResetBaseOnPullDelayExceeded) { metric.set_max_pull_delay_sec(0); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 1, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 1, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, 120)); return true; @@ -2124,9 +2124,9 @@ TEST(ValueMetricProducerTest, TestBaseSetOnConditionChange) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 1, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 1, _)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, 100)); return true; @@ -2156,12 +2156,12 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenOneConditionFailed ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First onConditionChanged .WillOnce(Return(false)) // Second onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 3); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 130)); @@ -2233,10 +2233,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenGuardRailHit) { metric.set_condition(StringToId("SCREEN_ON")); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 2, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 2, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { for (int i = 0; i < 2000; i++) { data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, i)); } @@ -2290,10 +2290,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenInitialPullFailed) ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 2); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 120)); @@ -2301,7 +2301,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenInitialPullFailed) })) // Second onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 3); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 130)); @@ -2369,10 +2369,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenLastPullFailed) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 2); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 120)); @@ -2380,7 +2380,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenLastPullFailed) { })) // Second onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 3); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 8, 130)); @@ -2442,10 +2442,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenLastPullFailed) { TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onDataPulled) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) // Start bucket. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); return true; @@ -2475,17 +2475,17 @@ TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onConditionChanged) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); return true; @@ -2518,24 +2518,24 @@ TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onBucketBoundary) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 11); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 2)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 12); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 5)); @@ -2582,10 +2582,10 @@ TEST(ValueMetricProducerTest, TestPartialResetOnBucketBoundaries) { metric.set_condition(StringToId("SCREEN_ON")); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 10, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 10, _)) // First onConditionChanged .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); return true; @@ -2625,19 +2625,19 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestFullBucketResetWhenLastBucketI sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); int64_t partialBucketSplitTimeNs = bucketStartTimeNs + bucketSizeNs / 2; - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Initialization. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); return true; })) // notifyAppUpgrade. - .WillOnce(Invoke([partialBucketSplitTimeNs]( - int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + .WillOnce(Invoke([partialBucketSplitTimeNs](int tagId, const ConfigKey&, + const int64_t eventTimeNs, + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, partialBucketSplitTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, partialBucketSplitTimeNs, 10)); @@ -2681,10 +2681,10 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestFullBucketResetWhenLastBucketI TEST(ValueMetricProducerTest, TestBucketBoundariesOnConditionChange) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Second onConditionChanged. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 10, 5)); @@ -2692,7 +2692,7 @@ TEST(ValueMetricProducerTest, TestBucketBoundariesOnConditionChange) { })) // Third onConditionChanged. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket3StartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket3StartTimeNs + 10, 7)); @@ -2752,10 +2752,10 @@ TEST(ValueMetricProducerTest, TestLateOnDataPulledWithDiff) { ValueMetric metric = ValueMetricProducerTestHelper::createMetric(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) // Initialization. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); return true; @@ -2782,19 +2782,19 @@ TEST_P(ValueMetricProducerTest_PartialBucket, TestBucketBoundariesOnPartialBucke int64_t partialBucketSplitTimeNs = bucket2StartTimeNs + 2; sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Initialization. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); return true; })) // notifyAppUpgrade. - .WillOnce(Invoke([partialBucketSplitTimeNs]( - int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + .WillOnce(Invoke([partialBucketSplitTimeNs](int tagId, const ConfigKey&, + const int64_t eventTimeNs, + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, partialBucketSplitTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, partialBucketSplitTimeNs, 10)); @@ -2822,10 +2822,10 @@ TEST(ValueMetricProducerTest, TestDataIsNotUpdatedWhenNoConditionChanged) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First on condition changed. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); @@ -2833,7 +2833,7 @@ TEST(ValueMetricProducerTest, TestDataIsNotUpdatedWhenNoConditionChanged) { })) // Second on condition changed. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); @@ -2867,10 +2867,10 @@ TEST(ValueMetricProducerTest, TestBucketInvalidIfGlobalBaseIsNotSet) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First condition change. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 1)); @@ -2878,7 +2878,7 @@ TEST(ValueMetricProducerTest, TestBucketInvalidIfGlobalBaseIsNotSet) { })) // 2nd condition change. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 8); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs, 1)); @@ -2886,7 +2886,7 @@ TEST(ValueMetricProducerTest, TestBucketInvalidIfGlobalBaseIsNotSet) { })) // 3rd condition change. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs, 1)); @@ -2931,10 +2931,10 @@ TEST(ValueMetricProducerTest, TestPullNeededFastDump) { EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillRepeatedly(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) // Initial pull. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateThreeValueLogEvent(tagId, bucketStartTimeNs, tagId, 1, 1)); return true; @@ -2969,10 +2969,10 @@ TEST(ValueMetricProducerTest, TestFastDumpWithoutCurrentBucket) { EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillRepeatedly(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs, _)) // Initial pull. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateThreeValueLogEvent(tagId, bucketStartTimeNs, tagId, 1, 1)); return true; @@ -3013,17 +3013,17 @@ TEST(ValueMetricProducerTest, TestPullNeededNoTimeConstraints) { EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, kConfigKey, _, _, _)).WillOnce(Return()); EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, kConfigKey, _)).WillRepeatedly(Return()); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Initial pull. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateThreeValueLogEvent(tagId, bucketStartTimeNs, tagId, 1, 1)); return true; })) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back( @@ -3069,10 +3069,10 @@ TEST(ValueMetricProducerTest, TestPulledData_noDiff_withMultipleConditionChanges metric.set_use_diff(false); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // condition becomes true .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 30, 10)); @@ -3080,7 +3080,7 @@ TEST(ValueMetricProducerTest, TestPulledData_noDiff_withMultipleConditionChanges })) // condition becomes false .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 20)); @@ -3119,10 +3119,10 @@ TEST(ValueMetricProducerTest, TestPulledData_noDiff_bucketBoundaryTrue) { metric.set_use_diff(false); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 8, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 8, _)) // condition becomes true .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 30, 10)); return true; @@ -3170,10 +3170,10 @@ TEST(ValueMetricProducerTest, TestPulledData_noDiff_withFailure) { metric.set_use_diff(false); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // condition becomes true .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 8); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 30, 10)); @@ -3210,10 +3210,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenDumpReportRequeste ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 20, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 20, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 20, 10)); return true; @@ -3256,10 +3256,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionEventWron ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 50, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 50, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 10)); return true; @@ -3314,10 +3314,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenAccumulateEventWro ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 10)); @@ -3325,7 +3325,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenAccumulateEventWro })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 100); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket2StartTimeNs + 100, 15)); @@ -3380,10 +3380,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionUnknown) ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 10)); @@ -3391,7 +3391,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionUnknown) })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10000); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 100, 15)); @@ -3436,10 +3436,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenPullFailed) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 10)); @@ -3486,10 +3486,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenMultipleBucketsSki ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 10, 10)); @@ -3497,7 +3497,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenMultipleBucketsSki })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket4StartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucket4StartTimeNs + 1000, 15)); @@ -3560,10 +3560,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) { metric.set_min_bucket_size_nanos(10000000000); // 10 seconds sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 10, 10)); @@ -3571,7 +3571,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) { })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 9000000); data->clear(); data->push_back( @@ -3651,10 +3651,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestConditionUnknownMultipleBuckets) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 10 * NS_PER_SEC); data->clear(); data->push_back(CreateRepeatedValueLogEvent( @@ -3663,7 +3663,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestConditionUnknownMultipleBuckets) { })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 15 * NS_PER_SEC); data->clear(); data->push_back(CreateRepeatedValueLogEvent( @@ -3740,10 +3740,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenForceBucketSplitBefor ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 10, 10)); @@ -3751,7 +3751,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenForceBucketSplitBefor })) // App Update. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 1000); data->clear(); data->push_back( @@ -3806,10 +3806,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestMultipleBucketDropEvents) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 10, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, bucketStartTimeNs + 10, _)) // Condition change to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 10, 10)); return true; @@ -3857,10 +3857,10 @@ TEST(ValueMetricProducerTest_BucketDrop, TestMaxBucketDropEvents) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // First condition change event. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); for (int i = 0; i < 2000; i++) { data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 1, i)); @@ -3877,7 +3877,7 @@ TEST(ValueMetricProducerTest_BucketDrop, TestMaxBucketDropEvents) { .WillOnce(Return(false)) .WillOnce(Return(false)) .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 220); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 220, 10)); @@ -3976,10 +3976,10 @@ TEST(ValueMetricProducerTest, TestSlicedState) { // Set up ValueMetricProducer. ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE"); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // ValueMetricProducer initialized. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); @@ -3987,7 +3987,7 @@ TEST(ValueMetricProducerTest, TestSlicedState) { })) // Screen state change to ON. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 5); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 5, 5)); @@ -3995,7 +3995,7 @@ TEST(ValueMetricProducerTest, TestSlicedState) { })) // Screen state change to OFF. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 10); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 10, 9)); @@ -4003,7 +4003,7 @@ TEST(ValueMetricProducerTest, TestSlicedState) { })) // Screen state change to ON. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 15); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 15, 21)); @@ -4011,7 +4011,7 @@ TEST(ValueMetricProducerTest, TestSlicedState) { })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 30)); @@ -4178,10 +4178,10 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithMap) { // Set up ValueMetricProducer. ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE_ONOFF"); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // ValueMetricProducer initialized. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs, 3)); @@ -4189,7 +4189,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithMap) { })) // Screen state change to ON. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 5); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 5, 5)); @@ -4203,7 +4203,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithMap) { // Screen state change to OFF. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 15); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 15, 21)); @@ -4211,7 +4211,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithMap) { })) // Dump report requested. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 50); data->clear(); data->push_back(CreateRepeatedValueLogEvent(tagId, bucketStartTimeNs + 50, 30)); @@ -4408,10 +4408,10 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */}); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // ValueMetricProducer initialized. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs); data->clear(); data->push_back(CreateTwoValueLogEvent(tagId, bucketStartTimeNs, 2 /*uid*/, 7)); @@ -4420,7 +4420,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { })) // Uid 1 process state change from kStateUnknown -> Foreground .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 20); data->clear(); data->push_back( @@ -4433,7 +4433,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { })) // Uid 2 process state change from kStateUnknown -> Background .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 40); data->clear(); data->push_back( @@ -4446,7 +4446,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { })) // Uid 1 process state change from Foreground -> Background .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 20); data->clear(); data->push_back( @@ -4459,7 +4459,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { })) // Uid 1 process state change from Background -> Foreground .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 40); data->clear(); data->push_back( @@ -4472,7 +4472,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) { })) // Dump report pull. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 50); data->clear(); data->push_back( @@ -4852,10 +4852,10 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithCondition) { ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithConditionAndState( "BATTERY_SAVER_MODE_STATE"); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(tagId, kConfigKey, _, _)) // Condition changed to true. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 20 * NS_PER_SEC); data->clear(); data->push_back( @@ -4864,7 +4864,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithCondition) { })) // Battery saver mode state changed to OFF. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucketStartTimeNs + 30 * NS_PER_SEC); data->clear(); data->push_back( @@ -4873,7 +4873,7 @@ TEST(ValueMetricProducerTest, TestSlicedStateWithCondition) { })) // Condition changed to false. .WillOnce(Invoke([](int tagId, const ConfigKey&, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { EXPECT_EQ(eventTimeNs, bucket2StartTimeNs + 10 * NS_PER_SEC); data->clear(); data->push_back(CreateRepeatedValueLogEvent( diff --git a/cmds/statsd/tests/metrics/metrics_test_helper.h b/cmds/statsd/tests/metrics/metrics_test_helper.h index eeb38a4644fd..39232c194ada 100644 --- a/cmds/statsd/tests/metrics/metrics_test_helper.h +++ b/cmds/statsd/tests/metrics/metrics_test_helper.h @@ -38,11 +38,10 @@ public: int64_t nextPulltimeNs, int64_t intervalNs)); MOCK_METHOD3(UnRegisterReceiver, void(int tagId, const ConfigKey& key, wp<PullDataReceiver> receiver)); - MOCK_METHOD5(Pull, bool(const int pullCode, const ConfigKey& key, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids)); - MOCK_METHOD5(Pull, - bool(const int pullCode, const vector<int32_t>& uids, const int64_t eventTimeNs, - vector<std::shared_ptr<LogEvent>>* data, bool useUids)); + MOCK_METHOD4(Pull, bool(const int pullCode, const ConfigKey& key, const int64_t eventTimeNs, + vector<std::shared_ptr<LogEvent>>* data)); + MOCK_METHOD4(Pull, bool(const int pullCode, const vector<int32_t>& uids, + const int64_t eventTimeNs, vector<std::shared_ptr<LogEvent>>* data)); MOCK_METHOD2(RegisterPullUidProvider, void(const ConfigKey& configKey, wp<PullUidProvider> provider)); MOCK_METHOD2(UnregisterPullUidProvider, diff --git a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp index e384b6ac7c84..4fa4135e983f 100644 --- a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp +++ b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp @@ -190,9 +190,9 @@ TEST(ShellSubscriberTest, testPulledSubscription) { sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); const vector<int32_t> uids = {AID_SYSTEM}; - EXPECT_CALL(*pullerManager, Pull(10016, uids, _, _, _)) + EXPECT_CALL(*pullerManager, Pull(10016, uids, _, _)) .WillRepeatedly(Invoke([](int tagId, const vector<int32_t>&, const int64_t, - vector<std::shared_ptr<LogEvent>>* data, bool) { + vector<std::shared_ptr<LogEvent>>* data) { data->clear(); data->push_back(makeCpuActiveTimeAtom(/*uid=*/kUid1, /*timeMillis=*/kCpuTime1)); data->push_back(makeCpuActiveTimeAtom(/*uid=*/kUid2, /*timeMillis=*/kCpuTime2)); |