Loading system/device/src/device_iot_config_int.cc +4 −1 Original line number Diff line number Diff line Loading @@ -57,8 +57,8 @@ using bluetooth::common::InitFlags; static void cleanup() { alarm_free(config_timer); config.reset(); config_timer = NULL; config.reset(); config = NULL; device_iot_config_source = NOT_LOADED; } Loading @@ -69,6 +69,9 @@ future_t* device_iot_config_module_init(void) { std::unique_lock<std::mutex> lock(config_lock); config_timer = NULL; config = NULL; if (device_iot_config_is_factory_reset()) { device_iot_config_delete_files(); } Loading system/device/test/device_iot_config_test.cc +8 −12 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ class DeviceIotConfigModuleTest : public testing::Test { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = [&](const char* key, bool default_value) -> int { return false; }; test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { return; }; Loading Loading @@ -205,27 +208,17 @@ TEST_F(DeviceIotConfigModuleTest, TEST_F(DeviceIotConfigModuleTest, test_device_iot_config_module_init_no_config) { std::string enable_logging_property_get_value; std::string factory_reset_property_get_value; config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; test::mock::osi_config::config_new.body = [&](const char* filename) { return std::unique_ptr<config_t>(config_new_return_value); return std::unique_ptr<config_t>(nullptr); }; test::mock::osi_config::config_new_empty.body = [&](void) { return std::unique_ptr<config_t>(config_new_empty_return_value); return std::unique_ptr<config_t>(nullptr); }; { mock_function_count_map.clear(); enable_logging_property_get_value = "true"; factory_reset_property_get_value = "false"; config_new_return_value = NULL; config_new_empty_return_value = NULL; device_iot_config_module_init(); EXPECT_EQ(mock_function_count_map["config_new"], 2); Loading Loading @@ -828,6 +821,9 @@ class DeviceIotConfigTest : public testing::Test { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = [&](const char* key, bool default_value) -> int { return false; }; test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { return; }; Loading Loading
system/device/src/device_iot_config_int.cc +4 −1 Original line number Diff line number Diff line Loading @@ -57,8 +57,8 @@ using bluetooth::common::InitFlags; static void cleanup() { alarm_free(config_timer); config.reset(); config_timer = NULL; config.reset(); config = NULL; device_iot_config_source = NOT_LOADED; } Loading @@ -69,6 +69,9 @@ future_t* device_iot_config_module_init(void) { std::unique_lock<std::mutex> lock(config_lock); config_timer = NULL; config = NULL; if (device_iot_config_is_factory_reset()) { device_iot_config_delete_files(); } Loading
system/device/test/device_iot_config_test.cc +8 −12 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ class DeviceIotConfigModuleTest : public testing::Test { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = [&](const char* key, bool default_value) -> int { return false; }; test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { return; }; Loading Loading @@ -205,27 +208,17 @@ TEST_F(DeviceIotConfigModuleTest, TEST_F(DeviceIotConfigModuleTest, test_device_iot_config_module_init_no_config) { std::string enable_logging_property_get_value; std::string factory_reset_property_get_value; config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; test::mock::osi_config::config_new.body = [&](const char* filename) { return std::unique_ptr<config_t>(config_new_return_value); return std::unique_ptr<config_t>(nullptr); }; test::mock::osi_config::config_new_empty.body = [&](void) { return std::unique_ptr<config_t>(config_new_empty_return_value); return std::unique_ptr<config_t>(nullptr); }; { mock_function_count_map.clear(); enable_logging_property_get_value = "true"; factory_reset_property_get_value = "false"; config_new_return_value = NULL; config_new_empty_return_value = NULL; device_iot_config_module_init(); EXPECT_EQ(mock_function_count_map["config_new"], 2); Loading Loading @@ -828,6 +821,9 @@ class DeviceIotConfigTest : public testing::Test { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = [&](const char* key, bool default_value) -> int { return false; }; test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { return; }; Loading