Chromium Code Reviews| Index: remoting/host/client_session_unittest.cc |
| diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc |
| index 920f3da6d948fd62cc5ea526e8a875640b9dafd9..20dbd7a4f77cb29f9fc132769a81555b22b36668 100644 |
| --- a/remoting/host/client_session_unittest.cc |
| +++ b/remoting/host/client_session_unittest.cc |
| @@ -11,6 +11,7 @@ |
| #include <utility> |
| #include <vector> |
| +#include "base/memory/ptr_util.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_split.h" |
| @@ -101,10 +102,13 @@ class ClientSessionTest : public testing::Test { |
| void SetUp() override; |
| void TearDown() override; |
| + protected: |
| + // Creates the client session from a MockSession instance. |
| + void CreateClientSession(std::unique_ptr<protocol::MockSession> session); |
| + |
| // Creates the client session. |
| void CreateClientSession(); |
| - protected: |
| // Notifies the client session that the client connection has been |
| // authenticated and channels have been connected. This effectively enables |
| // the input pipe line and starts video capturing. |
| @@ -113,10 +117,6 @@ class ClientSessionTest : public testing::Test { |
| // Fakes video size notification from the VideoStream. |
| void NotifyVideoSize(); |
| - // Creates expectations to send an extension message and to disconnect |
| - // afterwards. |
| - void SetSendMessageAndDisconnectExpectation(const std::string& message_type); |
| - |
| // Message loop that will process all ClientSession tasks. |
| base::MessageLoop message_loop_; |
| @@ -173,9 +173,10 @@ void ClientSessionTest::TearDown() { |
| run_loop_.Run(); |
| } |
| -void ClientSessionTest::CreateClientSession() { |
| +void ClientSessionTest::CreateClientSession( |
| + std::unique_ptr<protocol::MockSession> session) { |
| + DCHECK(session); |
| // Mock protocol::Session APIs called directly by ClientSession. |
| - std::unique_ptr<protocol::MockSession> session(new MockSession()); |
| EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_)); |
| EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); |
| @@ -193,6 +194,10 @@ void ClientSessionTest::CreateClientSession() { |
| base::TimeDelta(), nullptr, extensions_)); |
| } |
| +void ClientSessionTest::CreateClientSession() { |
| + CreateClientSession(base::MakeUnique<protocol::MockSession>()); |
| +} |
| + |
| void ClientSessionTest::ConnectClientSession() { |
| EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); |
| EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); |
| @@ -431,4 +436,18 @@ TEST_F(ClientSessionTest, Extensions) { |
| EXPECT_FALSE(extension3.was_instantiated()); |
| } |
| +#if defined(OS_WIN) |
| +TEST_F(ClientSessionTest, ForwardHostSessionOptions) { |
| + std::unique_ptr<protocol::MockSession> session(new protocol::MockSession()); |
|
Sergey Ulanov
2017/01/07 01:23:09
nit: This line may would be more readable if writt
Hzj_jie
2017/01/08 23:48:48
Done.
|
| + std::unique_ptr<buzz::XmlElement> configuration(new buzz::XmlElement( |
| + buzz::QName(kChromotingXmlNamespace, "host-configuration"))); |
| + configuration->SetBodyText("Allow-DirectX-Capturer:"); |
| + session->SetAttachment(0, std::move(configuration)); |
| + CreateClientSession(std::move(session)); |
| + ConnectClientSession(); |
| + ASSERT_TRUE(desktop_environment_factory_->last_desktop_environment() |
| + ->options().desktop_capture_options()->allow_directx_capturer()); |
|
Sergey Ulanov
2017/01/07 01:23:09
'git cl format' please
Hzj_jie
2017/01/08 23:48:48
Done.
|
| +} |
| +#endif |
| + |
| } // namespace remoting |