Home | History | Annotate | Download | only in wire
      1 // Copyright 2012 Google Inc. All Rights Reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 #ifndef TV_GTVREMOTE_TESTS_POLO_WIRE_MOCKS_H_
     16 #define TV_GTVREMOTE_TESTS_POLO_WIRE_MOCKS_H_
     17 
     18 #include <gmock/gmock.h>
     19 #include <polo/wire/polowireinterface.h>
     20 #include <polo/wire/polowireadapter.h>
     21 #include <vector>
     22 
     23 namespace polo {
     24 namespace wire {
     25 
     26 // A mock PoloWireInterface.
     27 class MockWireInterface : public PoloWireInterface {
     28  public:
     29   MOCK_METHOD1(Send, void(const std::vector<uint8_t>& data));
     30   MOCK_METHOD1(Receive, void(size_t num_bytes));
     31 };
     32 
     33 // A mock PoloWireAdapter.
     34 class MockWireAdapter : public PoloWireAdapter {
     35  public:
     36   explicit MockWireAdapter(PoloWireInterface* interface)
     37       : PoloWireAdapter(interface) {
     38   }
     39 
     40   MOCK_METHOD0(GetNextMessage, void());
     41   MOCK_METHOD1(SendConfigurationMessage,
     42                void(const pairing::message::ConfigurationMessage& message));
     43   MOCK_METHOD1(SendConfigurationAckMessage,
     44                void(const pairing::message::ConfigurationAckMessage& message));
     45   MOCK_METHOD1(SendOptionsMessage,
     46                void(const pairing::message::OptionsMessage& message));
     47   MOCK_METHOD1(SendPairingRequestMessage,
     48                void(const pairing::message::PairingRequestMessage& message));
     49   MOCK_METHOD1(SendPairingRequestAckMessage,
     50                void(const pairing::message::PairingRequestAckMessage& message));
     51   MOCK_METHOD1(SendSecretMessage,
     52                void(const pairing::message::SecretMessage& message));
     53   MOCK_METHOD1(SendSecretAckMessage,
     54                void(const pairing::message::SecretAckMessage& message));
     55   MOCK_METHOD1(SendErrorMessage, void(pairing::PoloError error));
     56   MOCK_METHOD1(OnBytesReceived, void(const std::vector<uint8_t>& data));
     57   MOCK_METHOD0(OnError, void());
     58 };
     59 
     60 }  // namespace wire
     61 }  // namespace polo
     62 
     63 
     64 #endif  // TV_GTVREMOTE_TESTS_POLO_WIRE_MOCKS_H_
     65