| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool exact_size_supported_; | 60 bool exact_size_supported_; |
| 61 std::list<SkISize> supported_sizes_; | 61 std::list<SkISize> supported_sizes_; |
| 62 | 62 |
| 63 int set_size_call_count_; | 63 int set_size_call_count_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class ResizingHostObserverTest : public testing::Test { | 66 class ResizingHostObserverTest : public testing::Test { |
| 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( |
| 71 NULL)); | 71 new ResizingHostObserver(desktop_resizer, |
| 72 base::WeakPtr<HostStatusMonitor>())); |
| 72 desktop_resizer_.reset(desktop_resizer); | 73 desktop_resizer_.reset(desktop_resizer); |
| 73 resizing_host_observer_->OnClientAuthenticated(""); | 74 resizing_host_observer_->OnClientAuthenticated(""); |
| 74 } | 75 } |
| 75 | 76 |
| 76 SkISize GetBestSize(const SkISize& client_size) { | 77 SkISize GetBestSize(const SkISize& client_size) { |
| 77 resizing_host_observer_->OnClientResolutionChanged( | 78 resizing_host_observer_->OnClientResolutionChanged( |
| 78 "", client_size, SkIPoint()); | 79 "", client_size, SkIPoint()); |
| 79 return desktop_resizer_->GetCurrentSize(); | 80 return desktop_resizer_->GetCurrentSize(); |
| 80 } | 81 } |
| 81 | 82 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 new FakeDesktopResizer(SkISize::Make(640, 480), false, | 177 new FakeDesktopResizer(SkISize::Make(640, 480), false, |
| 177 supported_sizes, arraysize(supported_sizes)); | 178 supported_sizes, arraysize(supported_sizes)); |
| 178 SetDesktopResizer(desktop_resizer); | 179 SetDesktopResizer(desktop_resizer); |
| 179 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } }; | 180 SkISize client_sizes[] = { { 640, 640 }, { 1024, 768 }, { 640, 480 } }; |
| 180 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } }; | 181 SkISize expected_sizes[] = { { 640, 480 }, { 640, 480 }, { 640, 480 } }; |
| 181 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes)); | 182 VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes)); |
| 182 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0); | 183 EXPECT_EQ(desktop_resizer->set_size_call_count(), 0); |
| 183 } | 184 } |
| 184 | 185 |
| 185 } // namespace remoting | 186 } // namespace remoting |
| OLD | NEW |