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

Unified Diff: remoting/base/encoder_vp8_unittest.cc

Issue 3005036: Implement VP8 encoder for chromoting (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: just uploading Created 10 years, 3 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
« no previous file with comments | « remoting/base/encoder_vp8.cc ('k') | remoting/base/protocol/chromotocol.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/encoder_vp8_unittest.cc
diff --git a/remoting/base/encoder_vp8_unittest.cc b/remoting/base/encoder_vp8_unittest.cc
index 0b2983051ed6f2810d14da0421b7b29ef3b95512..353b82b7ca6bb6a3086f37de668dd48dbd5ae4a8 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
« no previous file with comments | « remoting/base/encoder_vp8.cc ('k') | remoting/base/protocol/chromotocol.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698