| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ | 5 #ifndef REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ |
| 6 #define REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ | 6 #define REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class RunLoop; | 15 class RunLoop; |
| 15 class Timer; | 16 class Timer; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace remoting { | 19 namespace remoting { |
| 19 namespace test { | 20 namespace test { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 // Client initiates a session with a host to establish a chromoting | 35 // Client initiates a session with a host to establish a chromoting |
| 35 // connection. Only has |timeout| seconds to connect to host. | 36 // connection. Only has |timeout| seconds to connect to host. |
| 36 bool ConnectToHost(const base::TimeDelta& timeout); | 37 bool ConnectToHost(const base::TimeDelta& timeout); |
| 37 | 38 |
| 38 // Ends a chromoting connection with the host. | 39 // Ends a chromoting connection with the host. |
| 39 void Disconnect(); | 40 void Disconnect(); |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 // Observes and saves the times when a chromoting client changes its state. | 43 // Observes and saves the times when a chromoting client changes its state. |
| 43 scoped_ptr<ConnectionTimeObserver> connection_time_observer_; | 44 std::unique_ptr<ConnectionTimeObserver> connection_time_observer_; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // testing::Test overrides. | 47 // testing::Test overrides. |
| 47 void TearDown() override; | 48 void TearDown() override; |
| 48 | 49 |
| 49 // Creates |connection_time_observer_| to attach to |test_chromoting_client_|. | 50 // Creates |connection_time_observer_| to attach to |test_chromoting_client_|. |
| 50 void CreateObserver(); | 51 void CreateObserver(); |
| 51 | 52 |
| 52 // Detaches |connection_time_observer_| and destroys it. | 53 // Detaches |connection_time_observer_| and destroys it. |
| 53 void DestroyObserver(); | 54 void DestroyObserver(); |
| 54 | 55 |
| 55 // Creates and manages the connection to the remote host. | 56 // Creates and manages the connection to the remote host. |
| 56 scoped_ptr<TestChromotingClient> test_chromoting_client_; | 57 std::unique_ptr<TestChromotingClient> test_chromoting_client_; |
| 57 | 58 |
| 58 base::ThreadChecker thread_checker_; | 59 base::ThreadChecker thread_checker_; |
| 59 | 60 |
| 60 DISALLOW_COPY_AND_ASSIGN(ChromotingTestFixture); | 61 DISALLOW_COPY_AND_ASSIGN(ChromotingTestFixture); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace test | 64 } // namespace test |
| 64 } // namespace remoting | 65 } // namespace remoting |
| 65 | 66 |
| 66 #endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ | 67 #endif // REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_ |
| OLD | NEW |