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

Unified Diff: media/base/android/media_codec_loop_unittest.cc

Issue 2016213003: Separate MediaCodecLoop from MediaCodecAudioDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_codec_loop_unittest.cc
diff --git a/media/base/android/media_codec_loop_unittest.cc b/media/base/android/media_codec_loop_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b29d109affd6b5744005da110d0486b50a789738
--- /dev/null
+++ b/media/base/android/media_codec_loop_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "media/base/android/media_codec_bridge.h"
+#include "media/base/android/media_codec_loop.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+class MockMediaCodecLoopClient : public MediaCodecLoop::Client {
+ public:
+ MOCK_CONST_METHOD0(IsAnyInputPending, bool());
+ MOCK_METHOD0(ProvideInputData, MediaCodecLoop::InputData());
+ MOCK_METHOD1(OnDecodedEos, void(const MediaCodecLoop::OutputBuffer&));
+ MOCK_METHOD1(OnDecodedFrame, bool(const MediaCodecLoop::OutputBuffer&));
+ MOCK_METHOD0(OnOutputFormatChanged, bool());
+ MOCK_METHOD0(OnCodecLoopError, void());
+};
+
+class MediaCodecLoopTest : public testing::Test {
+ public:
+ MediaCodecLoopTest() : client_(new MockMediaCodecLoopClient) {}
+
+ public:
+ std::unique_ptr<MediaCodecLoop> codec_loop_;
+ std::unique_ptr<MockMediaCodecLoopClient> client_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaCodecLoopTest);
+};
+
+TEST_F(MediaCodecLoopTest, TestConstructionWithNullCodec) {
+ std::unique_ptr<MediaCodecBridge> codec;
+ EXPECT_CALL(*client_, OnCodecLoopError()).Times(1);
+ codec_loop_.reset(new MediaCodecLoop(client_.get(), std::move(codec)));
+
+ ASSERT_FALSE(codec_loop_->GetCodec());
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698