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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 static const int kMinBufferCapacity = 2 * 1024 * 1024; | 285 static const int kMinBufferCapacity = 2 * 1024 * 1024; |
286 EXPECT_GE(loader_->buffer_.forward_capacity(), kMinBufferCapacity); | 286 EXPECT_GE(loader_->buffer_.forward_capacity(), kMinBufferCapacity); |
287 EXPECT_GE(loader_->buffer_.backward_capacity(), kMinBufferCapacity); | 287 EXPECT_GE(loader_->buffer_.backward_capacity(), kMinBufferCapacity); |
288 | 288 |
289 // Corresponds to value defined in buffered_resource_loader.cc. | 289 // Corresponds to value defined in buffered_resource_loader.cc. |
290 static const int kMaxBufferCapacity = 20 * 1024 * 1024; | 290 static const int kMaxBufferCapacity = 20 * 1024 * 1024; |
291 EXPECT_LE(loader_->buffer_.forward_capacity(), kMaxBufferCapacity); | 291 EXPECT_LE(loader_->buffer_.forward_capacity(), kMaxBufferCapacity); |
292 EXPECT_LE(loader_->buffer_.backward_capacity(), kMaxBufferCapacity); | 292 EXPECT_LE(loader_->buffer_.backward_capacity(), kMaxBufferCapacity); |
293 } | 293 } |
294 | 294 |
295 bool HasActiveLoader() { return loader_->active_loader_; } | 295 bool HasActiveLoader() { return !!loader_->active_loader_; } |
296 | 296 |
297 MOCK_METHOD1(StartCallback, void(BufferedResourceLoader::Status)); | 297 MOCK_METHOD1(StartCallback, void(BufferedResourceLoader::Status)); |
298 MOCK_METHOD2(ReadCallback, void(BufferedResourceLoader::Status, int)); | 298 MOCK_METHOD2(ReadCallback, void(BufferedResourceLoader::Status, int)); |
299 MOCK_METHOD1(LoadingCallback, void(BufferedResourceLoader::LoadingState)); | 299 MOCK_METHOD1(LoadingCallback, void(BufferedResourceLoader::LoadingState)); |
300 MOCK_METHOD1(ProgressCallback, void(int64_t)); | 300 MOCK_METHOD1(ProgressCallback, void(int64_t)); |
301 | 301 |
302 protected: | 302 protected: |
303 GURL gurl_; | 303 GURL gurl_; |
304 int64_t first_position_; | 304 int64_t first_position_; |
305 int64_t last_position_; | 305 int64_t last_position_; |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 | 1163 |
1164 // As soon as we have received enough data to fulfill the read, defer. | 1164 // As soon as we have received enough data to fulfill the read, defer. |
1165 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); | 1165 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); |
1166 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); | 1166 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); |
1167 WriteLoader(19, 1); | 1167 WriteLoader(19, 1); |
1168 VerifyBuffer(buffer, 10, 10); | 1168 VerifyBuffer(buffer, 10, 10); |
1169 EXPECT_FALSE(HasActiveLoader()); | 1169 EXPECT_FALSE(HasActiveLoader()); |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace media | 1172 } // namespace media |
OLD | NEW |