OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 memcpy(out, in, in_size); | 131 memcpy(out, in, in_size); |
132 out += in_size; | 132 out += in_size; |
133 out_size -= in_size; | 133 out_size -= in_size; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 static void ReadString(CompoundBufferInputStream* input, | 137 static void ReadString(CompoundBufferInputStream* input, |
138 const std::string& str) { | 138 const std::string& str) { |
139 SCOPED_TRACE(str); | 139 SCOPED_TRACE(str); |
140 scoped_array<char> buffer(new char[str.size() + 1]); | 140 scoped_ptr<char[]> buffer(new char[str.size() + 1]); |
141 buffer[str.size()] = '\0'; | 141 buffer[str.size()] = '\0'; |
142 EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size()); | 142 EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size()); |
143 EXPECT_STREQ(str.data(), buffer.get()); | 143 EXPECT_STREQ(str.data(), buffer.get()); |
144 } | 144 } |
145 | 145 |
146 // Construct and prepare data in the |buffer|. | 146 // Construct and prepare data in the |buffer|. |
147 static void PrepareData(scoped_ptr<CompoundBuffer>* buffer) { | 147 static void PrepareData(scoped_ptr<CompoundBuffer>* buffer) { |
148 static const std::string kTestData = | 148 static const std::string kTestData = |
149 "Hello world!" | 149 "Hello world!" |
150 "This is testing" | 150 "This is testing" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ReadString(&stream, "MultipleArrayInput"); | 269 ReadString(&stream, "MultipleArrayInput"); |
270 EXPECT_TRUE(stream.Skip(6)); | 270 EXPECT_TRUE(stream.Skip(6)); |
271 ReadString(&stream, "f"); | 271 ReadString(&stream, "f"); |
272 ReadString(&stream, "o"); | 272 ReadString(&stream, "o"); |
273 ReadString(&stream, "r"); | 273 ReadString(&stream, "r"); |
274 ReadString(&stream, " "); | 274 ReadString(&stream, " "); |
275 ReadString(&stream, "Chromoting"); | 275 ReadString(&stream, "Chromoting"); |
276 } | 276 } |
277 | 277 |
278 } // namespace remoting | 278 } // namespace remoting |
OLD | NEW |