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 #ifndef NET_BASE_TEST_DATA_STREAM_H_ | 5 #ifndef NET_BASE_TEST_DATA_STREAM_H_ |
6 #define NET_BASE_TEST_DATA_STREAM_H_ | 6 #define NET_BASE_TEST_DATA_STREAM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string.h> // for memcpy(). | 9 #include <string.h> // for memcpy(). |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.h" |
12 | 12 |
13 // This is a class for generating an infinite stream of data which can be | 13 // This is a class for generating an infinite stream of data which can be |
14 // verified independently to be the correct stream of data. | 14 // verified independently to be the correct stream of data. |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class NET_API TestDataStream { | 18 class NET_EXPORT TestDataStream { |
19 public: | 19 public: |
20 TestDataStream(); | 20 TestDataStream(); |
21 | 21 |
22 // Fill |buffer| with |length| bytes of data from the stream. | 22 // Fill |buffer| with |length| bytes of data from the stream. |
23 void GetBytes(char* buffer, int length); | 23 void GetBytes(char* buffer, int length); |
24 | 24 |
25 // Verify that |buffer| contains the expected next |length| bytes from the | 25 // Verify that |buffer| contains the expected next |length| bytes from the |
26 // stream. Returns true if correct, false otherwise. | 26 // stream. Returns true if correct, false otherwise. |
27 bool VerifyBytes(const char *buffer, int length); | 27 bool VerifyBytes(const char *buffer, int length); |
28 | 28 |
(...skipping 10 matching lines...) Expand all Loading... |
39 | 39 |
40 int index_; | 40 int index_; |
41 int bytes_remaining_; | 41 int bytes_remaining_; |
42 char buffer_[16]; | 42 char buffer_[16]; |
43 char* buffer_ptr_; | 43 char* buffer_ptr_; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace net | 46 } // namespace net |
47 | 47 |
48 #endif // NET_BASE_TEST_DATA_STREAM_H_ | 48 #endif // NET_BASE_TEST_DATA_STREAM_H_ |
OLD | NEW |