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

Side by Side Diff: media/filters/pipeline_controller_unittest.cc

Issue 1904793002: Move Pipeline permanent callbacks into Pipeline::Client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "media/base/mock_filters.h" 13 #include "media/base/mock_filters.h"
14 #include "media/base/pipeline.h" 14 #include "media/base/pipeline.h"
15 #include "media/filters/pipeline_controller.h" 15 #include "media/filters/pipeline_controller.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using ::testing::_; 19 using ::testing::_;
20 using ::testing::DoAll; 20 using ::testing::DoAll;
21 using ::testing::Mock; 21 using ::testing::Mock;
22 using ::testing::NiceMock; 22 using ::testing::NiceMock;
23 using ::testing::Return; 23 using ::testing::Return;
24 using ::testing::SaveArg; 24 using ::testing::SaveArg;
25 using ::testing::StrictMock; 25 using ::testing::StrictMock;
26 26
27 namespace media { 27 namespace media {
28 28
29 class PipelineControllerTest : public ::testing::Test { 29 class PipelineControllerTest : public ::testing::Test, public Pipeline::Client {
30 public: 30 public:
31 PipelineControllerTest() 31 PipelineControllerTest()
32 : pipeline_controller_(&pipeline_, 32 : pipeline_controller_(&pipeline_,
33 base::Bind(&PipelineControllerTest::CreateRenderer, 33 base::Bind(&PipelineControllerTest::CreateRenderer,
34 base::Unretained(this)), 34 base::Unretained(this)),
35 base::Bind(&PipelineControllerTest::OnSeeked, 35 base::Bind(&PipelineControllerTest::OnSeeked,
36 base::Unretained(this)), 36 base::Unretained(this)),
37 base::Bind(&PipelineControllerTest::OnSuspended, 37 base::Bind(&PipelineControllerTest::OnSuspended,
38 base::Unretained(this)), 38 base::Unretained(this)),
39 base::Bind(&PipelineControllerTest::OnError, 39 base::Bind(&PipelineControllerTest::OnError,
40 base::Unretained(this))) {} 40 base::Unretained(this))) {}
41 41
42 ~PipelineControllerTest() override {} 42 ~PipelineControllerTest() override {}
43 43
44 PipelineStatusCB StartPipeline(bool is_streaming, bool is_static) { 44 PipelineStatusCB StartPipeline(bool is_streaming, bool is_static) {
45 EXPECT_FALSE(pipeline_controller_.IsStable()); 45 EXPECT_FALSE(pipeline_controller_.IsStable());
46 PipelineStatusCB start_cb; 46 PipelineStatusCB start_cb;
47 EXPECT_CALL(pipeline_, Start(_, _, _, _, _, _, _, _, _, _)) 47 EXPECT_CALL(pipeline_, Start(_, _, _, _)).WillOnce(SaveArg<3>(&start_cb));
48 .WillOnce(SaveArg<4>(&start_cb)); 48 pipeline_controller_.Start(&demuxer_, this, is_streaming, is_static);
49 pipeline_controller_.Start(&demuxer_, is_streaming, is_static,
50 base::Closure(), PipelineMetadataCB(),
51 BufferingStateCB(), base::Closure(),
52 AddTextTrackCB(), base::Closure());
53 Mock::VerifyAndClear(&pipeline_); 49 Mock::VerifyAndClear(&pipeline_);
54 EXPECT_FALSE(pipeline_controller_.IsStable()); 50 EXPECT_FALSE(pipeline_controller_.IsStable());
55 return start_cb; 51 return start_cb;
56 } 52 }
57 53
58 PipelineStatusCB StartPipeline() { return StartPipeline(false, true); } 54 PipelineStatusCB StartPipeline() { return StartPipeline(false, true); }
59 55
60 PipelineStatusCB StartPipeline_WithDynamicData() { 56 PipelineStatusCB StartPipeline_WithDynamicData() {
61 return StartPipeline(false, false); 57 return StartPipeline(false, false);
62 } 58 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Request a seek to the same time again. 302 // Request a seek to the same time again.
307 pipeline_controller_.Seek(seek_time, true); 303 pipeline_controller_.Seek(seek_time, true);
308 message_loop_.RunUntilIdle(); 304 message_loop_.RunUntilIdle();
309 305
310 // Expect the second seek to trigger when the first seek completes. 306 // Expect the second seek to trigger when the first seek completes.
311 EXPECT_CALL(pipeline_, Seek(seek_time, _)); 307 EXPECT_CALL(pipeline_, Seek(seek_time, _));
312 Complete(seek_cb_1); 308 Complete(seek_cb_1);
313 } 309 }
314 310
315 } // namespace media 311 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698