Roll src/third_party/skia ef6c50a:d0fff5b
[chromium-blink-merge.git] / remoting / test / chromoting_test_fixture.h
blobd6804228011063c9005cd6589d1008f82f6d638f
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"
12 namespace base {
13 class RunLoop;
14 class Timer;
17 namespace remoting {
18 namespace test {
20 class ConnectionTimeObserver;
21 class TestChromotingClient;
22 struct HostInfo;
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 {
29 public:
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.
38 void Disconnect();
40 protected:
41 // Observes and saves the times when a chromoting client changes its state.
42 scoped_ptr<ConnectionTimeObserver> connection_time_observer_;
44 private:
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);
62 } // namespace test
63 } // namespace remoting
65 #endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_