1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_
18 #define SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_
19 
20 #include "perfetto/tracing/core/commit_data_request.h"
21 #include "perfetto/tracing/core/tracing_service.h"
22 
23 namespace perfetto {
24 
25 class FakeProducerEndpoint : public TracingService::ProducerEndpoint {
26  public:
RegisterDataSource(const DataSourceDescriptor &)27   void RegisterDataSource(const DataSourceDescriptor&) override {}
UnregisterDataSource(const std::string &)28   void UnregisterDataSource(const std::string&) override {}
RegisterTraceWriter(uint32_t,uint32_t)29   void RegisterTraceWriter(uint32_t, uint32_t) override {}
UnregisterTraceWriter(uint32_t)30   void UnregisterTraceWriter(uint32_t) override {}
CommitData(const CommitDataRequest & req,CommitDataCallback)31   void CommitData(const CommitDataRequest& req, CommitDataCallback) override {
32     last_commit_data_request = req;
33   }
NotifyFlushComplete(FlushRequestID)34   void NotifyFlushComplete(FlushRequestID) override {}
NotifyDataSourceStarted(DataSourceInstanceID)35   void NotifyDataSourceStarted(DataSourceInstanceID) override {}
NotifyDataSourceStopped(DataSourceInstanceID)36   void NotifyDataSourceStopped(DataSourceInstanceID) override {}
ActivateTriggers(const std::vector<std::string> &)37   void ActivateTriggers(const std::vector<std::string>&) override {}
shared_memory()38   SharedMemory* shared_memory() const override { return nullptr; }
shared_buffer_page_size_kb()39   size_t shared_buffer_page_size_kb() const override { return 0; }
CreateTraceWriter(BufferID)40   std::unique_ptr<TraceWriter> CreateTraceWriter(BufferID) override {
41     return nullptr;
42   }
GetInProcessShmemArbiter()43   SharedMemoryArbiter* GetInProcessShmemArbiter() override { return nullptr; }
44 
45   CommitDataRequest last_commit_data_request;
46 };
47 
48 }  // namespace perfetto
49 
50 #endif  // SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_
51