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

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

Issue 6686061: PipelineError is dead. Long live PipelineStatus! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responses to 2nd CR Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/simple_data_source.cc » ('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/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "media/base/mock_callback.h" 8 #include "media/base/mock_callback.h"
9 #include "media/base/mock_filter_host.h" 9 #include "media/base/mock_filter_host.h"
10 #include "media/base/mock_filters.h" 10 #include "media/base/mock_filters.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // "callback" parameter. 161 // "callback" parameter.
162 ON_CALL(*loader_, Read(_, _, _ , _)) 162 ON_CALL(*loader_, Read(_, _, _ , _))
163 .WillByDefault(DeleteArg<3>()); 163 .WillByDefault(DeleteArg<3>());
164 164
165 ON_CALL(*loader_, instance_size()) 165 ON_CALL(*loader_, instance_size())
166 .WillByDefault(Return(instance_size)); 166 .WillByDefault(Return(instance_size));
167 ON_CALL(*loader_, partial_response()) 167 ON_CALL(*loader_, partial_response())
168 .WillByDefault(Return(partial_response)); 168 .WillByDefault(Return(partial_response));
169 ON_CALL(*loader_, url()) 169 ON_CALL(*loader_, url())
170 .WillByDefault(ReturnRef(gurl_)); 170 .WillByDefault(ReturnRef(gurl_));
171 media::PipelineError expected_init_error = media::PIPELINE_OK; 171 media::PipelineStatus expected_init_status = media::PIPELINE_OK;
172 if (initialized_ok) { 172 if (initialized_ok) {
173 // Expected loaded or not. 173 // Expected loaded or not.
174 EXPECT_CALL(host_, SetLoaded(loaded)); 174 EXPECT_CALL(host_, SetLoaded(loaded));
175 175
176 // TODO(hclam): The condition for streaming needs to be adjusted. 176 // TODO(hclam): The condition for streaming needs to be adjusted.
177 if (instance_size != -1 && (loaded || partial_response)) { 177 if (instance_size != -1 && (loaded || partial_response)) {
178 EXPECT_CALL(host_, SetTotalBytes(instance_size)); 178 EXPECT_CALL(host_, SetTotalBytes(instance_size));
179 if (loaded) 179 if (loaded)
180 EXPECT_CALL(host_, SetBufferedBytes(instance_size)); 180 EXPECT_CALL(host_, SetBufferedBytes(instance_size));
181 else 181 else
182 EXPECT_CALL(host_, SetBufferedBytes(0)); 182 EXPECT_CALL(host_, SetBufferedBytes(0));
183 } else { 183 } else {
184 EXPECT_CALL(host_, SetStreaming(true)); 184 EXPECT_CALL(host_, SetStreaming(true));
185 } 185 }
186 } else { 186 } else {
187 expected_init_error = media::PIPELINE_ERROR_NETWORK; 187 expected_init_status = media::PIPELINE_ERROR_NETWORK;
188 EXPECT_CALL(*loader_, Stop()); 188 EXPECT_CALL(*loader_, Stop());
189 } 189 }
190 190
191 // Actual initialization of the data source. 191 // Actual initialization of the data source.
192 data_source_->Initialize(url, 192 data_source_->Initialize(url,
193 media::NewExpectedStatusCallback(expected_init_error)); 193 media::NewExpectedStatusCallback(expected_init_status));
194 message_loop_->RunAllPending(); 194 message_loop_->RunAllPending();
195 195
196 if (initialized_ok) { 196 if (initialized_ok) {
197 // Verify the size of the data source. 197 // Verify the size of the data source.
198 int64 size; 198 int64 size;
199 if (instance_size != -1 && (loaded || partial_response)) { 199 if (instance_size != -1 && (loaded || partial_response)) {
200 EXPECT_TRUE(data_source_->GetSize(&size)); 200 EXPECT_TRUE(data_source_->GetSize(&size));
201 EXPECT_EQ(instance_size, size); 201 EXPECT_EQ(instance_size, size);
202 } else { 202 } else {
203 EXPECT_TRUE(data_source_->IsStreaming()); 203 EXPECT_TRUE(data_source_->IsStreaming());
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 data_source_->Stop(media::NewExpectedCallback()); 549 data_source_->Stop(media::NewExpectedCallback());
550 550
551 // Allow cleanup task to run. 551 // Allow cleanup task to run.
552 message_loop_->RunAllPending(); 552 message_loop_->RunAllPending();
553 553
554 // Verify that Read() was not called on the loader. 554 // Verify that Read() was not called on the loader.
555 EXPECT_FALSE(read_called); 555 EXPECT_FALSE(read_called);
556 } 556 }
557 557
558 } // namespace webkit_glue 558 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/simple_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698