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

Side by Side Diff: remoting/host/capturer_mac_unittest.cc

Issue 3013015: Initial pass at integrating Differ into the chromoting host code.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/capturer_mac.cc ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <ApplicationServices/ApplicationServices.h> 5 #include <ApplicationServices/ApplicationServices.h>
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "remoting/base/types.h"
11 #include "remoting/host/capturer_mac.h" 12 #include "remoting/host/capturer_mac.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 class CapturerMacTest : public testing::Test { 17 class CapturerMacTest : public testing::Test {
17 protected: 18 protected:
18 virtual void SetUp() { 19 virtual void SetUp() {
19 capturer_.reset(new CapturerMac()); 20 capturer_.reset(new CapturerMac());
20 capturer_->ScreenConfigurationChanged(); 21 capturer_->ScreenConfigurationChanged();
21 rects_.push_back(gfx::Rect(0, 0, 10, 10)); 22 rects_.insert(gfx::Rect(0, 0, 10, 10));
22 } 23 }
23 24
24 scoped_ptr<CapturerMac> capturer_; 25 scoped_ptr<CapturerMac> capturer_;
25 RectVector rects_; 26 InvalidRects rects_;
26 }; 27 };
27 28
28 class CapturerCallback { 29 class CapturerCallback {
29 public: 30 public:
30 explicit CapturerCallback(const RectVector& rects) : rects_(rects) { } 31 explicit CapturerCallback(const InvalidRects& rects) : rects_(rects) { }
31 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); 32 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
32 33
33 protected: 34 protected:
34 RectVector rects_; 35 InvalidRects rects_;
35 36
36 private: 37 private:
37 DISALLOW_COPY_AND_ASSIGN(CapturerCallback); 38 DISALLOW_COPY_AND_ASSIGN(CapturerCallback);
38 }; 39 };
39 40
40 void CapturerCallback::CaptureDoneCallback( 41 void CapturerCallback::CaptureDoneCallback(
41 scoped_refptr<CaptureData> capture_data) { 42 scoped_refptr<CaptureData> capture_data) {
42 CGDirectDisplayID mainDevice = CGMainDisplayID(); 43 CGDirectDisplayID mainDevice = CGMainDisplayID();
43 int width = CGDisplayPixelsWide(mainDevice); 44 int width = CGDisplayPixelsWide(mainDevice);
44 int height = CGDisplayPixelsHigh(mainDevice); 45 int height = CGDisplayPixelsHigh(mainDevice);
(...skipping 14 matching lines...) Expand all
59 TEST_F(CapturerMacTest, Capture) { 60 TEST_F(CapturerMacTest, Capture) {
60 SCOPED_TRACE(""); 61 SCOPED_TRACE("");
61 CapturerCallback capturer(rects_); 62 CapturerCallback capturer(rects_);
62 capturer_->InvalidateRects(rects_); 63 capturer_->InvalidateRects(rects_);
63 capturer_->CaptureInvalidRects( 64 capturer_->CaptureInvalidRects(
64 NewCallback(&capturer, &CapturerCallback::CaptureDoneCallback)); 65 NewCallback(&capturer, &CapturerCallback::CaptureDoneCallback));
65 } 66 }
66 67
67 } // namespace remoting 68 } // namespace remoting
68 69
69 std::ostream& operator<<(std::ostream& out, const remoting::RectVector& rects) { 70 std::ostream& operator<<(std::ostream& out,
70 for (remoting::RectVector::const_iterator i = rects.begin(); 71 const remoting::InvalidRects& rects) {
71 i < rects.end(); 72 for (remoting::InvalidRects::const_iterator i = rects.begin();
73 i != rects.end();
72 ++i) { 74 ++i) {
73 out << *i << std::endl; 75 out << *i << std::endl;
74 } 76 }
75 return out; 77 return out;
76 } 78 }
OLDNEW
« no previous file with comments | « remoting/host/capturer_mac.cc ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698