summaryrefslogtreecommitdiffstats
path: root/remoting/host/capturer_mac_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host/capturer_mac_unittest.cc')
-rw-r--r--remoting/host/capturer_mac_unittest.cc40
1 files changed, 20 insertions, 20 deletions
diff --git a/remoting/host/capturer_mac_unittest.cc b/remoting/host/capturer_mac_unittest.cc
index e28b841..681282b 100644
--- a/remoting/host/capturer_mac_unittest.cc
+++ b/remoting/host/capturer_mac_unittest.cc
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "remoting/base/types.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
@@ -22,11 +21,12 @@ class CapturerMacTest : public testing::Test {
}
void AddDirtyRect() {
- rects_.insert(gfx::Rect(0, 0, 10, 10));
+ SkIRect rect = SkIRect::MakeXYWH(0, 0, 10, 10);
+ region_.op(rect, SkRegion::kUnion_Op);
}
scoped_ptr<Capturer> capturer_;
- InvalidRects rects_;
+ SkRegion region_;
};
// CapturerCallback1 verifies that the whole screen is initially dirty.
@@ -44,21 +44,20 @@ void CapturerCallback1::CaptureDoneCallback(
CGDirectDisplayID mainDevice = CGMainDisplayID();
int width = CGDisplayPixelsWide(mainDevice);
int height = CGDisplayPixelsHigh(mainDevice);
- InvalidRects initial_rect;
- initial_rect.insert(gfx::Rect(0, 0, width, height));
- EXPECT_EQ(initial_rect, capture_data->dirty_rects());
+ SkRegion initial_region(SkIRect::MakeXYWH(0, 0, width, height));
+ EXPECT_EQ(initial_region, capture_data->dirty_region());
}
// CapturerCallback2 verifies that a rectangle explicitly marked as dirty is
// propagated correctly.
class CapturerCallback2 {
public:
- explicit CapturerCallback2(const InvalidRects& expected_dirty_rects)
- : expected_dirty_rects_(expected_dirty_rects) { }
+ explicit CapturerCallback2(const SkRegion& expected_dirty_region)
+ : expected_dirty_region_(expected_dirty_region) { }
void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
protected:
- InvalidRects expected_dirty_rects_;
+ SkRegion expected_dirty_region_;
private:
DISALLOW_COPY_AND_ASSIGN(CapturerCallback2);
@@ -70,7 +69,7 @@ void CapturerCallback2::CaptureDoneCallback(
int width = CGDisplayPixelsWide(mainDevice);
int height = CGDisplayPixelsHigh(mainDevice);
- EXPECT_EQ(expected_dirty_rects_, capture_data->dirty_rects());
+ EXPECT_EQ(expected_dirty_region_, capture_data->dirty_region());
EXPECT_EQ(width, capture_data->size().width());
EXPECT_EQ(height, capture_data->size().height());
const DataPlanes &planes = capture_data->data_planes();
@@ -89,13 +88,13 @@ TEST_F(CapturerMacTest, Capture) {
SCOPED_TRACE("");
// Check that we get an initial full-screen updated.
CapturerCallback1 callback1;
- capturer_->CaptureInvalidRects(
+ capturer_->CaptureInvalidRegion(
NewCallback(&callback1, &CapturerCallback1::CaptureDoneCallback));
// Check that subsequent dirty rects are propagated correctly.
AddDirtyRect();
- CapturerCallback2 callback2(rects_);
- capturer_->InvalidateRects(rects_);
- capturer_->CaptureInvalidRects(
+ CapturerCallback2 callback2(region_);
+ capturer_->InvalidateRegion(region_);
+ capturer_->CaptureInvalidRegion(
NewCallback(&callback2, &CapturerCallback2::CaptureDoneCallback));
}
@@ -103,13 +102,14 @@ TEST_F(CapturerMacTest, Capture) {
namespace gfx {
-std::ostream& operator<<(std::ostream& out,
- const remoting::InvalidRects& rects) {
- for (remoting::InvalidRects::const_iterator i = rects.begin();
- i != rects.end();
- ++i) {
- out << *i << std::endl;
+std::ostream& operator<<(std::ostream& out, const SkRegion& region) {
+ out << "SkRegion(";
+ for (SkRegion::Iterator i(region); !i.done(); i.next()) {
+ const SkIRect& r = i.rect();
+ out << "(" << r.fLeft << "," << r.fTop << ","
+ << r.fRight << "," << r.fBottom << ")";
}
+ out << ")";
return out;
}