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

Side by Side Diff: webkit/media/buffered_data_source_unittest.cc

Issue 8399023: Fire canplaythrough event at the proper time for audio/video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « webkit/media/buffered_data_source.cc ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "media/base/media_log.h" 9 #include "media/base/media_log.h"
10 #include "media/base/mock_callback.h" 10 #include "media/base/mock_callback.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ON_CALL(*loader_, range_supported()) 185 ON_CALL(*loader_, range_supported())
186 .WillByDefault(Return(partial_response)); 186 .WillByDefault(Return(partial_response));
187 187
188 ON_CALL(*loader_, url()) 188 ON_CALL(*loader_, url())
189 .WillByDefault(ReturnRef(gurl_)); 189 .WillByDefault(ReturnRef(gurl_));
190 media::PipelineStatus expected_init_status = media::PIPELINE_OK; 190 media::PipelineStatus expected_init_status = media::PIPELINE_OK;
191 if (initialized_ok) { 191 if (initialized_ok) {
192 // Expected loaded or not. 192 // Expected loaded or not.
193 EXPECT_CALL(host_, SetLoaded(loaded)); 193 EXPECT_CALL(host_, SetLoaded(loaded));
194 194
195 // TODO(hclam): The condition for streaming needs to be adjusted. 195 if (instance_size != -1) {
196 if (instance_size != -1 && (loaded || partial_response)) {
197 EXPECT_CALL(host_, SetTotalBytes(instance_size)); 196 EXPECT_CALL(host_, SetTotalBytes(instance_size));
198 if (loaded) 197 if (loaded)
199 EXPECT_CALL(host_, SetBufferedBytes(instance_size)); 198 EXPECT_CALL(host_, SetBufferedBytes(instance_size));
200 else 199 else
201 EXPECT_CALL(host_, SetBufferedBytes(0)); 200 EXPECT_CALL(host_, SetBufferedBytes(0));
202 } else { 201 }
202
203 if (!partial_response || instance_size == -1)
203 EXPECT_CALL(host_, SetStreaming(true)); 204 EXPECT_CALL(host_, SetStreaming(true));
204 } 205
205 } else { 206 } else {
206 expected_init_status = media::PIPELINE_ERROR_NETWORK; 207 expected_init_status = media::PIPELINE_ERROR_NETWORK;
207 EXPECT_CALL(*loader_, Stop()); 208 EXPECT_CALL(*loader_, Stop());
208 } 209 }
209 210
210 // Actual initialization of the data source. 211 // Actual initialization of the data source.
211 data_source_->Initialize(url, 212 data_source_->Initialize(url,
212 media::NewExpectedStatusCB(expected_init_status)); 213 media::NewExpectedStatusCB(expected_init_status));
213 message_loop_->RunAllPending(); 214 message_loop_->RunAllPending();
214 215
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 message_loop_->RunAllPending(); 783 message_loop_->RunAllPending();
783 784
784 // Verify loader changed but still has same bitrate. 785 // Verify loader changed but still has same bitrate.
785 EXPECT_NE(old_loader, data_source_->loader().get()); 786 EXPECT_NE(old_loader, data_source_->loader().get());
786 EXPECT_EQ(2.0f, loader_playback_rate()); 787 EXPECT_EQ(2.0f, loader_playback_rate());
787 788
788 StopDataSource(); 789 StopDataSource();
789 } 790 }
790 791
791 } // namespace webkit_media 792 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/buffered_data_source.cc ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698