Project import generated by Copybara.
PiperOrigin-RevId: 237361882
Change-Id: I109a68f44db867b20f8c6a7732b0ce657133e52a
diff --git a/quic/platform/api/quic_mem_slice_test.cc b/quic/platform/api/quic_mem_slice_test.cc
new file mode 100644
index 0000000..185f536
--- /dev/null
+++ b/quic/platform/api/quic_mem_slice_test.cc
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice.h"
+
+#include "net/third_party/quiche/src/quic/core/quic_simple_buffer_allocator.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+
+namespace quic {
+namespace test {
+namespace {
+
+class QuicMemSliceTest : public QuicTest {
+ public:
+ QuicMemSliceTest() {
+ size_t length = 1024;
+ slice_ = QuicMemSlice(&allocator_, length);
+ orig_data_ = slice_.data();
+ orig_length_ = slice_.length();
+ }
+
+ SimpleBufferAllocator allocator_;
+ QuicMemSlice slice_;
+ const char* orig_data_;
+ size_t orig_length_;
+};
+
+TEST_F(QuicMemSliceTest, MoveConstruct) {
+ QuicMemSlice moved(std::move(slice_));
+ EXPECT_EQ(moved.data(), orig_data_);
+ EXPECT_EQ(moved.length(), orig_length_);
+ EXPECT_EQ(nullptr, slice_.data());
+ EXPECT_EQ(0u, slice_.length());
+ EXPECT_TRUE(slice_.empty());
+}
+
+TEST_F(QuicMemSliceTest, MoveAssign) {
+ QuicMemSlice moved;
+ moved = std::move(slice_);
+ EXPECT_EQ(moved.data(), orig_data_);
+ EXPECT_EQ(moved.length(), orig_length_);
+ EXPECT_EQ(nullptr, slice_.data());
+ EXPECT_EQ(0u, slice_.length());
+ EXPECT_TRUE(slice_.empty());
+}
+
+} // namespace
+} // namespace test
+} // namespace quic