Yuwei Huang | 1cf6806 | 2019-04-11 23:28:42 | [diff] [blame] | 1 | // Copyright 2019 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. |
| 4 | |
| 5 | #ifndef REMOTING_TEST_TEST_DEVICE_ID_PROVIDER_H_ |
| 6 | #define REMOTING_TEST_TEST_DEVICE_ID_PROVIDER_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/macros.h" |
| 12 | #include "remoting/signaling/ftl_device_id_provider.h" |
| 13 | |
| 14 | namespace remoting { |
| 15 | namespace test { |
| 16 | |
| 17 | // The FtlDeviceIdProvider implementation that generates device ID then store |
| 18 | // and reuse it from |token_storage|. |
| 19 | class TestDeviceIdProvider final : public FtlDeviceIdProvider { |
| 20 | public: |
| 21 | class TokenStorage { |
| 22 | public: |
| 23 | TokenStorage() = default; |
| 24 | virtual ~TokenStorage() = default; |
| 25 | |
| 26 | virtual std::string FetchDeviceId() = 0; |
| 27 | virtual bool StoreDeviceId(const std::string& device_id) = 0; |
| 28 | }; |
| 29 | |
| 30 | explicit TestDeviceIdProvider(TokenStorage* token_storage); |
| 31 | ~TestDeviceIdProvider() override; |
| 32 | |
| 33 | // FtlDeviceIdProvider implementations. |
| 34 | ftl::DeviceId GetDeviceId() override; |
| 35 | |
| 36 | private: |
| 37 | TokenStorage* token_storage_; |
| 38 | DISALLOW_COPY_AND_ASSIGN(TestDeviceIdProvider); |
| 39 | }; |
| 40 | |
| 41 | } // namespace test |
| 42 | } // namespace remoting |
| 43 | |
| 44 | #endif // REMOTING_TEST_TEST_DEVICE_ID_PROVIDER_H_ |