Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: net/spdy/spdy_pinnable_buffer_piece_test.cc

Issue 2832973003: Split net/spdy into core and chromium subdirectories. (Closed)
Patch Set: Fix some more build rules. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_pinnable_buffer_piece.cc ('k') | net/spdy/spdy_prefixed_buffer_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_pinnable_buffer_piece_test.cc
diff --git a/net/spdy/spdy_pinnable_buffer_piece_test.cc b/net/spdy/spdy_pinnable_buffer_piece_test.cc
deleted file mode 100644
index e4687eee9d887b8c09fd689673ed66e96f545b6a..0000000000000000000000000000000000000000
--- a/net/spdy/spdy_pinnable_buffer_piece_test.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 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/spdy/spdy_pinnable_buffer_piece.h"
-
-#include "net/spdy/platform/api/spdy_string.h"
-#include "net/spdy/spdy_prefixed_buffer_reader.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-
-namespace test {
-
-class SpdyPinnableBufferPieceTest : public ::testing::Test {
- protected:
- SpdyPrefixedBufferReader Build(const SpdyString& prefix,
- const SpdyString& suffix) {
- prefix_ = prefix;
- suffix_ = suffix;
- return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(),
- suffix_.data(), suffix_.length());
- }
- SpdyString prefix_, suffix_;
-};
-
-TEST_F(SpdyPinnableBufferPieceTest, Pin) {
- SpdyPrefixedBufferReader reader = Build("foobar", "");
- SpdyPinnableBufferPiece piece;
- EXPECT_TRUE(reader.ReadN(6, &piece));
-
- // Piece points to underlying prefix storage.
- EXPECT_EQ(SpdyStringPiece("foobar"), SpdyStringPiece(piece));
- EXPECT_FALSE(piece.IsPinned());
- EXPECT_EQ(prefix_.data(), piece.buffer());
-
- piece.Pin();
-
- // Piece now points to allocated storage.
- EXPECT_EQ(SpdyStringPiece("foobar"), SpdyStringPiece(piece));
- EXPECT_TRUE(piece.IsPinned());
- EXPECT_NE(prefix_.data(), piece.buffer());
-
- // Pinning again has no effect.
- const char* buffer = piece.buffer();
- piece.Pin();
- EXPECT_EQ(buffer, piece.buffer());
-}
-
-TEST_F(SpdyPinnableBufferPieceTest, Swap) {
- SpdyPrefixedBufferReader reader = Build("foobar", "");
- SpdyPinnableBufferPiece piece1, piece2;
- EXPECT_TRUE(reader.ReadN(4, &piece1));
- EXPECT_TRUE(reader.ReadN(2, &piece2));
-
- piece1.Pin();
-
- EXPECT_EQ(SpdyStringPiece("foob"), SpdyStringPiece(piece1));
- EXPECT_TRUE(piece1.IsPinned());
- EXPECT_EQ(SpdyStringPiece("ar"), SpdyStringPiece(piece2));
- EXPECT_FALSE(piece2.IsPinned());
-
- piece1.Swap(&piece2);
-
- EXPECT_EQ(SpdyStringPiece("ar"), SpdyStringPiece(piece1));
- EXPECT_FALSE(piece1.IsPinned());
- EXPECT_EQ(SpdyStringPiece("foob"), SpdyStringPiece(piece2));
- EXPECT_TRUE(piece2.IsPinned());
-
- SpdyPinnableBufferPiece empty;
- piece2.Swap(&empty);
-
- EXPECT_EQ(SpdyStringPiece(""), SpdyStringPiece(piece2));
- EXPECT_FALSE(piece2.IsPinned());
-}
-
-} // namespace test
-
-} // namespace net
« no previous file with comments | « net/spdy/spdy_pinnable_buffer_piece.cc ('k') | net/spdy/spdy_prefixed_buffer_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698