aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-01-21 15:01:32 -0800
committerVitaly Buka <vitalybuka@google.com>2016-01-21 23:50:52 +0000
commit81ac16e6bf71951354e79c709ca5500fda451f7f (patch)
tree25a79d1f762b806c4ee12b9b863911cfb8ec1d30 /include
parent07bb7552fba56eab0f168ae537c957d1bb964fc5 (diff)
downloadlibweave-81ac16e6bf71951354e79c709ca5500fda451f7f.tar.gz
Add MockConfigStore argument to disabled default expectations
Usually we need MockConfigStore just to pass into interface where store is needed. Default expectations are OK there. These expectations are not desired when we want to check data passed into Load/Save. Change-Id: Ia3ee784eec2fd12c4a3c81916f7cfb20f8d94e47 Reviewed-on: https://weave-review.googlesource.com/2274 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/weave/provider/test/mock_config_store.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/weave/provider/test/mock_config_store.h b/include/weave/provider/test/mock_config_store.h
index e6411d6..a7eb374 100644
--- a/include/weave/provider/test/mock_config_store.h
+++ b/include/weave/provider/test/mock_config_store.h
@@ -18,10 +18,13 @@ namespace test {
class MockConfigStore : public ConfigStore {
public:
- MockConfigStore() {
+ explicit MockConfigStore(bool set_expectations = true) {
using testing::_;
using testing::Return;
+ if (!set_expectations)
+ return;
+
EXPECT_CALL(*this, LoadDefaults(_))
.WillRepeatedly(testing::Invoke([](Settings* settings) {
settings->firmware_version = "TEST_FIRMWARE";
@@ -39,8 +42,8 @@ class MockConfigStore : public ConfigStore {
"version": 1,
"device_id": "TEST_DEVICE_ID"
})"));
- EXPECT_CALL(*this, LoadSettings("config")).WillRepeatedly(Return(""));
- EXPECT_CALL(*this, SaveSettings("config", _, _))
+ EXPECT_CALL(*this, LoadSettings(_)).WillRepeatedly(Return(""));
+ EXPECT_CALL(*this, SaveSettings(_, _, _))
.WillRepeatedly(testing::WithArgs<1, 2>(testing::Invoke(
[](const std::string& json, const DoneCallback& callback) {
if (!callback.is_null())