Home | History | Annotate | Download | only in test
      1 // Copyright 2015 The Weave Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_DEVICE_H_
      6 #define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_DEVICE_H_
      7 
      8 #include <weave/device.h>
      9 
     10 #include <string>
     11 
     12 #include <gmock/gmock.h>
     13 
     14 namespace weave {
     15 namespace test {
     16 
     17 class MockDevice : public Device {
     18  public:
     19   ~MockDevice() override = default;
     20 
     21   MOCK_CONST_METHOD0(GetSettings, const Settings&());
     22   MOCK_METHOD1(AddSettingsChangedCallback,
     23                void(const SettingsChangedCallback& callback));
     24   MOCK_METHOD1(AddTraitDefinitionsFromJson, void(const std::string& json));
     25   MOCK_METHOD1(AddTraitDefinitions, void(const base::DictionaryValue& dict));
     26   MOCK_CONST_METHOD0(GetTraits, const base::DictionaryValue&());
     27   MOCK_METHOD1(AddTraitDefsChangedCallback,
     28                void(const base::Closure& callback));
     29   MOCK_METHOD3(AddComponent,
     30                bool(const std::string& name,
     31                     const std::vector<std::string>& traits,
     32                     ErrorPtr* error));
     33   MOCK_METHOD2(RemoveComponent, bool(const std::string& name, ErrorPtr* error));
     34   MOCK_METHOD1(AddComponentTreeChangedCallback,
     35                void(const base::Closure& callback));
     36   MOCK_CONST_METHOD0(GetComponents, const base::DictionaryValue&());
     37   MOCK_METHOD3(SetStatePropertiesFromJson,
     38                bool(const std::string& component,
     39                     const std::string& json,
     40                     ErrorPtr* error));
     41   MOCK_METHOD3(SetStateProperties,
     42                bool(const std::string& component,
     43                     const base::DictionaryValue& dict,
     44                     ErrorPtr* error));
     45   MOCK_CONST_METHOD3(GetStateProperty,
     46                      const base::Value*(const std::string& component,
     47                                         const std::string& name,
     48                                         ErrorPtr* error));
     49   MOCK_METHOD4(SetStateProperty,
     50                bool(const std::string& component,
     51                     const std::string& name,
     52                     const base::Value& value,
     53                     ErrorPtr* error));
     54   MOCK_METHOD3(AddCommandHandler,
     55                void(const std::string& component,
     56                     const std::string& command_name,
     57                     const CommandHandlerCallback& callback));
     58   MOCK_METHOD3(AddCommand,
     59                bool(const base::DictionaryValue&, std::string*, ErrorPtr*));
     60   MOCK_METHOD1(FindCommand, Command*(const std::string&));
     61   MOCK_METHOD1(AddStateChangedCallback, void(const base::Closure& callback));
     62   MOCK_CONST_METHOD0(GetGcdState, GcdState());
     63   MOCK_METHOD1(AddGcdStateChangedCallback,
     64                void(const GcdStateChangedCallback& callback));
     65   MOCK_METHOD2(Register,
     66                void(const std::string& ticket_id,
     67                     const DoneCallback& callback));
     68   MOCK_METHOD2(AddPairingChangedCallbacks,
     69                void(const PairingBeginCallback& begin_callback,
     70                     const PairingEndCallback& end_callback));
     71 
     72   // Deprecated methods.
     73   MOCK_METHOD1(AddCommandDefinitionsFromJson, void(const std::string&));
     74   MOCK_METHOD1(AddCommandDefinitions, void(const base::DictionaryValue&));
     75   MOCK_METHOD2(AddCommandHandler,
     76                void(const std::string&, const CommandHandlerCallback&));
     77   MOCK_METHOD1(AddStateDefinitionsFromJson, void(const std::string&));
     78   MOCK_METHOD1(AddStateDefinitions, void(const base::DictionaryValue&));
     79   MOCK_METHOD2(SetStatePropertiesFromJson, bool(const std::string&, ErrorPtr*));
     80   MOCK_METHOD2(SetStateProperties,
     81                bool(const base::DictionaryValue&, ErrorPtr*));
     82   MOCK_CONST_METHOD1(GetStateProperty,
     83                      const base::Value*(const std::string& name));
     84   MOCK_METHOD3(SetStateProperty,
     85                bool(const std::string& name,
     86                     const base::Value& value,
     87                     ErrorPtr* error));
     88   MOCK_CONST_METHOD0(GetState, const base::DictionaryValue&());
     89 };
     90 
     91 }  // namespace test
     92 }  // namespace weave
     93 
     94 #endif  // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_DEVICE_H_
     95