OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "remoting/host/capturer_fake.h" | 9 #include "remoting/host/capturer_fake.h" |
10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual void SetUp() OVERRIDE { | 71 virtual void SetUp() OVERRIDE { |
72 message_loop_proxy_ = base::MessageLoopProxy::current(); | 72 message_loop_proxy_ = base::MessageLoopProxy::current(); |
73 config_ = new InMemoryHostConfig(); | 73 config_ = new InMemoryHostConfig(); |
74 ON_CALL(context_, main_message_loop()) | 74 ON_CALL(context_, main_message_loop()) |
75 .WillByDefault(Return(&message_loop_)); | 75 .WillByDefault(Return(&message_loop_)); |
76 ON_CALL(context_, encode_message_loop()) | 76 ON_CALL(context_, encode_message_loop()) |
77 .WillByDefault(Return(&message_loop_)); | 77 .WillByDefault(Return(&message_loop_)); |
78 ON_CALL(context_, network_message_loop()) | 78 ON_CALL(context_, network_message_loop()) |
79 .WillByDefault(Return(message_loop_proxy_.get())); | 79 .WillByDefault(Return(message_loop_proxy_.get())); |
80 ON_CALL(context_, ui_message_loop()) | 80 ON_CALL(context_, ui_message_loop()) |
81 .WillByDefault(Return(message_loop_proxy_.get())); | 81 .WillByDefault(Return(&message_loop_)); |
82 EXPECT_CALL(context_, main_message_loop()) | 82 EXPECT_CALL(context_, main_message_loop()) |
83 .Times(AnyNumber()); | 83 .Times(AnyNumber()); |
84 EXPECT_CALL(context_, encode_message_loop()) | 84 EXPECT_CALL(context_, encode_message_loop()) |
85 .Times(AnyNumber()); | 85 .Times(AnyNumber()); |
86 EXPECT_CALL(context_, network_message_loop()) | 86 EXPECT_CALL(context_, network_message_loop()) |
87 .Times(AnyNumber()); | 87 .Times(AnyNumber()); |
88 EXPECT_CALL(context_, ui_message_loop()) | 88 EXPECT_CALL(context_, ui_message_loop()) |
89 .Times(AnyNumber()); | 89 .Times(AnyNumber()); |
90 | 90 |
| 91 context_.SetUITaskPostFunction(base::Bind( |
| 92 static_cast<void(MessageLoop::*)( |
| 93 const tracked_objects::Location&, |
| 94 const base::Closure&)>(&MessageLoop::PostTask), |
| 95 base::Unretained(&message_loop_))); |
| 96 |
91 Capturer* capturer = new CapturerFake(); | 97 Capturer* capturer = new CapturerFake(); |
92 event_executor_ = new MockEventExecutor(); | 98 event_executor_ = new MockEventExecutor(); |
93 curtain_ = new MockCurtain(); | 99 curtain_ = new MockCurtain(); |
94 disconnect_window_ = new MockDisconnectWindow(); | 100 disconnect_window_ = new MockDisconnectWindow(); |
95 continue_window_ = new MockContinueWindow(); | 101 continue_window_ = new MockContinueWindow(); |
96 local_input_monitor_ = new MockLocalInputMonitor(); | 102 local_input_monitor_ = new MockLocalInputMonitor(); |
97 desktop_environment_.reset( | 103 desktop_environment_.reset( |
98 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_, | 104 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_, |
99 disconnect_window_, continue_window_, | 105 disconnect_window_, continue_window_, |
100 local_input_monitor_)); | 106 local_input_monitor_)); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 EXPECT_CALL(*connection_.get(), Disconnect()) | 497 EXPECT_CALL(*connection_.get(), Disconnect()) |
492 .InSequence(s1, s2) | 498 .InSequence(s1, s2) |
493 .RetiresOnSaturation(); | 499 .RetiresOnSaturation(); |
494 } | 500 } |
495 SimulateClientConnection(0, true); | 501 SimulateClientConnection(0, true); |
496 message_loop_.Run(); | 502 message_loop_.Run(); |
497 host_->set_it2me(false); | 503 host_->set_it2me(false); |
498 EXPECT_THAT(curtain_activated, false); | 504 EXPECT_THAT(curtain_activated, false); |
499 } | 505 } |
500 } // namespace remoting | 506 } // namespace remoting |
OLD | NEW |