Fix copyright lines
[folly.git] / folly / io / async / test / MockAsyncTransport.h
index 8cff00f7ab214ca6c29f70a64e25673f795a023b..6c7d219ca810c7c0b8914a26a80e942e5bbed509 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 #pragma once
 
-#include <gmock/gmock.h>
-
 #include <folly/Memory.h>
 #include <folly/io/async/AsyncTransport.h>
+#include <folly/portability/GMock.h>
 
 namespace folly { namespace test {
 
@@ -62,7 +61,14 @@ class MockAsyncTransport: public AsyncTransportWrapper {
   MOCK_CONST_METHOD0(isEorTrackingEnabled, bool());
   MOCK_METHOD1(setEorTracking, void(bool));
   MOCK_CONST_METHOD0(getWrappedTransport, AsyncTransportWrapper*());
+  MOCK_CONST_METHOD0(isReplaySafe, bool());
+  MOCK_METHOD1(setReplaySafetyCallback,
+               void(AsyncTransport::ReplaySafetyCallback*));
+};
 
+class MockReplaySafetyCallback : public AsyncTransport::ReplaySafetyCallback {
+ public:
+  GMOCK_METHOD0_(, noexcept, , onReplaySafe, void());
 };
 
 class MockReadCallback: public AsyncTransportWrapper::ReadCallback {
@@ -71,15 +77,15 @@ class MockReadCallback: public AsyncTransportWrapper::ReadCallback {
   GMOCK_METHOD1_(, noexcept, , readDataAvailable, void(size_t));
   GMOCK_METHOD0_(, noexcept, , isBufferMovable, bool());
   GMOCK_METHOD1_(, noexcept, ,
-      readBufferAvailableInternal, void(std::shared_ptr<folly::IOBuf>));
+      readBufferAvailableInternal,
+      void(std::unique_ptr<folly::IOBuf>&));
   GMOCK_METHOD0_(, noexcept, , readEOF, void());
   GMOCK_METHOD1_(, noexcept, , readErr,
                  void(const AsyncSocketException&));
 
   void readBufferAvailable(std::unique_ptr<folly::IOBuf> readBuf)
     noexcept override {
-    readBufferAvailableInternal(
-        folly::to_shared_ptr(std::move(readBuf)));
+    readBufferAvailableInternal(readBuf);
   }
 };
 
@@ -90,4 +96,5 @@ class MockWriteCallback: public AsyncTransportWrapper::WriteCallback {
                  void(size_t, const AsyncSocketException&));
 };
 
-}}
+} // namespace test
+} // namespace folly