| 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_FAKE_REMOTE_HOST_INFO_FETCHER_H_ | 5 #ifndef REMOTING_TEST_FAKE_REMOTE_HOST_INFO_FETCHER_H_ |
| 6 #define REMOTING_TEST_FAKE_REMOTE_HOST_INFO_FETCHER_H_ | 6 #define REMOTING_TEST_FAKE_REMOTE_HOST_INFO_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "remoting/test/remote_host_info_fetcher.h" | 10 #include "remoting/test/remote_host_info_fetcher.h" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 // Used for testing classes which rely on the RemoteHostInfoFetcher and want to | 15 // Used for testing classes which rely on the RemoteHostInfoFetcher and want to |
| 16 // simulate success and failure scenarios without using the actual class and | 16 // simulate success and failure scenarios without using the actual class and |
| 17 // network connection. | 17 // network connection. |
| 18 class FakeRemoteHostInfoFetcher : public RemoteHostInfoFetcher { | 18 class FakeRemoteHostInfoFetcher : public RemoteHostInfoFetcher { |
| 19 public: | 19 public: |
| 20 FakeRemoteHostInfoFetcher(); | 20 FakeRemoteHostInfoFetcher(); |
| 21 ~FakeRemoteHostInfoFetcher() override; | 21 ~FakeRemoteHostInfoFetcher() override; |
| 22 | 22 |
| 23 // RemoteHostInfoFetcher interface. | 23 // RemoteHostInfoFetcher interface. |
| 24 bool RetrieveRemoteHostInfo( | 24 bool RetrieveRemoteHostInfo(const std::string& application_id, |
| 25 const std::string& application_id, | 25 const std::string& access_token, |
| 26 const std::string& access_token, | 26 ServiceEnvironment service_environment, |
| 27 ServiceEnvironment service_environment, | 27 const RemoteHostInfoCallback& callback) override; |
| 28 const RemoteHostInfoCallback& callback) override; | |
| 29 | 28 |
| 30 void set_fail_retrieve_remote_host_info(bool fail) { | 29 void set_fail_retrieve_remote_host_info(bool fail) { |
| 31 fail_retrieve_remote_host_info_ = fail; | 30 fail_retrieve_remote_host_info_ = fail; |
| 32 } | 31 } |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 // True if RetrieveRemoteHostInfo() should fail. | 34 // True if RetrieveRemoteHostInfo() should fail. |
| 36 bool fail_retrieve_remote_host_info_; | 35 bool fail_retrieve_remote_host_info_; |
| 37 | 36 |
| 38 DISALLOW_COPY_AND_ASSIGN(FakeRemoteHostInfoFetcher); | 37 DISALLOW_COPY_AND_ASSIGN(FakeRemoteHostInfoFetcher); |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 } // namespace test | 40 } // namespace test |
| 42 } // namespace remoting | 41 } // namespace remoting |
| 43 | 42 |
| 44 #endif // REMOTING_TEST_FAKE_REMOTE_HOST_INFO_FETCHER_H_ | 43 #endif // REMOTING_TEST_FAKE_REMOTE_HOST_INFO_FETCHER_H_ |
| OLD | NEW |