Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / test / chromoting_test_fixture.h
blobb2d1a675a63c0e06d76dc33490dc3270181b5f85
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 SetUp() override;
47 void TearDown() override;
49 // Creates and manages the connection to the remote host.
50 scoped_ptr<TestChromotingClient> test_chromoting_client_;
52 base::ThreadChecker thread_checker_;
54 DISALLOW_COPY_AND_ASSIGN(ChromotingTestFixture);
57 } // namespace test
58 } // namespace remoting
60 #endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_