1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53

content / test / test_render_widget_host.h [blame]

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_TEST_TEST_RENDER_WIDGET_HOST_H_
#define CONTENT_TEST_TEST_RENDER_WIDGET_HOST_H_

#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/test/mock_widget_input_handler.h"
#include "mojo/public/cpp/bindings/pending_remote.h"

namespace content {
// TestRenderWidgetHostView ----------------------------------------------------

// Subclass the RenderWidgetHostImpl so that we can watch the mojo
// input channel.
class TestRenderWidgetHost : public RenderWidgetHostImpl {
 public:
  static std::unique_ptr<RenderWidgetHostImpl> Create(
      FrameTree* frame_tree,
      RenderWidgetHostDelegate* delegate,
      viz::FrameSinkId frame_sink_id,
      base::SafeRef<SiteInstanceGroup> site_instance_group,
      int32_t routing_id,
      bool hidden,
      bool renderer_initiated_creation);

  ~TestRenderWidgetHost() override;

  // RenderWidgetHostImpl overrides.
  blink::mojom::WidgetInputHandler* GetWidgetInputHandler() override;

  MockWidgetInputHandler* GetMockWidgetInputHandler();

  static mojo::PendingAssociatedRemote<blink::mojom::Widget>
  CreateStubWidgetRemote();
  static mojo::PendingAssociatedRemote<blink::mojom::FrameWidget>
  CreateStubFrameWidgetRemote();

 private:
  TestRenderWidgetHost(FrameTree* frame_tree,
                       RenderWidgetHostDelegate* delegate,
                       viz::FrameSinkId frame_sink_id,
                       base::SafeRef<SiteInstanceGroup> site_instance_group,
                       int32_t routing_id,
                       bool hidden,
                       bool renderer_initiated_creation);
  MockWidgetInputHandler input_handler_;
};

}  // namespace content

#endif  // CONTENT_TEST_TEST_RENDER_WIDGET_HOST_H_