| Index: remoting/host/client_session_unittest.cc
|
| diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
|
| index d2e830f2fcd91ab3b7c659b2828a256cef1a4d34..5a45027471d1b111dba9beac191fb331223d65c5 100644
|
| --- a/remoting/host/client_session_unittest.cc
|
| +++ b/remoting/host/client_session_unittest.cc
|
| @@ -11,6 +11,8 @@
|
| #include <utility>
|
| #include <vector>
|
|
|
| +#include "base/bind.h"
|
| +#include "base/location.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| @@ -27,8 +29,10 @@
|
| #include "remoting/host/host_extension.h"
|
| #include "remoting/host/host_extension_session.h"
|
| #include "remoting/host/host_mock_objects.h"
|
| +#include "remoting/protocol/errors.h"
|
| #include "remoting/protocol/fake_connection_to_client.h"
|
| #include "remoting/protocol/fake_desktop_capturer.h"
|
| +#include "remoting/protocol/fake_process_stats_stub.h"
|
| #include "remoting/protocol/fake_session.h"
|
| #include "remoting/protocol/protocol_mock_objects.h"
|
| #include "remoting/protocol/test_event_matchers.h"
|
| @@ -487,4 +491,31 @@ TEST_F(ClientSessionTest, ForwardDirectXHostSessionOptions2) {
|
| }
|
| #endif
|
|
|
| +TEST_F(ClientSessionTest,
|
| + ProcessStatsSenderShouldBeCorrectlyStartedAndStopped) {
|
| + base::RunLoop run_loop;
|
| + protocol::FakeProcessStatsStub stats_stub;
|
| + auto session = base::MakeUnique<protocol::FakeSession>();
|
| + auto configuration = base::MakeUnique<buzz::XmlElement>(
|
| + buzz::QName(kChromotingXmlNamespace, "host-configuration"));
|
| + configuration->SetBodyText("Track-Process-Stats-Interval-Ms:1");
|
| + session->SetAttachment(0, std::move(configuration));
|
| + CreateClientSession(std::move(session));
|
| + connection_->set_stats_stub(&stats_stub);
|
| + stats_stub.set_expected_usage_count(5);
|
| + stats_stub.set_quit_closure(base::Bind([](ClientSession* client_session) {
|
| + client_session->OnConnectionClosed(protocol::MAX_SESSION_LENGTH);
|
| + },
|
| + base::Unretained(client_session_.get())));
|
| + ConnectClientSession();
|
| + task_runner_->PostDelayedTask(FROM_HERE,
|
| + base::Bind([](base::RunLoop* run_loop) {
|
| + run_loop->Quit();
|
| + },
|
| + base::Unretained(&run_loop)),
|
| + base::TimeDelta::FromMilliseconds(100));
|
| + run_loop.Run();
|
| + ASSERT_EQ(stats_stub.received().size(), 5U);
|
| +}
|
| +
|
| } // namespace remoting
|
|
|