summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-05-25 15:03:04 +0930
committerAndrew Jeffery <andrew@aj.id.au>2019-04-08 13:48:50 +0930
commit30726a0c584e77677f64d5f06f8588b1b9881532 (patch)
treeeafe42c4f5d9e895a077f5b9af0944778739f0f5
parent861e5625ed88a7eb68c671a91d7d68b9fa71aad2 (diff)
downloadphosphor-led-sysfs-30726a0c584e77677f64d5f06f8588b1b9881532.zip
phosphor-led-sysfs-30726a0c584e77677f64d5f06f8588b1b9881532.tar.gz
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 <andrew@aj.id.au>
-rw-r--r--test/physical.cpp9
1 files 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<MockLed> 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<MockLed> 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);
}
OpenPOWER on IntegriCloud