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

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

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/resizing_host_observer.cc ('k') | remoting/host/screen_resolution.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 5 #include <list>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "remoting/host/desktop_resizer.h" 9 #include "remoting/host/desktop_resizer.h"
10 #include "remoting/host/resizing_host_observer.h" 10 #include "remoting/host/resizing_host_observer.h"
11 #include "remoting/host/screen_resolution.h" 11 #include "remoting/host/screen_resolution.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/skia/include/core/SkSize.h" 13 #include "third_party/skia/include/core/SkSize.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
14 15
15 std::ostream& operator<<(std::ostream& os, const SkISize& size) { 16 std::ostream& operator<<(std::ostream& os, const SkISize& size) {
16 return os << size.width() << "x" << size.height(); 17 return os << size.width() << "x" << size.height();
17 } 18 }
18 19
19 const int kDefaultDPI = 96; 20 const int kDefaultDPI = 96;
20 21
21 namespace remoting { 22 namespace remoting {
22 23
23 class FakeDesktopResizer : public DesktopResizer { 24 class FakeDesktopResizer : public DesktopResizer {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void SetDesktopResizer(scoped_ptr<FakeDesktopResizer> desktop_resizer) { 77 void SetDesktopResizer(scoped_ptr<FakeDesktopResizer> desktop_resizer) {
77 CHECK(!desktop_resizer_) << "Call SetDeskopResizer once per test"; 78 CHECK(!desktop_resizer_) << "Call SetDeskopResizer once per test";
78 desktop_resizer_ = desktop_resizer.get(); 79 desktop_resizer_ = desktop_resizer.get();
79 80
80 resizing_host_observer_.reset( 81 resizing_host_observer_.reset(
81 new ResizingHostObserver(desktop_resizer.PassAs<DesktopResizer>())); 82 new ResizingHostObserver(desktop_resizer.PassAs<DesktopResizer>()));
82 } 83 }
83 84
84 SkISize GetBestSize(const SkISize& client_size) { 85 SkISize GetBestSize(const SkISize& client_size) {
85 resizing_host_observer_->SetScreenResolution(ScreenResolution( 86 resizing_host_observer_->SetScreenResolution(ScreenResolution(
86 client_size, SkIPoint::Make(kDefaultDPI, kDefaultDPI))); 87 webrtc::DesktopSize(client_size.width(), client_size.height()),
88 webrtc::DesktopVector(kDefaultDPI, kDefaultDPI)));
87 return desktop_resizer_->GetCurrentSize(); 89 return desktop_resizer_->GetCurrentSize();
88 } 90 }
89 91
90 void VerifySizes(const SkISize* client_sizes, const SkISize* expected_sizes, 92 void VerifySizes(const SkISize* client_sizes, const SkISize* expected_sizes,
91 int number_of_sizes) { 93 int number_of_sizes) {
92 for (int i = 0; i < number_of_sizes; ++i) { 94 for (int i = 0; i < number_of_sizes; ++i) {
93 SkISize best_size = GetBestSize(client_sizes[i]); 95 SkISize best_size = GetBestSize(client_sizes[i]);
94 EXPECT_EQ(expected_sizes[i], best_size) 96 EXPECT_EQ(expected_sizes[i], best_size)
95 << "Input size = " << client_sizes[i]; 97 << "Input size = " << client_sizes[i];
96 } 98 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 supported_sizes, arraysize(supported_sizes)); 185 supported_sizes, arraysize(supported_sizes));
184 SetDesktopResizer(scoped_ptr<FakeDesktopResizer>(desktop_resizer)); 186 SetDesktopResizer(scoped_ptr<FakeDesktopResizer>(desktop_resizer));
185 187
186 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } }; 188 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } };
187 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } }; 189 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } };
188 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes)); 190 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes));
189 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0); 191 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0);
190 } 192 }
191 193
192 } // namespace remoting 194 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/resizing_host_observer.cc ('k') | remoting/host/screen_resolution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698