diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-17 04:21:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-17 04:21:38 +0000 |
commit | fdfc075d1c9802761016a92cc5557a0bf05ffd4f (patch) | |
tree | 513190513448d4c25ce40794d51d601c0a38087d | |
parent | 9d9c19557f4dfecaf7920843c0cce6aa81afc697 (diff) | |
parent | cc0a01b520b186f97645fc5724e7cd9ef645aeff (diff) | |
download | pixel-fdfc075d1c9802761016a92cc5557a0bf05ffd4f.tar.gz |
Merge "vibrator: cs40l25: Fix Benchmark and Test" into rvc-dev
-rw-r--r-- | vibrator/cs40l25/bench/benchmark.cpp | 5 | ||||
-rw-r--r-- | vibrator/cs40l25/tests/test-vibrator.cpp | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/vibrator/cs40l25/bench/benchmark.cpp b/vibrator/cs40l25/bench/benchmark.cpp index 507adfb4..c43a2a2a 100644 --- a/vibrator/cs40l25/bench/benchmark.cpp +++ b/vibrator/cs40l25/bench/benchmark.cpp @@ -44,6 +44,8 @@ class VibratorBench : public benchmark::Fixture { "device/gpio1_fall_dig_scale", "device/gpio1_rise_index", "device/gpio1_rise_dig_scale", + "device/vibe_state", + "device/num_waves", }; public: @@ -52,6 +54,9 @@ class VibratorBench : public benchmark::Fixture { const std::map<const std::string, const std::string> content{ {"duration", std::to_string((uint32_t)std::rand() ?: 1)}, {"device/asp_enable", std::to_string(0)}, + {"device/cp_trigger_duration", std::to_string(0)}, + {"device/num_waves", std::to_string(10)}, + {"device/vibe_state", std::to_string(0)}, }; setenv("HWAPI_PATH_PREFIX", prefix.c_str(), true); diff --git a/vibrator/cs40l25/tests/test-vibrator.cpp b/vibrator/cs40l25/tests/test-vibrator.cpp index 4d0a5ad8..2f77ecc8 100644 --- a/vibrator/cs40l25/tests/test-vibrator.cpp +++ b/vibrator/cs40l25/tests/test-vibrator.cpp @@ -67,8 +67,8 @@ static EffectScale Scale(float intensity); // Constants With Arbitrary Values static constexpr std::array<EffectLevel, 6> V_LEVELS{40, 50, 60, 70, 80, 90}; -static constexpr std::array<EffectDuration, 9> EFFECT_DURATIONS{0, 0, 15, 0, 50, - 100, 150, 200, 250}; +static constexpr std::array<EffectDuration, 10> EFFECT_DURATIONS{0, 0, 15, 0, 50, + 100, 150, 200, 250, 8}; // Constants With Prescribed Values @@ -443,10 +443,10 @@ TEST_P(EffectsTest, perform) { Expectation eActivate, ePoll; if (scale != EFFECT_SCALE.end()) { - duration = EFFECT_DURATIONS[2]; + EffectIndex index = EFFECT_INDEX.at(effect); + duration = EFFECT_DURATIONS[index]; - eSetup += EXPECT_CALL(*mMockApi, setEffectIndex(EFFECT_INDEX.at(effect))) - .WillOnce(DoDefault()); + eSetup += EXPECT_CALL(*mMockApi, setEffectIndex(index)).WillOnce(DoDefault()); eSetup += EXPECT_CALL(*mMockApi, setEffectScale(scale->second)).WillOnce(Return(true)); } else if (queue != EFFECT_QUEUE.end()) { duration = std::get<1>(queue->second); |