[sql] Record memory usage at various periods after startup.
[chromium-blink-merge.git] / remoting / test / chromoting_test_driver_tests.cc
bloba1f4c402152dcc6b885acd6919ce2fe6fa7bde83
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/test/chromoting_test_driver_environment.h"
6 #include "remoting/test/chromoting_test_fixture.h"
7 #include "remoting/test/connection_time_observer.h"
9 namespace {
10 const base::TimeDelta kPinBasedMaxConnectionTimeInSeconds =
11 base::TimeDelta::FromSeconds(5);
12 const int kPinBasedMaxAuthenticationTimeMs = 4000;
13 const int kMaxTimeToConnectMs = 1000;
16 namespace remoting {
17 namespace test {
19 TEST_F(ChromotingTestFixture, DISABLED_TestMeasurePinBasedAuthentication) {
20 bool connected = ConnectToHost(kPinBasedMaxConnectionTimeInSeconds);
21 EXPECT_TRUE(connected);
23 Disconnect();
24 EXPECT_FALSE(connection_time_observer_->GetStateTransitionTime(
25 protocol::ConnectionToHost::State::INITIALIZING,
26 protocol::ConnectionToHost::State::CLOSED).is_max());
28 int authentication_time = connection_time_observer_->GetStateTransitionTime(
29 protocol::ConnectionToHost::State::INITIALIZING,
30 protocol::ConnectionToHost::State::AUTHENTICATED).InMilliseconds();
31 EXPECT_LE(authentication_time, kPinBasedMaxAuthenticationTimeMs);
33 int authenticated_to_connected_time =
34 connection_time_observer_->GetStateTransitionTime(
35 protocol::ConnectionToHost::State::AUTHENTICATED,
36 protocol::ConnectionToHost::State::CONNECTED).InMilliseconds();
37 EXPECT_LE(authenticated_to_connected_time, kMaxTimeToConnectMs);
40 TEST_F(ChromotingTestFixture, DISABLED_TestMeasureReconnectPerformance) {
41 bool connected = ConnectToHost(kPinBasedMaxConnectionTimeInSeconds);
42 EXPECT_TRUE(connected);
44 Disconnect();
45 EXPECT_FALSE(connection_time_observer_->GetStateTransitionTime(
46 protocol::ConnectionToHost::State::INITIALIZING,
47 protocol::ConnectionToHost::State::CLOSED).is_max());
49 int authentication_time = connection_time_observer_->GetStateTransitionTime(
50 protocol::ConnectionToHost::State::INITIALIZING,
51 protocol::ConnectionToHost::State::AUTHENTICATED).InMilliseconds();
52 EXPECT_LE(authentication_time, kPinBasedMaxAuthenticationTimeMs);
54 int authenticated_to_connected_time =
55 connection_time_observer_->GetStateTransitionTime(
56 protocol::ConnectionToHost::State::AUTHENTICATED,
57 protocol::ConnectionToHost::State::CONNECTED).InMilliseconds();
58 EXPECT_LE(authenticated_to_connected_time, kMaxTimeToConnectMs);
60 // Begin reconnection to same host.
61 connected = ConnectToHost(kPinBasedMaxConnectionTimeInSeconds);
62 EXPECT_TRUE(connected);
64 Disconnect();
65 EXPECT_FALSE(connection_time_observer_->GetStateTransitionTime(
66 protocol::ConnectionToHost::State::INITIALIZING,
67 protocol::ConnectionToHost::State::CLOSED).is_max());
69 authentication_time = connection_time_observer_->GetStateTransitionTime(
70 protocol::ConnectionToHost::State::INITIALIZING,
71 protocol::ConnectionToHost::State::AUTHENTICATED).InMilliseconds();
72 EXPECT_LE(authentication_time, kPinBasedMaxAuthenticationTimeMs);
74 authenticated_to_connected_time =
75 connection_time_observer_->GetStateTransitionTime(
76 protocol::ConnectionToHost::State::AUTHENTICATED,
77 protocol::ConnectionToHost::State::CONNECTED).InMilliseconds();
78 EXPECT_LE(authenticated_to_connected_time, kMaxTimeToConnectMs);
81 // TODO(TonyChun): Remove #include "chromoting_test_driver_environment.h" and
82 // this test once connecting to the lab's Linux host is working.
83 TEST(HostListTest, VerifyRequestedHostIsInHostList) {
84 EXPECT_TRUE(g_chromoting_shared_data);
85 EXPECT_TRUE(g_chromoting_shared_data->host_info().IsReadyForConnection());
88 } // namespace test
89 } // namespace remoting