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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void TestCropBack(int pos, int size) { | 67 void TestCropBack(int pos, int size) { |
68 CompoundBuffer cropped; | 68 CompoundBuffer cropped; |
69 cropped.CopyFrom(target_, 0, target_.total_bytes()); | 69 cropped.CopyFrom(target_, 0, target_.total_bytes()); |
70 cropped.CropBack(pos); | 70 cropped.CropBack(pos); |
71 EXPECT_TRUE(CompareData(cropped, data_->data(), | 71 EXPECT_TRUE(CompareData(cropped, data_->data(), |
72 target_.total_bytes() - pos)); | 72 target_.total_bytes() - pos)); |
73 } | 73 } |
74 | 74 |
75 protected: | 75 protected: |
76 virtual void SetUp() { | 76 void SetUp() override { |
77 data_ = new IOBuffer(kDataSize); | 77 data_ = new IOBuffer(kDataSize); |
78 for (int i = 0; i < kDataSize; ++i) { | 78 for (int i = 0; i < kDataSize; ++i) { |
79 data_->data()[i] = i; | 79 data_->data()[i] = i; |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 // Iterate over chunks of data with sizes specified in |sizes| in the | 83 // Iterate over chunks of data with sizes specified in |sizes| in the |
84 // interval [0..kDataSize]. |function| is called for each chunk. | 84 // interval [0..kDataSize]. |function| is called for each chunk. |
85 void IterateOverPieces(const int sizes[], | 85 void IterateOverPieces(const int sizes[], |
86 const base::Callback<void(int, int)>& function) { | 86 const base::Callback<void(int, int)>& function) { |
(...skipping 182 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 |