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

Side by Side Diff: remoting/host/client_session_unittest.cc

Issue 2858813002: [Chromoting] Use ProcessStatsSender in host process
Patch Set: Created 3 years, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "remoting/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h"
15 #include "base/location.h"
14 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
15 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 18 #include "base/run_loop.h"
17 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
18 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
19 #include "build/build_config.h" 21 #include "build/build_config.h"
20 #include "remoting/base/auto_thread_task_runner.h" 22 #include "remoting/base/auto_thread_task_runner.h"
21 #include "remoting/base/constants.h" 23 #include "remoting/base/constants.h"
22 #include "remoting/codec/video_encoder_verbatim.h" 24 #include "remoting/codec/video_encoder_verbatim.h"
23 #include "remoting/host/desktop_environment.h" 25 #include "remoting/host/desktop_environment.h"
24 #include "remoting/host/fake_desktop_environment.h" 26 #include "remoting/host/fake_desktop_environment.h"
25 #include "remoting/host/fake_host_extension.h" 27 #include "remoting/host/fake_host_extension.h"
26 #include "remoting/host/fake_mouse_cursor_monitor.h" 28 #include "remoting/host/fake_mouse_cursor_monitor.h"
27 #include "remoting/host/host_extension.h" 29 #include "remoting/host/host_extension.h"
28 #include "remoting/host/host_extension_session.h" 30 #include "remoting/host/host_extension_session.h"
29 #include "remoting/host/host_mock_objects.h" 31 #include "remoting/host/host_mock_objects.h"
32 #include "remoting/protocol/errors.h"
30 #include "remoting/protocol/fake_connection_to_client.h" 33 #include "remoting/protocol/fake_connection_to_client.h"
31 #include "remoting/protocol/fake_desktop_capturer.h" 34 #include "remoting/protocol/fake_desktop_capturer.h"
35 #include "remoting/protocol/fake_process_stats_stub.h"
32 #include "remoting/protocol/fake_session.h" 36 #include "remoting/protocol/fake_session.h"
33 #include "remoting/protocol/protocol_mock_objects.h" 37 #include "remoting/protocol/protocol_mock_objects.h"
34 #include "remoting/protocol/test_event_matchers.h" 38 #include "remoting/protocol/test_event_matchers.h"
35 #include "testing/gmock/include/gmock/gmock-matchers.h" 39 #include "testing/gmock/include/gmock/gmock-matchers.h"
36 #include "testing/gtest/include/gtest/gtest.h" 40 #include "testing/gtest/include/gtest/gtest.h"
37 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 41 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
38 42
39 namespace remoting { 43 namespace remoting {
40 44
41 using protocol::FakeSession; 45 using protocol::FakeSession;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 session->SetAttachment(0, std::move(configuration)); 484 session->SetAttachment(0, std::move(configuration));
481 CreateClientSession(std::move(session)); 485 CreateClientSession(std::move(session));
482 ConnectClientSession(); 486 ConnectClientSession();
483 ASSERT_FALSE(desktop_environment_factory_->last_desktop_environment() 487 ASSERT_FALSE(desktop_environment_factory_->last_desktop_environment()
484 ->options() 488 ->options()
485 .desktop_capture_options() 489 .desktop_capture_options()
486 ->allow_directx_capturer()); 490 ->allow_directx_capturer());
487 } 491 }
488 #endif 492 #endif
489 493
494 TEST_F(ClientSessionTest,
495 ProcessStatsSenderShouldBeCorrectlyStartedAndStopped) {
496 base::RunLoop run_loop;
497 protocol::FakeProcessStatsStub stats_stub;
498 auto session = base::MakeUnique<protocol::FakeSession>();
499 auto configuration = base::MakeUnique<buzz::XmlElement>(
500 buzz::QName(kChromotingXmlNamespace, "host-configuration"));
501 configuration->SetBodyText("Track-Process-Stats-Interval-Ms:1");
502 session->SetAttachment(0, std::move(configuration));
503 CreateClientSession(std::move(session));
504 connection_->set_stats_stub(&stats_stub);
505 stats_stub.set_expected_usage_count(5);
506 stats_stub.set_quit_closure(base::Bind([](ClientSession* client_session) {
507 client_session->OnConnectionClosed(protocol::MAX_SESSION_LENGTH);
508 },
509 base::Unretained(client_session_.get())));
510 ConnectClientSession();
511 task_runner_->PostDelayedTask(FROM_HERE,
512 base::Bind([](base::RunLoop* run_loop) {
513 run_loop->Quit();
514 },
515 base::Unretained(&run_loop)),
516 base::TimeDelta::FromMilliseconds(100));
517 run_loop.Run();
518 ASSERT_EQ(stats_stub.received().size(), 5U);
519 }
520
490 } // namespace remoting 521 } // namespace remoting
OLDNEW
« 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