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

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

Issue 2758713002: Avoid to use the method pointer to Callback<>::Run on gmock tests (Closed)
Patch Set: Created 3 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
OLDNEW
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 "media/base/pipeline_impl.h" 5 #include "media/base/pipeline_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "base/time/clock.h" 22 #include "base/time/clock.h"
23 #include "media/base/fake_text_track_stream.h" 23 #include "media/base/fake_text_track_stream.h"
24 #include "media/base/gmock_callback_support.h" 24 #include "media/base/gmock_callback_support.h"
25 #include "media/base/media_log.h" 25 #include "media/base/media_log.h"
26 #include "media/base/mock_filters.h" 26 #include "media/base/mock_filters.h"
27 #include "media/base/test_helpers.h" 27 #include "media/base/test_helpers.h"
28 #include "media/base/text_renderer.h" 28 #include "media/base/text_renderer.h"
29 #include "media/base/text_track_config.h" 29 #include "media/base/text_track_config.h"
30 #include "media/base/time_delta_interpolator.h" 30 #include "media/base/time_delta_interpolator.h"
31 #include "testing/gmock_mutant.h"
31 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
32 #include "ui/gfx/geometry/size.h" 33 #include "ui/gfx/geometry/size.h"
33 34
34 using ::testing::_; 35 using ::testing::_;
35 using ::testing::AnyNumber; 36 using ::testing::AnyNumber;
37 using ::testing::CreateFunctor;
36 using ::testing::DeleteArg; 38 using ::testing::DeleteArg;
37 using ::testing::DoAll; 39 using ::testing::DoAll;
38 // TODO(scherkus): Remove InSequence after refactoring Pipeline. 40 // TODO(scherkus): Remove InSequence after refactoring Pipeline.
39 using ::testing::InSequence; 41 using ::testing::InSequence;
40 using ::testing::Invoke; 42 using ::testing::Invoke;
41 using ::testing::InvokeWithoutArgs; 43 using ::testing::InvokeWithoutArgs;
42 using ::testing::Mock; 44 using ::testing::Mock;
43 using ::testing::NotNull; 45 using ::testing::NotNull;
44 using ::testing::Return; 46 using ::testing::Return;
45 using ::testing::SaveArg; 47 using ::testing::SaveArg;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 MockDemuxerStreamVector streams; 729 MockDemuxerStreamVector streams;
728 streams.push_back(audio_stream()); 730 streams.push_back(audio_stream());
729 731
730 SetDemuxerExpectations(&streams); 732 SetDemuxerExpectations(&streams);
731 SetRendererExpectations(); 733 SetRendererExpectations();
732 StartPipelineAndExpect(PIPELINE_OK); 734 StartPipelineAndExpect(PIPELINE_OK);
733 735
734 // Trigger additional requests on the pipeline during tear down from error. 736 // Trigger additional requests on the pipeline during tear down from error.
735 base::Callback<void(PipelineStatus)> cb = 737 base::Callback<void(PipelineStatus)> cb =
736 base::Bind(&TestNoCallsAfterError, pipeline_.get(), &message_loop_); 738 base::Bind(&TestNoCallsAfterError, pipeline_.get(), &message_loop_);
737 ON_CALL(callbacks_, OnError(_)) 739 ON_CALL(callbacks_, OnError(_)).WillByDefault(Invoke(CreateFunctor(cb)));
738 .WillByDefault(Invoke(&cb, &base::Callback<void(PipelineStatus)>::Run));
739 740
740 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(5); 741 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(5);
741 742
742 // Seek() isn't called as the demuxer errors out first. 743 // Seek() isn't called as the demuxer errors out first.
743 EXPECT_CALL(*renderer_, Flush(_)) 744 EXPECT_CALL(*renderer_, Flush(_))
744 .WillOnce( 745 .WillOnce(
745 DoAll(SetBufferingState(&renderer_client_, BUFFERING_HAVE_NOTHING), 746 DoAll(SetBufferingState(&renderer_client_, BUFFERING_HAVE_NOTHING),
746 RunClosure<0>())); 747 RunClosure<0>()));
747 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)); 748 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
748 749
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1126 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1126 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1127 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1127 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); 1128 INSTANTIATE_TEARDOWN_TEST(Error, Suspending);
1128 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); 1129 INSTANTIATE_TEARDOWN_TEST(Error, Suspended);
1129 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); 1130 INSTANTIATE_TEARDOWN_TEST(Error, Resuming);
1130 1131
1131 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1132 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1132 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); 1133 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended);
1133 1134
1134 } // namespace media 1135 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698