5#ifndef TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_
6#define TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_
13#include "testing/embedder_test.h"
14#include "testing/fx_string_testhelpers.h"
31 int Alert(FPDF_WIDESTRING message,
32 FPDF_WIDESTRING title,
36 {GetPlatformWString(message), GetPlatformWString(title), type, icon});
41 int id = fail_next_timer_ ? 0 : ++next_timer_id_;
42 expiry_to_timer_map_.insert(
43 std::pair<
int, Timer>(msecs + fake_elapsed_msecs_, {id, msecs, fn}));
44 fail_next_timer_ =
false;
49 for (
auto iter = expiry_to_timer_map_.begin();
50 iter != expiry_to_timer_map_.end(); ++iter) {
51 if (iter->second.id == id) {
52 expiry_to_timer_map_.erase(iter);
59 fake_elapsed_msecs_ += increment_msecs;
61 auto iter = expiry_to_timer_map_.begin();
62 if (iter == expiry_to_timer_map_.end()) {
65 if (iter->first > fake_elapsed_msecs_) {
68 Timer t = iter->second;
69 expiry_to_timer_map_.erase(iter);
70 expiry_to_timer_map_.insert(
71 std::pair<
int, Timer>(fake_elapsed_msecs_ + t.interval, t));
81 std::multimap<
int, Timer> expiry_to_timer_map_;
82 bool fail_next_timer_ =
false;
83 int next_timer_id_ = 0;
84 int fake_elapsed_msecs_ = 0;
85 std::vector<AlertRecord> alerts_;
constexpr CFX_FloatRect(float l, float b, float r, float t)
CPDFSDK_Annot * GetFirstAnnot()
CPDFSDK_Annot * GetLastAnnot()
CPDFSDK_Annot * GetNextAnnot(CPDFSDK_Annot *pAnnot)
CPDFSDK_Annot * GetPrevAnnot(CPDFSDK_Annot *pAnnot)
virtual CFX_FloatRect GetRect() const =0
UnownedPtr< IPWL_FillerNotify > const pFillerNotify
CreateParams(const CreateParams &other)
IPWL_FillerNotify::CursorStyle eCursorType
CreateParams(CFX_Timer::HandlerIface *timer_handler, IPWL_FillerNotify *filler_notify, ProviderIface *provider)
ObservedPtr< ProviderIface > pProvider
CFX_Color sBackgroundColor
ObservedPtr< CFX_Timer::HandlerIface > const pTimerHandler
UnownedPtr< IPVT_FontMap > pFontMap
UNOWNED_PTR_EXCLUSION SharedCaptureFocusState * pSharedCaptureFocusState
virtual ~ProviderIface()=default
virtual void OnSetFocusForEdit(CPWL_Edit *pEdit)=0
virtual CFX_Matrix GetWindowMatrix(const IPWL_FillerNotify::PerWindowData *pAttached)=0
CFX_Matrix GetWindowMatrix() const
static bool IsPlatformShortcutKey(Mask< FWL_EVENTFLAG > nFlag)
static bool IsCTRLKeyDown(Mask< FWL_EVENTFLAG > nFlag)
virtual bool OnMouseWheel(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point, const CFX_Vector &delta)
virtual bool SelectAllText()
virtual void ScrollWindowVertically(float pos)
virtual bool OnRButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
bool InvalidateRectMove(const CFX_FloatRect &rcOld, const CFX_FloatRect &rcNew)
bool ClientHitTest(const CFX_PointF &point) const
static bool IsALTKeyDown(Mask< FWL_EVENTFLAG > nFlag)
CFX_Color GetBorderColor() const
const CFX_FloatRect & GetClipRect() const
BorderStyle GetBorderStyle() const
virtual void NotifyMouseMove(CPWL_Wnd *child, const CFX_PointF &pos)
virtual bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag)
bool WndHitTest(const CFX_PointF &point) const
virtual void ReplaceAndKeepSelection(const WideString &text)
CFX_PointF GetCenterPoint() const
void RemoveFlag(uint32_t dwFlags)
CFX_Color GetBackgroundColor() const
std::vector< UnownedPtr< CPWL_Wnd > > GetAncestors()
IPWL_FillerNotify * GetFillerNotify() const
bool HasFlag(uint32_t dwFlags) const
virtual CFX_FloatRect GetClientRect() const
virtual WideString GetSelectedText()
CFX_FloatRect GetWindowRect() const
bool IsCaptureMouse() const
CPWL_Wnd * GetParentWindow() const
virtual void NotifyLButtonDown(CPWL_Wnd *child, const CFX_PointF &pos)
IPVT_FontMap * GetFontMap() const
void SetTransparency(int32_t nTransparency)
CPWL_Wnd(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
virtual bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool OnMouseMove(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool RepositionChildWnd()
void InvalidateProvider(ProviderIface *provider)
static bool IsSHIFTKeyDown(Mask< FWL_EVENTFLAG > nFlag)
virtual bool OnRButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlag)
int32_t GetBorderWidth() const
CreateParams * GetCreationParams()
virtual float GetFontSize() const
CFX_Color GetBorderRightBottomColor(BorderStyle nBorderStyle) const
virtual void SetScrollInfo(const PWL_SCROLL_INFO &info)
virtual bool InvalidateRect(const CFX_FloatRect *pRect)
virtual void CreateChildWnd(const CreateParams &cp)
virtual CFX_FloatRect GetFocusRect() const
virtual bool SetVisible(bool bVisible)
virtual void ReplaceSelection(const WideString &text)
IPWL_FillerNotify::PerWindowData * GetAttachedData() const
const CPWL_Dash & GetBorderDash() const
virtual void OnSetFocus()
virtual void SetFontSize(float fFontSize)
int32_t GetInnerBorderWidth() const
int32_t GetTransparency()
bool IsWndCaptureMouse(const CPWL_Wnd *pWnd) const
virtual void SetScrollPosition(float pos)
virtual void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
ProviderIface * GetProvider() const
bool Move(const CFX_FloatRect &rcNew, bool bReset, bool bRefresh)
void SetClipRect(const CFX_FloatRect &rect)
bool IsWndCaptureKeyboard(const CPWL_Wnd *pWnd) const
CFX_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const
static const CFX_Color kDefaultWhiteColor
virtual void OnKillFocus()
CFX_Timer::HandlerIface * GetTimerHandler() const
std::unique_ptr< IPWL_FillerNotify::PerWindowData > CloneAttachedData() const
virtual bool OnLButtonDblClk(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
CFX_Color GetTextColor() const
virtual void NotifyLButtonUp(CPWL_Wnd *child, const CFX_PointF &pos)
CPWL_ScrollBar * GetVScrollBar() const
static const CFX_Color kDefaultBlackColor
static bool IsMETAKeyDown(Mask< FWL_EVENTFLAG > nFlag)
virtual bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
void AddChild(std::unique_ptr< CPWL_Wnd > pWnd)
void DrawAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
void RemoveChild(CPWL_Wnd *pWnd)
virtual WideString GetText()
MOCK_METHOD1(DoURIAction, void(FPDF_BYTESTRING uri))
MOCK_METHOD1(UnsupportedHandler, void(int type))
MOCK_METHOD2(SetTimer, int(int msecs, TimerCallback fn))
MOCK_METHOD3(OnFocusChange, void(FPDF_FORMFILLINFO *info, FPDF_ANNOTATION annot, int page_index))
MOCK_METHOD4(Alert, int(FPDF_WIDESTRING message, FPDF_WIDESTRING title, int type, int icon))
MOCK_METHOD3(DoURIActionWithKeyboardModifier, void(FPDF_FORMFILLINFO *info, FPDF_BYTESTRING uri, int modifiers))
MOCK_METHOD5(DoGoToAction, void(FPDF_FORMFILLINFO *info, int page_index, int zoom_mode, float *pos_array, int array_size))
int SetTimer(int msecs, TimerCallback fn) override
const std::vector< AlertRecord > & GetAlerts() const
int Alert(FPDF_WIDESTRING message, FPDF_WIDESTRING title, int type, int icon) override
void AdvanceTime(int increment_msecs)
void KillTimer(int id) override
virtual ~PerWindowData()=default
virtual std::unique_ptr< PerWindowData > Clone() const =0
virtual void SetCursor(CursorStyle nCursorStyle)=0
virtual BeforeKeystrokeResult OnBeforeKeyStroke(const PerWindowData *pAttached, WideString &strChange, const WideString &strChangeEx, int nSelStart, int nSelEnd, bool bKeyDown, Mask< FWL_EVENTFLAG > nFlag)=0
virtual ~IPWL_FillerNotify()=default
virtual void QueryWherePopup(const PerWindowData *pAttached, float fPopupMin, float fPopupMax, bool *bBottom, float *fPopupRet)=0
virtual bool OnPopupPostOpen(const PerWindowData *pAttached, Mask< FWL_EVENTFLAG > nFlag)=0
virtual bool OnPopupPreOpen(const PerWindowData *pAttached, Mask< FWL_EVENTFLAG > nFlag)=0
virtual bool IsSelectionImplemented() const =0
virtual void OutputSelectedRect(PerWindowData *pWidgetData, const CFX_FloatRect &rect)=0
virtual void InvalidateRect(PerWindowData *pWidgetData, const CFX_FloatRect &rect)=0
TEST_F(CPDFSDK_AnnotIteratorTest, CPDFSDK_AnnotIterator)
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
#define UNOWNED_PTR_EXCLUSION