fake_resource.h (1213B)
1 /* 2 * Copyright 2019 The WebRTC Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef CALL_ADAPTATION_TEST_FAKE_RESOURCE_H_ 12 #define CALL_ADAPTATION_TEST_FAKE_RESOURCE_H_ 13 14 #include <string> 15 16 #include "absl/strings/string_view.h" 17 #include "api/adaptation/resource.h" 18 #include "api/scoped_refptr.h" 19 20 namespace webrtc { 21 22 // Fake resource used for testing. 23 class FakeResource : public Resource { 24 public: 25 static scoped_refptr<FakeResource> Create(absl::string_view name); 26 27 explicit FakeResource(absl::string_view name); 28 ~FakeResource() override; 29 30 void SetUsageState(ResourceUsageState usage_state); 31 32 // Resource implementation. 33 std::string Name() const override; 34 void SetResourceListener(ResourceListener* listener) override; 35 36 private: 37 const std::string name_; 38 ResourceListener* listener_; 39 }; 40 41 } // namespace webrtc 42 43 #endif // CALL_ADAPTATION_TEST_FAKE_RESOURCE_H_