blob: c6a9fc58beedd066eb74a459b14209b450d39b9a [file] [log] [blame]
// 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.
#include "base/macros.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 {
~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();
// Observes and saves the times when a chromoting client changes its state.
scoped_ptr<ConnectionTimeObserver> connection_time_observer_;
// 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_;
} // namespace test
} // namespace remoting