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 #ifndef REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
6 #define REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread_checker.h"
10 #include "testing/gtest/include/gtest/gtest.h"
20 class ConnectionTimeObserver
;
21 class TestChromotingClient
;
24 // Provides chromoting connection capabilities for tests to use. Performance
25 // metrics of the established connection are readily available to calculate
26 // through the ConnectionTimeObserver.
27 class ChromotingTestFixture
28 : public testing::Test
{
30 ChromotingTestFixture();
31 ~ChromotingTestFixture() override
;
33 // Client initiates a session with a host to establish a chromoting
34 // connection. Only has |timeout| seconds to connect to host.
35 bool ConnectToHost(const base::TimeDelta
& timeout
);
37 // Ends a chromoting connection with the host.
41 // Observes and saves the times when a chromoting client changes its state.
42 scoped_ptr
<ConnectionTimeObserver
> connection_time_observer_
;
45 // testing::Test overrides.
46 void TearDown() override
;
48 // Creates |connection_time_observer_| to attach to |test_chromoting_client_|.
49 void CreateObserver();
51 // Detaches |connection_time_observer_| and destroys it.
52 void DestroyObserver();
54 // Creates and manages the connection to the remote host.
55 scoped_ptr
<TestChromotingClient
> test_chromoting_client_
;
57 base::ThreadChecker thread_checker_
;
59 DISALLOW_COPY_AND_ASSIGN(ChromotingTestFixture
);
63 } // namespace remoting
65 #endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_