xref: /aosp_15_r20/external/webrtc/call/adaptation/test/fake_resource.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 #include <vector>
16 
17 #include "absl/strings/string_view.h"
18 #include "absl/types/optional.h"
19 #include "api/adaptation/resource.h"
20 #include "api/scoped_refptr.h"
21 
22 namespace webrtc {
23 
24 // Fake resource used for testing.
25 class FakeResource : public Resource {
26  public:
27   static rtc::scoped_refptr<FakeResource> Create(absl::string_view name);
28 
29   explicit FakeResource(absl::string_view name);
30   ~FakeResource() override;
31 
32   void SetUsageState(ResourceUsageState usage_state);
33 
34   // Resource implementation.
35   std::string Name() const override;
36   void SetResourceListener(ResourceListener* listener) override;
37 
38  private:
39   const std::string name_;
40   ResourceListener* listener_;
41 };
42 
43 }  // namespace webrtc
44 
45 #endif  // CALL_ADAPTATION_TEST_FAKE_RESOURCE_H_
46