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 <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 "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 base::Time GetTime() { | 101 base::Time GetTime() { |
102 return now_; | 102 return now_; |
103 } | 103 } |
104 | 104 |
105 protected: | 105 protected: |
106 void SetDesktopResizer(scoped_ptr<FakeDesktopResizer> desktop_resizer) { | 106 void SetDesktopResizer(scoped_ptr<FakeDesktopResizer> desktop_resizer) { |
107 CHECK(!desktop_resizer_) << "Call SetDeskopResizer once per test"; | 107 CHECK(!desktop_resizer_) << "Call SetDeskopResizer once per test"; |
108 desktop_resizer_ = desktop_resizer.get(); | 108 desktop_resizer_ = desktop_resizer.get(); |
109 | 109 |
110 resizing_host_observer_.reset( | 110 resizing_host_observer_.reset( |
111 new ResizingHostObserver(desktop_resizer.PassAs<DesktopResizer>())); | 111 new ResizingHostObserver(desktop_resizer.Pass())); |
112 resizing_host_observer_->SetNowFunctionForTesting( | 112 resizing_host_observer_->SetNowFunctionForTesting( |
113 base::Bind(&ResizingHostObserverTest::GetTimeAndIncrement, | 113 base::Bind(&ResizingHostObserverTest::GetTimeAndIncrement, |
114 base::Unretained(this))); | 114 base::Unretained(this))); |
115 } | 115 } |
116 | 116 |
117 ScreenResolution GetBestResolution(const ScreenResolution& client_size) { | 117 ScreenResolution GetBestResolution(const ScreenResolution& client_size) { |
118 resizing_host_observer_->SetScreenResolution(client_size); | 118 resizing_host_observer_->SetScreenResolution(client_size); |
119 return desktop_resizer_->GetCurrentResolution(); | 119 return desktop_resizer_->GetCurrentResolution(); |
120 } | 120 } |
121 | 121 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 FROM_HERE, | 302 FROM_HERE, |
303 run_loop.QuitClosure(), | 303 run_loop.QuitClosure(), |
304 base::TimeDelta::FromMilliseconds(2)); | 304 base::TimeDelta::FromMilliseconds(2)); |
305 run_loop.Run(); | 305 run_loop.Run(); |
306 | 306 |
307 // If the QuitClosure fired before the final resize, it's a test failure. | 307 // If the QuitClosure fired before the final resize, it's a test failure. |
308 EXPECT_EQ(desktop_resizer_->GetCurrentResolution(), MakeResolution(300, 300)); | 308 EXPECT_EQ(desktop_resizer_->GetCurrentResolution(), MakeResolution(300, 300)); |
309 } | 309 } |
310 | 310 |
311 } // namespace remoting | 311 } // namespace remoting |
OLD | NEW |