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

Unified Diff: remoting/host/video_scheduler_unittest.cc

Issue 11363128: Converted VideoFrameCapturer callbacks into a VideoFrameCapturer::Delegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More Mac compilation issues. Created 8 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
« no previous file with comments | « remoting/host/video_scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_scheduler_unittest.cc
diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_scheduler_unittest.cc
index 54b572c7321d48e2495ad349456e68539021c738..8ca7d7a360b362dd201472bf8953242c365d7756 100644
--- a/remoting/host/video_scheduler_unittest.cc
+++ b/remoting/host/video_scheduler_unittest.cc
@@ -34,12 +34,6 @@ namespace remoting {
namespace {
-ACTION_P2(RunCallback, region, data) {
- SkRegion& dirty_region = data->mutable_dirty_region();
- dirty_region.op(region, SkRegion::kUnion_Op);
- arg0.Run(data);
-}
-
ACTION(FinishEncode) {
scoped_ptr<VideoPacket> packet(new VideoPacket());
packet->set_flags(VideoPacket::LAST_PACKET | VideoPacket::LAST_PARTITION);
@@ -82,7 +76,7 @@ MockVideoEncoder::~MockVideoEncoder() {}
class VideoSchedulerTest : public testing::Test {
public:
- VideoSchedulerTest() {
+ VideoSchedulerTest() : size_(SkISize::Make(0, 0)) {
}
virtual void SetUp() OVERRIDE {
@@ -100,6 +94,8 @@ class VideoSchedulerTest : public testing::Test {
&video_stub_);
}
+ void GenerateOnCaptureCompleted();
+
protected:
MessageLoop message_loop_;
scoped_refptr<VideoScheduler> scheduler_;
@@ -111,16 +107,25 @@ class VideoSchedulerTest : public testing::Test {
// The following mock objects are owned by VideoScheduler.
MockVideoEncoder* encoder_;
+ SkISize size_;
+ scoped_refptr<CaptureData> data_;
+
private:
DISALLOW_COPY_AND_ASSIGN(VideoSchedulerTest);
};
+void VideoSchedulerTest::GenerateOnCaptureCompleted() {
+ SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10));
+ data_->mutable_dirty_region().op(update_region, SkRegion::kUnion_Op);
+
+ scheduler_->OnCaptureCompleted(data_);
+}
+
// This test mocks capturer, encoder and network layer to simulate one capture
// cycle. When the first encoded packet is submitted to the network
// VideoScheduler is instructed to come to a complete stop. We expect the stop
// sequence to be executed successfully.
TEST_F(VideoSchedulerTest, StartAndStop) {
- SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10));
DataPlanes planes;
for (int i = 0; i < DataPlanes::kPlaneCount; ++i) {
planes.data[i] = reinterpret_cast<uint8*>(i);
@@ -129,22 +134,23 @@ TEST_F(VideoSchedulerTest, StartAndStop) {
Expectation capturer_start = EXPECT_CALL(capturer_, Start(_));
- SkISize size(SkISize::Make(kWidth, kHeight));
- scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat));
+ size_.set(kWidth, kHeight);
+ data_ = new CaptureData(planes, size_, kFormat);
// Create a RunLoop through which to drive |message_loop_|.
base::RunLoop run_loop;
EXPECT_CALL(capturer_, size_most_recent())
- .WillRepeatedly(ReturnRef(size));
+ .WillRepeatedly(ReturnRef(size_));
// First the capturer is called.
- Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion(_))
+ Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion())
.After(capturer_start)
- .WillRepeatedly(RunCallback(update_region, data));
+ .WillRepeatedly(InvokeWithoutArgs(
+ this, &VideoSchedulerTest::GenerateOnCaptureCompleted));
// Expect the encoder be called.
- EXPECT_CALL(*encoder_, Encode(data, false, _))
+ EXPECT_CALL(*encoder_, Encode(data_, false, _))
.WillRepeatedly(FinishEncode());
// By default delete the arguments when ProcessVideoPacket is received.
« no previous file with comments | « remoting/host/video_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698