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

Side by Side Diff: net/base/test_data_stream.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/base/test_data_directory.cc ('k') | net/base/test_data_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_TEST_DATA_STREAM_H_
6 #define NET_BASE_TEST_DATA_STREAM_H_
7
8 #include <string.h> // for memcpy().
9 #include <algorithm>
10 #include "net/base/net_export.h"
11
12 // This is a class for generating an infinite stream of data which can be
13 // verified independently to be the correct stream of data.
14
15 namespace net {
16
17 class NET_EXPORT TestDataStream {
18 public:
19 TestDataStream();
20
21 // Fill |buffer| with |length| bytes of data from the stream.
22 void GetBytes(char* buffer, int length);
23
24 // Verify that |buffer| contains the expected next |length| bytes from the
25 // stream. Returns true if correct, false otherwise.
26 bool VerifyBytes(const char *buffer, int length);
27
28 // Resets all the data.
29 void Reset();
30
31 private:
32 // If there is no data spilled over from the previous index, advance the
33 // index and fill the buffer.
34 void AdvanceIndex();
35
36 // Consume data from the spill buffer.
37 void Consume(int bytes);
38
39 int index_;
40 int bytes_remaining_;
41 char buffer_[16];
42 char* buffer_ptr_;
43 };
44
45 } // namespace net
46
47 #endif // NET_BASE_TEST_DATA_STREAM_H_
OLDNEW
« no previous file with comments | « net/base/test_data_directory.cc ('k') | net/base/test_data_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698