proxygen
fizz::test::MockFactory Class Reference

#include <Mocks.h>

Inheritance diagram for fizz::test::MockFactory:
fizz::Factory

Public Member Functions

 MOCK_CONST_METHOD0 (makePlaintextReadRecordLayer, std::unique_ptr< PlaintextReadRecordLayer >())
 
 MOCK_CONST_METHOD0 (makePlaintextWriteRecordLayer, std::unique_ptr< PlaintextWriteRecordLayer >())
 
 MOCK_CONST_METHOD1 (makeEncryptedReadRecordLayer, std::unique_ptr< EncryptedReadRecordLayer >(EncryptionLevel encryptionLevel))
 
 MOCK_CONST_METHOD1 (makeEncryptedWriteRecordLayer, std::unique_ptr< EncryptedWriteRecordLayer >(EncryptionLevel encryptionLevel))
 
 MOCK_CONST_METHOD1 (makeKeyScheduler, std::unique_ptr< KeyScheduler >(CipherSuite cipher))
 
 MOCK_CONST_METHOD1 (makeHandshakeContext, std::unique_ptr< HandshakeContext >(CipherSuite cipher))
 
 MOCK_CONST_METHOD1 (makeKeyExchange, std::unique_ptr< KeyExchange >(NamedGroup group))
 
 MOCK_CONST_METHOD1 (makeAead, std::unique_ptr< Aead >(CipherSuite cipher))
 
 MOCK_CONST_METHOD0 (makeRandom, Random())
 
 MOCK_CONST_METHOD0 (makeTicketAgeAdd, uint32_t())
 
 MOCK_CONST_METHOD1 (_makePeerCert, std::shared_ptr< PeerCert >(Buf &))
 
std::shared_ptr< PeerCertmakePeerCert (Buf certData) const override
 
void setDefaults ()
 
- Public Member Functions inherited from fizz::Factory
virtual ~Factory ()=default
 
virtual std::unique_ptr< PlaintextReadRecordLayermakePlaintextReadRecordLayer () const
 
virtual std::unique_ptr< PlaintextWriteRecordLayermakePlaintextWriteRecordLayer () const
 
virtual std::unique_ptr< EncryptedReadRecordLayermakeEncryptedReadRecordLayer (EncryptionLevel encryptionLevel) const
 
virtual std::unique_ptr< EncryptedWriteRecordLayermakeEncryptedWriteRecordLayer (EncryptionLevel encryptionLevel) const
 
virtual std::unique_ptr< KeySchedulermakeKeyScheduler (CipherSuite cipher) const
 
virtual std::unique_ptr< KeyDerivationmakeKeyDeriver (CipherSuite cipher) const
 
virtual std::unique_ptr< HandshakeContextmakeHandshakeContext (CipherSuite cipher) const
 
virtual std::unique_ptr< KeyExchangemakeKeyExchange (NamedGroup group) const
 
virtual std::unique_ptr< AeadmakeAead (CipherSuite cipher) const
 
virtual Random makeRandom () const
 
virtual uint32_t makeTicketAgeAdd () const
 
virtual std::string getHkdfPrefix () const
 

Detailed Description

Definition at line 144 of file Mocks.h.

Member Function Documentation

std::shared_ptr<PeerCert> fizz::test::MockFactory::makePeerCert ( Buf  certData) const
inlineoverridevirtual

Reimplemented from fizz::Factory.

Definition at line 174 of file Mocks.h.

174  {
175  return _makePeerCert(certData);
176  }
fizz::test::MockFactory::MOCK_CONST_METHOD0 ( makePlaintextReadRecordLayer  ,
std::unique_ptr< PlaintextReadRecordLayer () 
)
fizz::test::MockFactory::MOCK_CONST_METHOD0 ( makePlaintextWriteRecordLayer  ,
std::unique_ptr< PlaintextWriteRecordLayer () 
)
fizz::test::MockFactory::MOCK_CONST_METHOD0 ( makeRandom  ,
Random()   
)
fizz::test::MockFactory::MOCK_CONST_METHOD0 ( makeTicketAgeAdd  ,
uint32_t()   
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeEncryptedReadRecordLayer  ,
std::unique_ptr< EncryptedReadRecordLayer EncryptionLevel encryptionLevel 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeEncryptedWriteRecordLayer  ,
std::unique_ptr< EncryptedWriteRecordLayer EncryptionLevel encryptionLevel 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeKeyScheduler  ,
std::unique_ptr< KeyScheduler CipherSuite cipher 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeHandshakeContext  ,
std::unique_ptr< HandshakeContext CipherSuite cipher 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeKeyExchange  ,
std::unique_ptr< KeyExchange NamedGroup group 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( makeAead  ,
std::unique_ptr< Aead CipherSuite cipher 
)
fizz::test::MockFactory::MOCK_CONST_METHOD1 ( _makePeerCert  ,
std::shared_ptr< PeerCert Buf & 
)
void fizz::test::MockFactory::setDefaults ( )
inline

Definition at line 178 of file Mocks.h.

References testing::_, testing::Invoke(), testing::InvokeWithoutArgs(), makeRandom(), ON_CALL, and random().

178  {
180  .WillByDefault(InvokeWithoutArgs(
181  []() { return std::make_unique<MockPlaintextReadRecordLayer>(); }));
182 
184  .WillByDefault(InvokeWithoutArgs([]() {
185  auto ret = std::make_unique<MockPlaintextWriteRecordLayer>();
186  ret->setDefaults();
187  return ret;
188  }));
190  .WillByDefault(Invoke([](EncryptionLevel encryptionLevel) {
191  return std::make_unique<MockEncryptedReadRecordLayer>(
192  encryptionLevel);
193  }));
194 
196  .WillByDefault(Invoke([](EncryptionLevel encryptionLevel) {
197  auto ret =
198  std::make_unique<MockEncryptedWriteRecordLayer>(encryptionLevel);
199  ret->setDefaults();
200  return ret;
201  }));
202 
203  ON_CALL(*this, makeKeyScheduler(_)).WillByDefault(InvokeWithoutArgs([]() {
204  auto ret = std::make_unique<MockKeyScheduler>();
205  ret->setDefaults();
206  return ret;
207  }));
209  .WillByDefault(InvokeWithoutArgs([]() {
210  auto ret = std::make_unique<MockHandshakeContext>();
211  ret->setDefaults();
212  return ret;
213  }));
214  ON_CALL(*this, makeKeyExchange(_)).WillByDefault(InvokeWithoutArgs([]() {
215  auto ret = std::make_unique<MockKeyExchange>();
216  ret->setDefaults();
217  return ret;
218  }));
219  ON_CALL(*this, makeAead(_)).WillByDefault(InvokeWithoutArgs([]() {
220  auto ret = std::make_unique<MockAead>();
221  ret->setDefaults();
222  return ret;
223  }));
224  ON_CALL(*this, makeRandom()).WillByDefault(InvokeWithoutArgs([]() {
225  Random random;
226  random.fill(0x44);
227  return random;
228  }));
229  ON_CALL(*this, makeTicketAgeAdd()).WillByDefault(InvokeWithoutArgs([]() {
230  return 0x44444444;
231  }));
232  ON_CALL(*this, _makePeerCert(_)).WillByDefault(InvokeWithoutArgs([]() {
233  return std::make_unique<MockPeerCert>();
234  }));
235  }
Integral2 random(Integral1 low, Integral2 up)
virtual std::unique_ptr< PlaintextReadRecordLayer > makePlaintextReadRecordLayer() const
Definition: Factory.h:37
virtual std::unique_ptr< KeyScheduler > makeKeyScheduler(CipherSuite cipher) const
Definition: Factory.h:56
virtual std::unique_ptr< KeyExchange > makeKeyExchange(NamedGroup group) const
Definition: Factory.h:90
virtual std::unique_ptr< Aead > makeAead(CipherSuite cipher) const
Definition: Factory.h:105
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
virtual std::unique_ptr< EncryptedReadRecordLayer > makeEncryptedReadRecordLayer(EncryptionLevel encryptionLevel) const
Definition: Factory.h:47
EncryptionLevel
Definition: Types.h:29
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
virtual std::unique_ptr< HandshakeContext > makeHandshakeContext(CipherSuite cipher) const
Definition: Factory.h:76
virtual std::unique_ptr< EncryptedWriteRecordLayer > makeEncryptedWriteRecordLayer(EncryptionLevel encryptionLevel) const
Definition: Factory.h:52
virtual uint32_t makeTicketAgeAdd() const
Definition: Factory.h:124
#define ON_CALL(obj, call)
const internal::AnythingMatcher _
virtual Random makeRandom() const
Definition: Factory.h:120
virtual std::unique_ptr< PlaintextWriteRecordLayer > makePlaintextWriteRecordLayer() const
Definition: Factory.h:42

The documentation for this class was generated from the following file: