From 30726a0c584e77677f64d5f06f8588b1b9881532 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Fri, 25 May 2018 15:03:04 +0930 Subject: test: physical: Capture state(Action::{On,Off}) parameters Implement value sensing to verify the behaviour of the On and Off actions. This constrains future on/off changes to interacting with sysfs in the same manner. Change-Id: Ie0ac063cbda3156ca7f0ef2eab9e700013780e44 Signed-off-by: Andrew Jeffery --- test/physical.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/physical.cpp b/test/physical.cpp index 1ffe9f3..f3c3187 100644 --- a/test/physical.cpp +++ b/test/physical.cpp @@ -94,7 +94,10 @@ TEST(Physical, off) { sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); NiceMock led; - ON_CALL(led, getTrigger()).WillByDefault(Return("none")); + ON_CALL(led, getMaxBrightness()).WillByDefault(Return(127)); + EXPECT_CALL(led, getTrigger()).WillOnce(Return("none")); + EXPECT_CALL(led, getBrightness()).WillOnce(Return(phosphor::led::DEASSERT)); + EXPECT_CALL(led, setBrightness(phosphor::led::DEASSERT)).Times(0); phosphor::led::Physical phy(bus, LED_OBJ, led); phy.state(Action::Off); } @@ -103,7 +106,9 @@ TEST(Physical, on) { sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); NiceMock led; - ON_CALL(led, getTrigger()).WillByDefault(Return("none")); + EXPECT_CALL(led, getTrigger()).WillOnce(Return("none")); + EXPECT_CALL(led, setTrigger("none")); + EXPECT_CALL(led, setBrightness(phosphor::led::ASSERT)); phosphor::led::Physical phy(bus, LED_OBJ, led); phy.state(Action::On); } -- cgit v1.2.1