| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/media/cma/base/buffering_controller.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 5 #include "base/bind.h" | 9 #include "base/bind.h" |
| 6 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 7 #include "base/logging.h" | 11 #include "base/logging.h" |
| 8 #include "base/macros.h" | 12 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 11 #include "chromecast/media/cma/base/buffering_controller.h" | |
| 12 #include "chromecast/media/cma/base/buffering_state.h" | 14 #include "chromecast/media/cma/base/buffering_state.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 17 |
| 16 namespace chromecast { | 18 namespace chromecast { |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| 20 | 22 |
| 21 class MockBufferingControllerClient { | 23 class MockBufferingControllerClient { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 } | 38 } |
| 37 | 39 |
| 38 } // namespace | 40 } // namespace |
| 39 | 41 |
| 40 class BufferingControllerTest : public testing::Test { | 42 class BufferingControllerTest : public testing::Test { |
| 41 public: | 43 public: |
| 42 BufferingControllerTest(); | 44 BufferingControllerTest(); |
| 43 ~BufferingControllerTest() override; | 45 ~BufferingControllerTest() override; |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 scoped_ptr<BufferingController> buffering_controller_; | 48 std::unique_ptr<BufferingController> buffering_controller_; |
| 47 | 49 |
| 48 MockBufferingControllerClient client_; | 50 MockBufferingControllerClient client_; |
| 49 | 51 |
| 50 // Buffer level under the low level threshold. | 52 // Buffer level under the low level threshold. |
| 51 base::TimeDelta d1_; | 53 base::TimeDelta d1_; |
| 52 | 54 |
| 53 // Buffer level between the low and the high level. | 55 // Buffer level between the low and the high level. |
| 54 base::TimeDelta d2_; | 56 base::TimeDelta d2_; |
| 55 | 57 |
| 56 // Buffer level above the high level. | 58 // Buffer level above the high level. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 buffering_controller_->AddStream("test"); | 127 buffering_controller_->AddStream("test"); |
| 126 buffering_state->SetMediaTime(base::TimeDelta()); | 128 buffering_state->SetMediaTime(base::TimeDelta()); |
| 127 | 129 |
| 128 EXPECT_CALL(client_, OnBufferingNotification(false)).Times(1); | 130 EXPECT_CALL(client_, OnBufferingNotification(false)).Times(1); |
| 129 buffering_state->NotifyEos(); | 131 buffering_state->NotifyEos(); |
| 130 EXPECT_EQ(buffering_state->GetState(), BufferingState::kEosReached); | 132 EXPECT_EQ(buffering_state->GetState(), BufferingState::kEosReached); |
| 131 } | 133 } |
| 132 | 134 |
| 133 } // namespace media | 135 } // namespace media |
| 134 } // namespace chromecast | 136 } // namespace chromecast |
| OLD | NEW |