| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 void ConfirmBufferState(int backward_bytes, | 255 void ConfirmBufferState(int backward_bytes, |
| 256 int backward_capacity, | 256 int backward_capacity, |
| 257 int forward_bytes, | 257 int forward_bytes, |
| 258 int forward_capacity) { | 258 int forward_capacity) { |
| 259 EXPECT_EQ(backward_bytes, loader_->buffer_.backward_bytes()); | 259 EXPECT_EQ(backward_bytes, loader_->buffer_.backward_bytes()); |
| 260 EXPECT_EQ(backward_capacity, loader_->buffer_.backward_capacity()); | 260 EXPECT_EQ(backward_capacity, loader_->buffer_.backward_capacity()); |
| 261 EXPECT_EQ(forward_bytes, loader_->buffer_.forward_bytes()); | 261 EXPECT_EQ(forward_bytes, loader_->buffer_.forward_bytes()); |
| 262 EXPECT_EQ(forward_capacity, loader_->buffer_.forward_capacity()); | 262 EXPECT_EQ(forward_capacity, loader_->buffer_.forward_capacity()); |
| 263 EXPECT_EQ(backward_bytes + forward_bytes, loader_->GetMemoryUsage()); |
| 263 } | 264 } |
| 264 | 265 |
| 265 void ConfirmLoaderBufferBackwardCapacity(int expected_backward_capacity) { | 266 void ConfirmLoaderBufferBackwardCapacity(int expected_backward_capacity) { |
| 266 EXPECT_EQ(loader_->buffer_.backward_capacity(), | 267 EXPECT_EQ(loader_->buffer_.backward_capacity(), |
| 267 expected_backward_capacity); | 268 expected_backward_capacity); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void ConfirmLoaderBufferForwardCapacity(int expected_forward_capacity) { | 271 void ConfirmLoaderBufferForwardCapacity(int expected_forward_capacity) { |
| 271 EXPECT_EQ(loader_->buffer_.forward_capacity(), expected_forward_capacity); | 272 EXPECT_EQ(loader_->buffer_.forward_capacity(), expected_forward_capacity); |
| 272 } | 273 } |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 | 1153 |
| 1153 // As soon as we have received enough data to fulfill the read, defer. | 1154 // As soon as we have received enough data to fulfill the read, defer. |
| 1154 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); | 1155 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); |
| 1155 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); | 1156 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); |
| 1156 WriteLoader(19, 1); | 1157 WriteLoader(19, 1); |
| 1157 VerifyBuffer(buffer, 10, 10); | 1158 VerifyBuffer(buffer, 10, 10); |
| 1158 EXPECT_FALSE(HasActiveLoader()); | 1159 EXPECT_FALSE(HasActiveLoader()); |
| 1159 } | 1160 } |
| 1160 | 1161 |
| 1161 } // namespace media | 1162 } // namespace media |
| OLD | NEW |