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

Unified Diff: remoting/host/video_frame_capturer_unittest.cc

Issue 10790075: Rename Capturer to VideoFrameCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased. Created 8 years, 5 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/host/video_frame_capturer_mac_unittest.cc ('k') | remoting/host/video_frame_capturer_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_frame_capturer_unittest.cc
diff --git a/remoting/host/video_frame_capturer_unittest.cc b/remoting/host/video_frame_capturer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4e857dfbe11bd349ae04cda3f0bd348d01e51add
--- /dev/null
+++ b/remoting/host/video_frame_capturer_unittest.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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_capturer.h"
+
+#include "base/bind.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif // defined(OS_MACOSX)
+#include "remoting/base/capture_data.h"
+#include "remoting/host/host_mock_objects.h"
+#include "remoting/protocol/protocol_mock_objects.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+
+namespace {
+
+bool IsOsSupported() {
+#if defined(OS_MACOSX)
+ // Verify that the OS is at least Snow Leopard (10.6).
+ // Chromoting doesn't support 10.5 or earlier.
+ return base::mac::IsOSSnowLeopardOrLater();
+#else
+ return true;
+#endif
+}
+
+void IgnoreCursorShapeChanged(scoped_ptr<protocol::CursorShapeInfo> info) {
+}
+
+} // namespace
+
+MATCHER(DirtyRegionIsNonEmptyRect, "") {
+ const SkRegion& dirty_region = arg->dirty_region();
+ const SkIRect& dirty_region_bounds = dirty_region.getBounds();
+ if (dirty_region_bounds.isEmpty()) {
+ return false;
+ }
+ return dirty_region == SkRegion(dirty_region_bounds);
+}
+
+class VideoFrameCapturerTest : public testing::Test {
+ protected:
+ virtual void SetUp() OVERRIDE {
+ capturer_.reset(VideoFrameCapturer::Create());
+ }
+
+ scoped_ptr<VideoFrameCapturer> capturer_;
+ MockCaptureCompletedCallback capture_completed_callback_;
+};
+
+TEST_F(VideoFrameCapturerTest, StartCapturer) {
+ if (!IsOsSupported()) {
+ return;
+ }
+
+ capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
+ capturer_->Stop();
+}
+
+#if defined(OS_MACOSX)
+#define MAYBE_Capture DISABLED_Capture
+#else
+#define MAYBE_Capture Capture
+#endif
+
+TEST_F(VideoFrameCapturerTest, MAYBE_Capture) {
+ if (!IsOsSupported()) {
+ return;
+ }
+
+ // Assume that Start() treats the screen as invalid initially.
+ EXPECT_CALL(capture_completed_callback_,
+ CaptureCompletedPtr(DirtyRegionIsNonEmptyRect()));
+
+ capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
+ capturer_->CaptureInvalidRegion(base::Bind(
+ &MockCaptureCompletedCallback::CaptureCompleted,
+ base::Unretained(&capture_completed_callback_)));
+ capturer_->Stop();
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/video_frame_capturer_mac_unittest.cc ('k') | remoting/host/video_frame_capturer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698