aboutsummaryrefslogtreecommitdiff
path: root/src/commands/cloud_command_proxy_unittest.cc
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2015-12-05 17:14:39 -0800
committerAlex Vakulenko <avakulenko@google.com>2015-12-07 20:45:34 +0000
commitd91d625f29b752be035c5fb49bb29d7ee85fcb90 (patch)
tree28cb30df49ee04cdc85d9f5220cd0631d2ce8865 /src/commands/cloud_command_proxy_unittest.cc
parent6b394d1073eebf08400899e8056b86adc449bc3e (diff)
downloadlibweave-d91d625f29b752be035c5fb49bb29d7ee85fcb90.tar.gz
Switch to use ComponentManager for traits/components
Removed the old StateManager, CommandManager and related classes and switched over to using ComponentManager for all device trait and component definitions as well as device state. Change-Id: I99b99a935ba217703d31aa523a3124cca0fa3e90 Reviewed-on: https://weave-review.googlesource.com/1788 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
Diffstat (limited to 'src/commands/cloud_command_proxy_unittest.cc')
-rw-r--r--src/commands/cloud_command_proxy_unittest.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/commands/cloud_command_proxy_unittest.cc b/src/commands/cloud_command_proxy_unittest.cc
index c022b79..d3a9965 100644
--- a/src/commands/cloud_command_proxy_unittest.cc
+++ b/src/commands/cloud_command_proxy_unittest.cc
@@ -12,9 +12,8 @@
#include <weave/provider/test/fake_task_runner.h>
#include <weave/test/unittest_utils.h>
-#include "src/commands/command_dictionary.h"
#include "src/commands/command_instance.h"
-#include "src/states/mock_state_change_queue_interface.h"
+#include "src/mock_component_manager.h"
using testing::_;
using testing::DoAll;
@@ -66,14 +65,14 @@ class TestBackoffEntry : public BackoffEntry {
class CloudCommandProxyTest : public ::testing::Test {
protected:
void SetUp() override {
- // Set up the test StateChangeQueue.
- auto callback = [this](
- const base::Callback<void(StateChangeQueueInterface::UpdateID)>& call) {
+ // Set up the test ComponentManager.
+ auto callback =
+ [this](const base::Callback<void(ComponentManager::UpdateID)>& call) {
return callbacks_.Add(call).release();
};
- EXPECT_CALL(state_change_queue_, MockAddOnStateUpdatedCallback(_))
+ EXPECT_CALL(component_manager_, MockAddServerStateUpdatedCallback(_))
.WillRepeatedly(Invoke(callback));
- EXPECT_CALL(state_change_queue_, GetLastStateChangeId())
+ EXPECT_CALL(component_manager_, GetLastStateChangeId())
.WillRepeatedly(testing::ReturnPointee(&current_state_update_id_));
CreateCommandInstance();
@@ -102,7 +101,7 @@ class CloudCommandProxyTest : public ::testing::Test {
// Finally construct the CloudCommandProxy we are going to test here.
std::unique_ptr<CloudCommandProxy> proxy{new CloudCommandProxy{
- command_instance_.get(), &cloud_updater_, &state_change_queue_,
+ command_instance_.get(), &cloud_updater_, &component_manager_,
std::move(backoff), &task_runner_}};
// CloudCommandProxy::CloudCommandProxy() subscribe itself to weave::Command
// notifications. When weave::Command is being destroyed it sends
@@ -110,10 +109,10 @@ class CloudCommandProxyTest : public ::testing::Test {
proxy.release();
}
- StateChangeQueueInterface::UpdateID current_state_update_id_{0};
- base::CallbackList<void(StateChangeQueueInterface::UpdateID)> callbacks_;
+ ComponentManager::UpdateID current_state_update_id_{0};
+ base::CallbackList<void(ComponentManager::UpdateID)> callbacks_;
testing::StrictMock<MockCloudCommandUpdateInterface> cloud_updater_;
- testing::StrictMock<MockStateChangeQueueInterface> state_change_queue_;
+ testing::StrictMock<MockComponentManager> component_manager_;
testing::StrictMock<provider::test::FakeTaskRunner> task_runner_;
std::queue<base::Closure> task_queue_;
std::unique_ptr<CommandInstance> command_instance_;