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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include <string> | 8 #include <string> |
6 | 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/callback.h" | 11 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
11 #include "remoting/base/compound_buffer.h" | 14 #include "remoting/base/compound_buffer.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 | 16 |
14 using net::IOBuffer; | 17 using net::IOBuffer; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 104 } |
102 | 105 |
103 bool CompareData(const CompoundBuffer& buffer, char* data, int size) { | 106 bool CompareData(const CompoundBuffer& buffer, char* data, int size) { |
104 scoped_refptr<IOBuffer> buffer_data = buffer.ToIOBufferWithSize(); | 107 scoped_refptr<IOBuffer> buffer_data = buffer.ToIOBufferWithSize(); |
105 return buffer.total_bytes() == size && | 108 return buffer.total_bytes() == size && |
106 memcmp(buffer_data->data(), data, size) == 0; | 109 memcmp(buffer_data->data(), data, size) == 0; |
107 } | 110 } |
108 | 111 |
109 static size_t ReadFromInput(CompoundBufferInputStream* input, | 112 static size_t ReadFromInput(CompoundBufferInputStream* input, |
110 void* data, size_t size) { | 113 void* data, size_t size) { |
111 uint8* out = reinterpret_cast<uint8*>(data); | 114 uint8_t* out = reinterpret_cast<uint8_t*>(data); |
112 int out_size = size; | 115 int out_size = size; |
113 | 116 |
114 const void* in; | 117 const void* in; |
115 int in_size = 0; | 118 int in_size = 0; |
116 | 119 |
117 while (true) { | 120 while (true) { |
118 if (!input->Next(&in, &in_size)) { | 121 if (!input->Next(&in, &in_size)) { |
119 return size - out_size; | 122 return size - out_size; |
120 } | 123 } |
121 EXPECT_GT(in_size, -1); | 124 EXPECT_GT(in_size, -1); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ReadString(&stream, "MultipleArrayInput"); | 272 ReadString(&stream, "MultipleArrayInput"); |
270 EXPECT_TRUE(stream.Skip(6)); | 273 EXPECT_TRUE(stream.Skip(6)); |
271 ReadString(&stream, "f"); | 274 ReadString(&stream, "f"); |
272 ReadString(&stream, "o"); | 275 ReadString(&stream, "o"); |
273 ReadString(&stream, "r"); | 276 ReadString(&stream, "r"); |
274 ReadString(&stream, " "); | 277 ReadString(&stream, " "); |
275 ReadString(&stream, "Chromoting"); | 278 ReadString(&stream, "Chromoting"); |
276 } | 279 } |
277 | 280 |
278 } // namespace remoting | 281 } // namespace remoting |
OLD | NEW |