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

Unified Diff: net/base/test_data_stream.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/test_data_stream.h ('k') | net/base/trace_net_log_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/test_data_stream.cc
diff --git a/net/base/test_data_stream.cc b/net/base/test_data_stream.cc
deleted file mode 100644
index 66728043011aba08e9e898c34f84510f5b8fb7d5..0000000000000000000000000000000000000000
--- a/net/base/test_data_stream.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/base/test_data_stream.h"
-
-namespace net {
-
-TestDataStream::TestDataStream() {
- Reset();
-}
-
-// Fill |buffer| with |length| bytes of data from the stream.
-void TestDataStream::GetBytes(char* buffer, int length) {
- while (length) {
- AdvanceIndex();
- int bytes_to_copy = std::min(length, bytes_remaining_);
- memcpy(buffer, buffer_ptr_, bytes_to_copy);
- buffer += bytes_to_copy;
- Consume(bytes_to_copy);
- length -= bytes_to_copy;
- }
-}
-
-bool TestDataStream::VerifyBytes(const char *buffer, int length) {
- while (length) {
- AdvanceIndex();
- int bytes_to_compare = std::min(length, bytes_remaining_);
- if (memcmp(buffer, buffer_ptr_, bytes_to_compare))
- return false;
- Consume(bytes_to_compare);
- length -= bytes_to_compare;
- buffer += bytes_to_compare;
- }
- return true;
-}
-
-void TestDataStream::Reset() {
- index_ = 0;
- bytes_remaining_ = 0;
- buffer_ptr_ = buffer_;
-}
-
-// If there is no data spilled over from the previous index, advance the
-// index and fill the buffer.
-void TestDataStream::AdvanceIndex() {
- if (bytes_remaining_ == 0) {
- // Convert it to ascii, but don't bother to reverse it.
- // (e.g. 12345 becomes "54321")
- int val = index_++;
- do {
- buffer_[bytes_remaining_++] = (val % 10) + '0';
- } while ((val /= 10) > 0);
- buffer_[bytes_remaining_++] = '.';
- }
-}
-
-// Consume data from the spill buffer.
-void TestDataStream::Consume(int bytes) {
- bytes_remaining_ -= bytes;
- if (bytes_remaining_)
- buffer_ptr_ += bytes;
- else
- buffer_ptr_ = buffer_;
-}
-
-} // namespace net
-
« no previous file with comments | « net/base/test_data_stream.h ('k') | net/base/trace_net_log_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698