Flutter Engine
mock_window_win32.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WIN32_WINDOW_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WIN32_WINDOW_H_
7 
8 #include <windowsx.h>
9 
10 #include "flutter/shell/platform/windows/testing/test_keyboard.h"
11 #include "flutter/shell/platform/windows/window_win32.h"
12 #include "gmock/gmock.h"
13 
14 namespace flutter {
15 namespace testing {
16 
17 /// Mock for the |WindowWin32| base class.
18 class MockWin32Window : public WindowWin32 {
19  public:
21  MockWin32Window(std::unique_ptr<TextInputManagerWin32> text_input_manager);
22  virtual ~MockWin32Window();
23 
24  // Prevent copying.
25  MockWin32Window(MockWin32Window const&) = delete;
26  MockWin32Window& operator=(MockWin32Window const&) = delete;
27 
28  // Wrapper for GetCurrentDPI() which is a protected method.
29  UINT GetDpi();
30 
31  // Simulates a WindowProc message from the OS.
33  WPARAM const wparam,
34  LPARAM const lparam);
35 
36  void InjectMessageList(int count, const Win32Message* messages);
37 
38  MOCK_METHOD1(OnDpiScale, void(unsigned int));
39  MOCK_METHOD2(OnResize, void(unsigned int, unsigned int));
41  void(double, double, FlutterPointerDeviceKind, int32_t));
43  void(double, double, FlutterPointerDeviceKind, int32_t, UINT));
45  void(double, double, FlutterPointerDeviceKind, int32_t, UINT));
47  void(double, double, FlutterPointerDeviceKind, int32_t));
48  MOCK_METHOD0(OnSetCursor, void());
49  MOCK_METHOD1(OnText, void(const std::u16string&));
51  void(int, int, int, char32_t, bool, bool, KeyEventCallback));
55  void(double, double, FlutterPointerDeviceKind, int32_t));
58  MOCK_METHOD0(OnComposeEnd, void());
59  MOCK_METHOD2(OnComposeChange, void(const std::u16string&, int));
60  MOCK_METHOD3(OnImeComposition, void(UINT const, WPARAM const, LPARAM const));
61 
62  void CallOnImeComposition(UINT const message,
63  WPARAM const wparam,
64  LPARAM const lparam);
65 
66  protected:
67  LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
68 };
69 
70 } // namespace testing
71 } // namespace flutter
72 
73 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WIN32_WINDOW_H_
virtual void OnText(const std::u16string &text)=0
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
MOCK_METHOD4(OnPointerMove, void(double, double, FlutterPointerDeviceKind, int32_t))
virtual void OnDpiScale(UINT dpi)=0
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)=0
Win32Message message
MOCK_METHOD5(OnPointerDown, void(double, double, FlutterPointerDeviceKind, int32_t, UINT))
void CallOnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
FlutterPointerDeviceKind
The device type that created a pointer event.
Definition: embedder.h:753
LONG_PTR LRESULT
Definition: windows_types.h:61
UnimplementedNativeViewAccessible * NativeViewAccessible
UINT_PTR WPARAM
Definition: windows_types.h:59
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
MOCK_METHOD2(OnResize, void(unsigned int, unsigned int))
MockWin32Window & operator=(MockWin32Window const &)=delete
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)=0
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)=0
MOCK_METHOD1(OnDpiScale, void(unsigned int))
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
MOCK_METHOD7(OnKey, void(int, int, int, char32_t, bool, bool, KeyEventCallback))
virtual void OnSetCursor()=0
MOCK_METHOD3(OnImeComposition, void(UINT const, WPARAM const, LPARAM const))
LRESULT InjectWindowMessage(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0
virtual void OnComposeEnd()=0
MOCK_METHOD0(OnSetCursor, void())
LONG_PTR LPARAM
Definition: windows_types.h:60
virtual void OnComposeBegin()=0
void InjectMessageList(int count, const Win32Message *messages)
unsigned int UINT
Definition: windows_types.h:32
Mock for the |WindowWin32| base class.
virtual void OnUpdateSemanticsEnabled(bool enabled)=0
LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
virtual void OnResize(UINT width, UINT height)=0
virtual void OnComposeCommit()=0