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

Unified Diff: remoting/protocol/video_frame_pump_unittest.cc

Issue 1462063004: Move VideoFramePump to remoting/protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: remoting/protocol/video_frame_pump_unittest.cc
diff --git a/remoting/host/video_frame_pump_unittest.cc b/remoting/protocol/video_frame_pump_unittest.cc
similarity index 87%
rename from remoting/host/video_frame_pump_unittest.cc
rename to remoting/protocol/video_frame_pump_unittest.cc
index d6490f41a43948c7e19861b40dadd81db13c9a11..119ad9ba084b127a367fc8e1091b12886755f759 100644
--- a/remoting/host/video_frame_pump_unittest.cc
+++ b/remoting/protocol/video_frame_pump_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/host/video_frame_pump.h"
+#include "remoting/protocol/video_frame_pump.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -12,19 +12,15 @@
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/codec/video_encoder.h"
#include "remoting/codec/video_encoder_verbatim.h"
-#include "remoting/host/desktop_capturer_proxy.h"
-#include "remoting/host/fake_desktop_capturer.h"
-#include "remoting/host/host_mock_objects.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/video.pb.h"
+#include "remoting/protocol/fake_desktop_capturer.h"
#include "remoting/protocol/protocol_mock_objects.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/screen_capturer_mock_objects.h"
-using ::remoting::protocol::MockVideoStub;
-
using ::testing::_;
using ::testing::AtLeast;
using ::testing::DoAll;
@@ -33,6 +29,7 @@ using ::testing::InvokeWithoutArgs;
using ::testing::Return;
namespace remoting {
+namespace protocol {
namespace {
@@ -52,6 +49,20 @@ scoped_ptr<webrtc::DesktopFrame> CreateUnchangedFrame(
return make_scoped_ptr(new webrtc::BasicDesktopFrame(kSize));
}
+class MockVideoEncoder : public VideoEncoder {
+ public:
+ MockVideoEncoder() {}
+ ~MockVideoEncoder() {}
+
+ MOCK_METHOD1(SetLosslessEncode, void(bool));
+ MOCK_METHOD1(SetLosslessColor, void(bool));
+ MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame&));
+
+ scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) {
+ return make_scoped_ptr(EncodePtr(frame));
+ }
+};
+
} // namespace
static const int kWidth = 640;
@@ -162,15 +173,12 @@ TEST_F(VideoFramePumpTest, StartAndStop) {
// When the first ProcessVideoPacket is received we stop the VideoFramePump.
EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
- .WillOnce(DoAll(
- FinishSend(),
- InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)))
+ .WillOnce(DoAll(FinishSend(),
+ InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)))
.RetiresOnSaturation();
// Start video frame capture.
- pump_.reset(new VideoFramePump(encode_task_runner_,
- make_scoped_ptr(new DesktopCapturerProxy(
- capture_task_runner_, capturer.Pass())),
+ pump_.reset(new VideoFramePump(encode_task_runner_, capturer.Pass(),
encoder.Pass(), &video_stub_));
// Run MessageLoop until the first frame is received.
@@ -197,9 +205,7 @@ TEST_F(VideoFramePumpTest, NullFrame) {
.RetiresOnSaturation();
// Start video frame capture.
- pump_.reset(new VideoFramePump(encode_task_runner_,
- make_scoped_ptr(new DesktopCapturerProxy(
- capture_task_runner_, capturer.Pass())),
+ pump_.reset(new VideoFramePump(encode_task_runner_, capturer.Pass(),
encoder.Pass(), &video_stub_));
// Run MessageLoop until the first frame is received..
@@ -227,13 +233,12 @@ TEST_F(VideoFramePumpTest, UnchangedFrame) {
.RetiresOnSaturation();
// Start video frame capture.
- pump_.reset(new VideoFramePump(encode_task_runner_,
- make_scoped_ptr(new DesktopCapturerProxy(
- capture_task_runner_, capturer.Pass())),
+ pump_.reset(new VideoFramePump(encode_task_runner_, capturer.Pass(),
encoder.Pass(), &video_stub_));
- // Run MessageLoop until the first frame is received..
+ // Run MessageLoop until the first frame is received.
run_loop.Run();
}
+} // namespace protocol
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698