Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: remoting/host/client_session_unittest.cc

Issue 2858813002: [Chromoting] Use ProcessStatsSender in host process
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/desktop_environment_options.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/desktop_environment_options.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698