summaryrefslogtreecommitdiffstats
path: root/remoting/base/encoder_vp8_unittest.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:19:48 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:19:48 +0000
commitdf10bf173f91818f1f03d409ec8d60265b44675f (patch)
tree27dc201712833ce527da84b15e0e4df73bdd56ec /remoting/base/encoder_vp8_unittest.cc
parentb045a7405237ec931bf137f2c555960fa64a9523 (diff)
downloadchromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.zip
chromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.tar.gz
chromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.tar.bz2
Implement VP8 encoder for chromoting
Added EncoderVp8 with test for chromoting. TEST=remoting_unittests BUG=50235 Review URL: http://codereview.chromium.org/3005036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/encoder_vp8_unittest.cc')
-rw-r--r--remoting/base/encoder_vp8_unittest.cc62
1 files changed, 5 insertions, 57 deletions
diff --git a/remoting/base/encoder_vp8_unittest.cc b/remoting/base/encoder_vp8_unittest.cc
index 0b29830..353b82b 100644
--- a/remoting/base/encoder_vp8_unittest.cc
+++ b/remoting/base/encoder_vp8_unittest.cc
@@ -2,67 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "media/base/data_buffer.h"
-#include "remoting/base/pixel_format.h"
-#include "remoting/host/encoder_vp8.h"
-#include "testing/gmock/include/gmock/gmock.h"
+#include "remoting/base/codec_test.h"
+#include "remoting/base/encoder_vp8.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
-static const int kWidth = 1024;
-static const int kHeight = 768;
-static const PixelFormat kPixelFormat = kPixelFormat_YV12;
-
-static void GenerateData(uint8* data, int size) {
- for (int i = 0; i < size; ++i) {
- data[i] = i;
- }
-}
-
-class EncodeDoneHandler
- : public base::RefCountedThreadSafe<EncodeDoneHandler> {
- public:
- MOCK_METHOD0(EncodeDone, void());
-};
-
-TEST(EncoderVp8Test, SimpleEncode) {
+TEST(EncoderVp8Test, TestEncoder) {
EncoderVp8 encoder;
- encoder.SetSize(kWidth, kHeight);
- encoder.SetPixelFormat(kPixelFormat);
-
- DirtyRects rects;
- rects.push_back(gfx::Rect(kWidth, kHeight));
-
- // Prepare memory for encoding.
- int strides[3];
- strides[0] = kWidth;
- strides[1] = strides[2] = kWidth / 2;
-
- uint8* planes[3];
- planes[0] = new uint8[kWidth * kHeight];
- planes[1] = new uint8[kWidth * kHeight / 4];
- planes[2] = new uint8[kWidth * kHeight / 4];
- GenerateData(planes[0], kWidth * kHeight);
- GenerateData(planes[1], kWidth * kHeight / 4);
- GenerateData(planes[2], kWidth * kHeight / 4);
-
- scoped_refptr<EncodeDoneHandler> handler = new EncodeDoneHandler();
- UpdateStreamPacketHeader* header = new UpdateStreamPacketHeader();
- scoped_refptr<media::DataBuffer> encoded_data;
- bool encode_done = false;
- EXPECT_CALL(*handler, EncodeDone());
- encoder.Encode(rects, const_cast<const uint8**>(planes),
- strides, true, header, &encoded_data, &encode_done,
- NewRunnableMethod(handler.get(),
- &EncodeDoneHandler::EncodeDone));
-
- EXPECT_TRUE(encode_done);
- ASSERT_TRUE(encoded_data.get());
- EXPECT_NE(0u, encoded_data->GetBufferSize());
-
- delete [] planes[0];
- delete [] planes[1];
- delete [] planes[2];
+ TestEncoder(&encoder, false);
}
} // namespace remoting