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

Unified Diff: remoting/host/screen_recorder_unittest.cc

Issue 7491070: Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up comments Created 9 years, 4 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
Index: remoting/host/screen_recorder_unittest.cc
diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc
index 69650eeade5a77ddea31d47950511c12694dd85f..a1c4f1312f48be49e03bbb3d53e9ee260b2289c3 100644
--- a/remoting/host/screen_recorder_unittest.cc
+++ b/remoting/host/screen_recorder_unittest.cc
@@ -31,13 +31,9 @@ namespace remoting {
namespace {
-ACTION_P2(RunCallback, rects, data) {
- InvalidRects& dirty_rects = data->mutable_dirty_rects();
- InvalidRects temp_rects;
- std::set_union(dirty_rects.begin(), dirty_rects.end(),
- rects.begin(), rects.end(),
- std::inserter(temp_rects, temp_rects.begin()));
- dirty_rects.swap(temp_rects);
+ACTION_P2(RunCallback, region, data) {
+ SkRegion& dirty_region = data->mutable_dirty_region();
+ dirty_region.op(region, SkRegion::kUnion_Op);
arg0->Run(data);
delete arg0;
}
@@ -107,8 +103,7 @@ class ScreenRecorderTest : public testing::Test {
// This test mocks capturer, encoder and network layer to operate one recording
// cycle.
TEST_F(ScreenRecorderTest, OneRecordCycle) {
- InvalidRects update_rects;
- update_rects.insert(gfx::Rect(0, 0, 10, 10));
+ 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);
@@ -119,8 +114,8 @@ TEST_F(ScreenRecorderTest, OneRecordCycle) {
EXPECT_CALL(capturer_, InvalidateFullScreen());
// First the capturer is called.
- EXPECT_CALL(capturer_, CaptureInvalidRects(NotNull()))
- .WillOnce(RunCallback(update_rects, data));
+ EXPECT_CALL(capturer_, CaptureInvalidRegion(NotNull()))
+ .WillOnce(RunCallback(update_region, data));
// Expect the encoder be called.
EXPECT_CALL(*encoder_, Encode(data, false, NotNull()))
@@ -156,8 +151,7 @@ TEST_F(ScreenRecorderTest, OneRecordCycle) {
// ScreenRecorder is instructed to come to a complete stop. We expect the stop
// sequence to be executed successfully.
TEST_F(ScreenRecorderTest, StartAndStop) {
- InvalidRects update_rects;
- update_rects.insert(gfx::Rect(0, 0, 10, 10));
+ 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);
@@ -169,8 +163,8 @@ TEST_F(ScreenRecorderTest, StartAndStop) {
EXPECT_CALL(capturer_, InvalidateFullScreen());
// First the capturer is called.
- EXPECT_CALL(capturer_, CaptureInvalidRects(NotNull()))
- .WillRepeatedly(RunCallback(update_rects, data));
+ EXPECT_CALL(capturer_, CaptureInvalidRegion(NotNull()))
+ .WillRepeatedly(RunCallback(update_region, data));
// Expect the encoder be called.
EXPECT_CALL(*encoder_, Encode(data, false, NotNull()))

Powered by Google App Engine
This is Rietveld 408576698