1 // Copyright 2016 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_SCROLL_FRAME_GENERATOR_H_
6 #define REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_
7 
8 #include <memory>
9 #include <unordered_map>
10 
11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h"
13 #include "remoting/protocol/input_event_timestamps.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
15 
16 namespace remoting {
17 namespace test {
18 
19 class ScrollFrameGenerator : public protocol::InputEventTimestampsSource {
20  public:
21   ScrollFrameGenerator();
22 
23   std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
24       webrtc::SharedMemoryFactory* shared_memory_factory);
25 
26   // InputEventTimestampsSource interface.
27   protocol::InputEventTimestamps TakeLastEventTimestamps() override;
28 
29  private:
30   ~ScrollFrameGenerator() override;
31 
32   std::unique_ptr<webrtc::DesktopFrame> base_frame_;
33   base::TimeTicks start_time_;
34 
35   std::unordered_map<int, base::TimeTicks> frame_timestamp_;
36 
37   DISALLOW_COPY_AND_ASSIGN(ScrollFrameGenerator);
38 };
39 
40 }  // namespace test
41 }  // namespace remoting
42 
43 #endif  // REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_
44