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

Side by Side Diff: media/base/composite_filter_unittest.cc

Issue 8897022: Revert 113895 - <video> decode in hardware! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | « media/base/composite_filter.cc ('k') | media/base/filter_collection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "media/base/composite_filter.h" 7 #include "media/base/composite_filter.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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Test adding a null pointer. 372 // Test adding a null pointer.
373 EXPECT_FALSE(composite_->AddFilter(NULL)); 373 EXPECT_FALSE(composite_->AddFilter(NULL));
374 374
375 scoped_refptr<StrictMock<MockFilter> > filter = new StrictMock<MockFilter>(); 375 scoped_refptr<StrictMock<MockFilter> > filter = new StrictMock<MockFilter>();
376 EXPECT_EQ(NULL, filter->host()); 376 EXPECT_EQ(NULL, filter->host());
377 377
378 // Test failing because set_host() hasn't been called yet. 378 // Test failing because set_host() hasn't been called yet.
379 EXPECT_FALSE(composite_->AddFilter(filter)); 379 EXPECT_FALSE(composite_->AddFilter(filter));
380 } 380 }
381 381
382 // Test successful {Add,Remove}Filter() cases. 382 // Test successful AddFilter() cases.
383 TEST_F(CompositeFilterTest, TestAddRemoveFilter) { 383 TEST_F(CompositeFilterTest, TestAddFilter) {
384 composite_->set_host(mock_filter_host_.get()); 384 composite_->set_host(mock_filter_host_.get());
385 385
386 // Add a filter. 386 // Add a filter.
387 scoped_refptr<StrictMock<MockFilter> > filter = new StrictMock<MockFilter>(); 387 scoped_refptr<StrictMock<MockFilter> > filter = new StrictMock<MockFilter>();
388 EXPECT_EQ(NULL, filter->host()); 388 EXPECT_EQ(NULL, filter->host());
389 389
390 EXPECT_TRUE(composite_->AddFilter(filter)); 390 EXPECT_TRUE(composite_->AddFilter(filter));
391
391 EXPECT_TRUE(filter->host() != NULL); 392 EXPECT_TRUE(filter->host() != NULL);
392
393 composite_->RemoveFilter(filter);
394 EXPECT_TRUE(filter->host() == NULL);
395 }
396
397 class CompositeFilterDeathTest : public CompositeFilterTest {};
398
399 // Test failure of RemoveFilter() on an unknown filter.
400 TEST_F(CompositeFilterDeathTest, TestRemoveUnknownFilter) {
401 composite_->set_host(mock_filter_host_.get());
402 // Remove unknown filter.
403 scoped_refptr<StrictMock<MockFilter> > filter = new StrictMock<MockFilter>();
404 EXPECT_DEATH(composite_->RemoveFilter(filter), "");
405 } 393 }
406 394
407 TEST_F(CompositeFilterTest, TestPlay) { 395 TEST_F(CompositeFilterTest, TestPlay) {
408 InSequence sequence; 396 InSequence sequence;
409 397
410 SetupAndAdd2Filters(); 398 SetupAndAdd2Filters();
411 399
412 // Verify successful call to Play(). 400 // Verify successful call to Play().
413 DoPlay(); 401 DoPlay();
414 402
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 NewExpectedStatusCB(PIPELINE_OK)); 782 NewExpectedStatusCB(PIPELINE_OK));
795 783
796 // Issue a Play() and expect no errors. 784 // Issue a Play() and expect no errors.
797 composite_->Play(NewExpectedClosure()); 785 composite_->Play(NewExpectedClosure());
798 786
799 // Issue a Stop() and expect no errors. 787 // Issue a Stop() and expect no errors.
800 composite_->Stop(NewExpectedClosure()); 788 composite_->Stop(NewExpectedClosure());
801 } 789 }
802 790
803 } // namespace media 791 } // namespace media
OLDNEW
« no previous file with comments | « media/base/composite_filter.cc ('k') | media/base/filter_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698