| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "media/base/media_log.h" | 7 #include "media/base/media_log.h" |
| 8 #include "media/base/mock_callback.h" | 8 #include "media/base/mock_callback.h" |
| 9 #include "media/base/mock_data_source_host.h" | 9 #include "media/base/mock_data_source_host.h" |
| 10 #include "media/base/mock_filters.h" | 10 #include "media/base/mock_filters.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Accessors for private variables on |data_source_|. | 157 // Accessors for private variables on |data_source_|. |
| 158 BufferedResourceLoader* loader() { | 158 BufferedResourceLoader* loader() { |
| 159 return data_source_->loader_.get(); | 159 return data_source_->loader_.get(); |
| 160 } | 160 } |
| 161 WebURLLoader* url_loader() { | 161 WebURLLoader* url_loader() { |
| 162 return loader()->active_loader_->loader_.get(); | 162 return loader()->active_loader_->loader_.get(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 media::Preload preload() { return data_source_->preload_; } | 165 Preload preload() { return data_source_->preload_; } |
| 166 BufferedResourceLoader::DeferStrategy defer_strategy() { | 166 BufferedResourceLoader::DeferStrategy defer_strategy() { |
| 167 return loader()->defer_strategy_; | 167 return loader()->defer_strategy_; |
| 168 } | 168 } |
| 169 int data_source_bitrate() { return data_source_->bitrate_; } | 169 int data_source_bitrate() { return data_source_->bitrate_; } |
| 170 int data_source_playback_rate() { return data_source_->playback_rate_; } | 170 int data_source_playback_rate() { return data_source_->playback_rate_; } |
| 171 int loader_bitrate() { return loader()->bitrate_; } | 171 int loader_bitrate() { return loader()->bitrate_; } |
| 172 int loader_playback_rate() { return loader()->playback_rate_; } | 172 int loader_playback_rate() { return loader()->playback_rate_; } |
| 173 | 173 |
| 174 | 174 |
| 175 scoped_refptr<MockBufferedDataSource> data_source_; | 175 scoped_refptr<MockBufferedDataSource> data_source_; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 // Verify that the callback was called inside the Stop() call. | 365 // Verify that the callback was called inside the Stop() call. |
| 366 EXPECT_TRUE(stop_done_called); | 366 EXPECT_TRUE(stop_done_called); |
| 367 message_loop_->RunAllPending(); | 367 message_loop_->RunAllPending(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 TEST_F(BufferedDataSourceTest, DefaultValues) { | 370 TEST_F(BufferedDataSourceTest, DefaultValues) { |
| 371 InitializeWith206Response(); | 371 InitializeWith206Response(); |
| 372 | 372 |
| 373 // Ensure we have sane values for default loading scenario. | 373 // Ensure we have sane values for default loading scenario. |
| 374 EXPECT_EQ(media::AUTO, preload()); | 374 EXPECT_EQ(AUTO, preload()); |
| 375 EXPECT_EQ(BufferedResourceLoader::kThresholdDefer, defer_strategy()); | 375 EXPECT_EQ(BufferedResourceLoader::kThresholdDefer, defer_strategy()); |
| 376 | 376 |
| 377 EXPECT_EQ(0, data_source_bitrate()); | 377 EXPECT_EQ(0, data_source_bitrate()); |
| 378 EXPECT_EQ(0.0f, data_source_playback_rate()); | 378 EXPECT_EQ(0.0f, data_source_playback_rate()); |
| 379 EXPECT_EQ(0, loader_bitrate()); | 379 EXPECT_EQ(0, loader_bitrate()); |
| 380 EXPECT_EQ(0.0f, loader_playback_rate()); | 380 EXPECT_EQ(0.0f, loader_playback_rate()); |
| 381 | 381 |
| 382 EXPECT_TRUE(data_source_->loading()); | 382 EXPECT_TRUE(data_source_->loading()); |
| 383 Stop(); | 383 Stop(); |
| 384 } | 384 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 447 |
| 448 // During teardown we'll also report our final network status. | 448 // During teardown we'll also report our final network status. |
| 449 EXPECT_CALL(host_, SetNetworkActivity(false)); | 449 EXPECT_CALL(host_, SetNetworkActivity(false)); |
| 450 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); | 450 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); |
| 451 | 451 |
| 452 EXPECT_TRUE(data_source_->loading()); | 452 EXPECT_TRUE(data_source_->loading()); |
| 453 Stop(); | 453 Stop(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace webkit_media | 456 } // namespace webkit_media |
| OLD | NEW |