blob: d45a5daa7898ce1bfdd6c31518f15d1f1ef9b326 [file] [log] [blame]
Francois Doray6789a482017-12-14 00:21:531// Copyright 2017 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#include "content/test/mock_render_widget_host_delegate.h"
6
7#include "content/browser/renderer_host/render_widget_host_impl.h"
8#include "content/browser/renderer_host/render_widget_host_view_base.h"
9#include "content/public/browser/native_web_keyboard_event.h"
10#include "ui/display/screen.h"
11
12namespace content {
13
Darren Shenca53d5f2018-05-15 04:56:0114MockRenderWidgetHostDelegate::MockRenderWidgetHostDelegate()
15 : text_input_manager_(false /* should_do_learning */) {}
16
Francois Doray6789a482017-12-14 00:21:5317MockRenderWidgetHostDelegate::~MockRenderWidgetHostDelegate() = default;
18
19void MockRenderWidgetHostDelegate::ResizeDueToAutoResize(
20 RenderWidgetHostImpl* render_widget_host,
Fady Samuel97947112018-05-05 16:24:5421 const gfx::Size& new_size) {}
Francois Doray6789a482017-12-14 00:21:5322
Francois Doray6789a482017-12-14 00:21:5323KeyboardEventProcessingResult
24MockRenderWidgetHostDelegate::PreHandleKeyboardEvent(
25 const NativeWebKeyboardEvent& event) {
26 last_event_ = std::make_unique<NativeWebKeyboardEvent>(event);
27 return pre_handle_keyboard_event_result_;
28}
29
30void MockRenderWidgetHostDelegate::ExecuteEditCommand(
31 const std::string& command,
32 const base::Optional<base::string16>& value) {}
33
34void MockRenderWidgetHostDelegate::Cut() {}
35
36void MockRenderWidgetHostDelegate::Copy() {}
37
38void MockRenderWidgetHostDelegate::Paste() {}
39
40void MockRenderWidgetHostDelegate::SelectAll() {}
41
Kevin McNee32e2fc52019-01-09 00:02:4142void MockRenderWidgetHostDelegate::CreateInputEventRouter() {
43 rwh_input_event_router_ =
44 std::make_unique<RenderWidgetHostInputEventRouter>();
45}
46
47RenderWidgetHostInputEventRouter*
48MockRenderWidgetHostDelegate::GetInputEventRouter() {
49 return rwh_input_event_router_.get();
50}
51
Francois Doray6789a482017-12-14 00:21:5352RenderWidgetHostImpl* MockRenderWidgetHostDelegate::GetFocusedRenderWidgetHost(
53 RenderWidgetHostImpl* widget_host) {
54 return !!focused_widget_ ? focused_widget_ : widget_host;
55}
56
57void MockRenderWidgetHostDelegate::SendScreenRects() {
58 if (rwh_)
59 rwh_->SendScreenRects();
60}
61
62TextInputManager* MockRenderWidgetHostDelegate::GetTextInputManager() {
63 return &text_input_manager_;
64}
65
Lucas Furukawa Gadanie1c5dfda2018-11-29 17:57:4166bool MockRenderWidgetHostDelegate::IsFullscreenForCurrentTab() {
Francois Doray6789a482017-12-14 00:21:5367 return is_fullscreen_;
68}
69
70} // namespace content