Index: media/filters/frame_processor_unittest.cc |
diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7b0a9b94c36746f692fc4de895e66be4d37aac29 |
--- /dev/null |
+++ b/media/filters/frame_processor_unittest.cc |
@@ -0,0 +1,121 @@ |
+// Copyright (c) 2014 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 "media/filters/frame_processor.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+/* BIG TODO: test ideas: |
+ |
+START HERE |
+ |
+ |
+ |
+*/ |
+ |
+/* BIG TODO: include these?? |
+using ::testing::_; |
+using ::testing::IsNull; |
+using ::testing::NiceMock; |
+using ::testing::NotNull; |
+using ::testing::Return; |
+using ::testing::StrictMock; |
+*/ |
+ |
+// BIG TODO Actually do some meaningful tests... |
+/* |
+namespace media { |
+ |
+class FrameProcessorTest : public testing::Test { |
+ public: |
+ FrameProcessorTest() : |
+ frame_processor_(new FrameProcessor()) { |
+ // BIG TODO |
+ } |
+ |
+ virtual ~FrameProcessorTest() { |
+ // BIG TODO or remove definition if there is nothing needed here. |
+ } |
+ |
+ // BIG TODO MOCK_METHODs as necessary |
+ |
+ protected: |
+ scoped_ptr<FrameProcessor> frame_processor_; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(FrameProcessorTest); |
+}; |
+ |
+// BIG TODO test description |
+TEST_F(FrameProcessorTest, InitialValues) { |
+ EXPECT_EQ(false, frame_processor_->sequence_mode()); // "segments" initially. |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test initial group_start_timestamp_ value? (should be kNoTimestamp()) |
+ // BIG TODO any way/need to test initial hpet_ value? (should be base::TimeDelta()) |
+} |
+ |
+TEST_F(FrameProcessorTest, RedundantSegmentsModeSetting) { |
+ frame_processor_->SetSequenceMode(false); // Set it to same as initial. |
+ EXPECT_EQ(false, frame_processor_->sequence_mode()); // No change. |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should be kNoTimestamp()) |
+ // BIG TODO any way/need to test hpet_ value? (should be base::TimeDelta()) |
+} |
+ |
+TEST_F(FrameProcessorTest, SetSequenceModeInitially) { |
+ frame_processor_->SetSequenceMode(true); // Set it to "sequence" mode. |
+ EXPECT_EQ(true, frame_processor_->sequence_mode()); // No change. |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should have changed to base::TimeDelta()) |
+ // BIG TODO any way/need to test hpet_ value? (should be base::TimeDelta()) |
+ |
+ frame_processor_->SetSequenceMode(true); // Redundantly set it to "sequence". |
+ EXPECT_EQ(true, frame_processor_->sequence_mode()); // No change. |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should still be base::TimeDelta()) |
+ // BIG TODO any way/need to test hpet_ value? (should be base::TimeDelta()) |
+} |
+ |
+TEST_F(FrameProcessorTest, TimestampOffsetRoundTripInSegmentsMode) { |
+ frame_processor_->SetTimestampOffset(base::TimeDelta()); |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should still be kNoTimestamp()) |
+ |
+ frame_processor_->SetTimestampOffset(base::TimeDelta::FromMicroseconds(1)); |
+ EXPECT_EQ(base::TimeDelta::FromMicroseconds(1), |
+ frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should still be kNoTimestamp()) |
+ |
+ frame_processor_->SetTimestampOffset(base::TimeDelta::FromMicroseconds(-1)); |
+ EXPECT_EQ(base::TimeDelta::FromMicroseconds(-1), |
+ frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should still be kNoTimestamp()) |
+} |
+ |
+TEST_F(FrameProcessorTest, TimestampOffsetRoundTripInSequenceMode) { |
+ frame_processor_->SetSequenceMode(true); // Set it to "sequence" mode. |
+ frame_processor_->SetTimestampOffset(base::TimeDelta()); |
+ EXPECT_EQ(base::TimeDelta(), frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should now be base::TimeDelta()) |
+ |
+ frame_processor_->SetTimestampOffset(base::TimeDelta::FromMicroseconds(1)); |
+ EXPECT_EQ(base::TimeDelta::FromMicroseconds(1), |
+ frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should now be 1us) |
+ |
+ frame_processor_->SetTimestampOffset(base::TimeDelta::FromMicroseconds(-1)); |
+ EXPECT_EQ(base::TimeDelta::FromMicroseconds(-1), |
+ frame_processor_->timestamp_offset()); |
+ // BIG TODO any way/need to test group_start_timestamp_ value? (should now be -1us) |
+} |
+ |
+ |
+// BIG TODO: add some helpers/mocks to feed buffers and intercept results. Will |
+// likely require adding AddId-type-logic or maybe (less likely) just NewFrameCB |
+// constructor param to FrameProcessor. Essentially need to associate tracks or |
+// processed frames-per-track to the CFP algorithm implementation, and capture |
+// these for testing here. |
+ |
+} // namespace media |
+*/ |