diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-05-25 14:05:40 +0930 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2019-04-08 13:48:50 +0930 |
commit | aee9c2c452db3ce43df62a0ac779fda6e65a64ca (patch) | |
tree | 269aec8ff8534e9fe291a08e8a6b71ecd4d91c24 /test/physical.cpp | |
parent | 04275e06d2aab6a5e13807e0a295d3b48a979118 (diff) | |
download | phosphor-led-sysfs-aee9c2c452db3ce43df62a0ac779fda6e65a64ca.tar.gz phosphor-led-sysfs-aee9c2c452db3ce43df62a0ac779fda6e65a64ca.zip |
test: physical: Hit both branches of stableStateOperation()
Change-Id: Ic32d87dbe996a03e811e1be88fbcc00bf450e1f3
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'test/physical.cpp')
-rw-r--r-- | test/physical.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/physical.cpp b/test/physical.cpp index 9312598..f62caa2 100644 --- a/test/physical.cpp +++ b/test/physical.cpp @@ -66,6 +66,7 @@ class MockLed : public phosphor::led::SysfsLed MOCK_METHOD1(setDelayOff, void(unsigned long ms)); }; +using ::testing::InSequence; using ::testing::NiceMock; using ::testing::Return; using ::testing::Throw; @@ -125,3 +126,20 @@ TEST(Physical, ctor_none_trigger_asserted_brightness) EXPECT_CALL(led, getBrightness()).WillRepeatedly(Return(val)); phosphor::led::Physical phy(bus, LED_OBJ, led); } + +TEST(Physical, on_to_off) +{ + InSequence s; + + auto bus = sdbusplus::bus::new_default(); + NiceMock<MockLed> led; + EXPECT_CALL(led, getTrigger()).Times(1).WillOnce(Return("none")); + constexpr auto deasserted = phosphor::led::DEASSERT; + EXPECT_CALL(led, getBrightness()).WillOnce(Return(deasserted)); + constexpr auto asserted = phosphor::led::ASSERT; + EXPECT_CALL(led, setBrightness(asserted)); + EXPECT_CALL(led, setBrightness(deasserted)); + phosphor::led::Physical phy(bus, LED_OBJ, led); + phy.state(Action::On); + phy.state(Action::Off); +} |