forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchromoting_test_fixture.h
65 lines (48 loc) · 1.83 KB
/
chromoting_test_fixture.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
#define REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
class RunLoop;
class Timer;
}
namespace remoting {
namespace test {
class ConnectionTimeObserver;
class TestChromotingClient;
struct HostInfo;
// Provides chromoting connection capabilities for tests to use. Performance
// metrics of the established connection are readily available to calculate
// through the ConnectionTimeObserver.
class ChromotingTestFixture
: public testing::Test {
public:
ChromotingTestFixture();
~ChromotingTestFixture() override;
// Client initiates a session with a host to establish a chromoting
// connection. Only has |timeout| seconds to connect to host.
bool ConnectToHost(const base::TimeDelta& timeout);
// Ends a chromoting connection with the host.
void Disconnect();
protected:
// Observes and saves the times when a chromoting client changes its state.
scoped_ptr<ConnectionTimeObserver> connection_time_observer_;
private:
// testing::Test overrides.
void TearDown() override;
// Creates |connection_time_observer_| to attach to |test_chromoting_client_|.
void CreateObserver();
// Detaches |connection_time_observer_| and destroys it.
void DestroyObserver();
// Creates and manages the connection to the remote host.
scoped_ptr<TestChromotingClient> test_chromoting_client_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(ChromotingTestFixture);
};
} // namespace test
} // namespace remoting
#endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_