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

Side by Side Diff: net/spdy/spdy_prefixed_buffer_reader_test.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_prefixed_buffer_reader.h" 5 #include "net/spdy/spdy_prefixed_buffer_reader.h"
6 6
7 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace test { 12 namespace test {
13 13
14 using base::StringPiece; 14 using base::StringPiece;
15 using testing::ElementsAreArray; 15 using testing::ElementsAreArray;
16 16
17 class SpdyPrefixedBufferReaderTest : public ::testing::Test { 17 class SpdyPrefixedBufferReaderTest : public ::testing::Test {
18 protected: 18 protected:
19 SpdyPrefixedBufferReader Build(std::string prefix, std::string suffix) { 19 SpdyPrefixedBufferReader Build(const std::string& prefix,
20 const std::string& suffix) {
20 prefix_ = prefix; 21 prefix_ = prefix;
21 suffix_ = suffix; 22 suffix_ = suffix;
22 return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(), 23 return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(),
23 suffix_.data(), suffix_.length()); 24 suffix_.data(), suffix_.length());
24 } 25 }
25 std::string prefix_, suffix_; 26 std::string prefix_, suffix_;
26 }; 27 };
27 28
28 TEST_F(SpdyPrefixedBufferReaderTest, ReadRawFromPrefix) { 29 TEST_F(SpdyPrefixedBufferReaderTest, ReadRawFromPrefix) {
29 SpdyPrefixedBufferReader reader = Build("foobar", ""); 30 SpdyPrefixedBufferReader reader = Build("foobar", "");
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 EXPECT_EQ(1u, reader.Available()); 121 EXPECT_EQ(1u, reader.Available());
121 122
122 EXPECT_TRUE(reader.ReadN(1, buffer)); 123 EXPECT_TRUE(reader.ReadN(1, buffer));
123 EXPECT_THAT(buffer, ElementsAreArray("lec4")); 124 EXPECT_THAT(buffer, ElementsAreArray("lec4"));
124 EXPECT_EQ(0u, reader.Available()); 125 EXPECT_EQ(0u, reader.Available());
125 } 126 }
126 127
127 } // namespace test 128 } // namespace test
128 129
129 } // namespace net 130 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698