OLD | NEW |
---|---|
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 "remoting/host/resizing_host_observer.h" | 5 #include "remoting/host/resizing_host_observer.h" |
6 #include "remoting/host/desktop_resizer.h" | 6 #include "remoting/host/desktop_resizer.h" |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 public: | 67 public: |
68 void SetDesktopResizer(FakeDesktopResizer* desktop_resizer) { | 68 void SetDesktopResizer(FakeDesktopResizer* desktop_resizer) { |
69 CHECK(!desktop_resizer_.get()) << "Call SetDeskopResizer once per test"; | 69 CHECK(!desktop_resizer_.get()) << "Call SetDeskopResizer once per test"; |
70 resizing_host_observer_.reset(new ResizingHostObserver(desktop_resizer, | 70 resizing_host_observer_.reset(new ResizingHostObserver(desktop_resizer, |
71 NULL)); | 71 NULL)); |
72 desktop_resizer_.reset(desktop_resizer); | 72 desktop_resizer_.reset(desktop_resizer); |
73 resizing_host_observer_->OnClientAuthenticated(""); | 73 resizing_host_observer_->OnClientAuthenticated(""); |
74 } | 74 } |
75 | 75 |
76 SkISize GetBestSize(const SkISize& client_size) { | 76 SkISize GetBestSize(const SkISize& client_size) { |
77 resizing_host_observer_->OnClientDimensionsChanged("", client_size); | 77 resizing_host_observer_->OnClientResolutionChanged( |
78 "", client_size, SkIPoint()); | |
Jamie
2013/02/11 23:25:58
Can you add a unit test to make sure that the DPI
Wez
2013/02/12 01:55:28
You mean when hooking up the host-side DPI-handlin
| |
78 return desktop_resizer_->GetCurrentSize(); | 79 return desktop_resizer_->GetCurrentSize(); |
79 } | 80 } |
80 | 81 |
81 void VerifySizes(const SkISize* client_sizes, const SkISize* expected_sizes, | 82 void VerifySizes(const SkISize* client_sizes, const SkISize* expected_sizes, |
82 int number_of_sizes) { | 83 int number_of_sizes) { |
83 for (int i = 0; i < number_of_sizes; ++i) { | 84 for (int i = 0; i < number_of_sizes; ++i) { |
84 SkISize best_size = GetBestSize(client_sizes[i]); | 85 SkISize best_size = GetBestSize(client_sizes[i]); |
85 EXPECT_EQ(expected_sizes[i], best_size) | 86 EXPECT_EQ(expected_sizes[i], best_size) |
86 << "Input size = " << client_sizes[i]; | 87 << "Input size = " << client_sizes[i]; |
87 } | 88 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 new FakeDesktopResizer(SkISize::Make(640, 480), false, | 203 new FakeDesktopResizer(SkISize::Make(640, 480), false, |
203 supported_sizes, arraysize(supported_sizes)); | 204 supported_sizes, arraysize(supported_sizes)); |
204 SetDesktopResizer(desktop_resizer); | 205 SetDesktopResizer(desktop_resizer); |
205 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } }; | 206 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } }; |
206 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } }; | 207 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } }; |
207 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes)); | 208 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes)); |
208 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0); | 209 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0); |
209 } | 210 } |
210 | 211 |
211 } // namespace remoting | 212 } // namespace remoting |
OLD | NEW |