Skip to content

Commit f93b1e7

Browse files
committed
Stub UIScriptControllerHaiku
The default implementation calls abort(), which generates a "crash" in the testsuite report. Instead just log a message to stderr, so our "crash" section in the test report remains relatively clean, and we have a clear message about what's wrong for these tests.
1 parent 6394f7f commit f93b1e7

File tree

4 files changed

+280
-1
lines changed

4 files changed

+280
-1
lines changed

Tools/DumpRenderTree/PlatformHaiku.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ list(APPEND DumpRenderTree_SOURCES
66
haiku/JSStringUtils.cpp
77
haiku/PixelDumpSupportHaiku.cpp
88
haiku/TestRunnerHaiku.cpp
9+
haiku/UIScriptControllerHaiku.cpp
910
haiku/WorkQueueItemHaiku.cpp
1011
)
1112

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2019 Sony Interactive Entertainment Inc.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "config.h"
27+
#include "UIScriptControllerHaiku.h"
28+
29+
#include "DumpRenderTreeHaiku.h"
30+
#include "UIScriptContext.h"
31+
32+
namespace WTR {
33+
34+
Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
35+
{
36+
return adoptRef(*new UIScriptControllerHaiku(context));
37+
}
38+
39+
void UIScriptControllerHaiku::doAsyncTask(JSValueRef callback)
40+
{
41+
unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
42+
43+
callOnMainThread([this, protectedThis = makeRef(*this), callbackID ] {
44+
if (!m_context)
45+
return;
46+
m_context->asyncTaskComplete(callbackID);
47+
});
48+
}
49+
50+
}
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
/*
2+
* Copyright (C) 2019 Sony Interactive Entertainment Inc.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#include "UIScriptController.h"
29+
30+
namespace WTR {
31+
32+
class UIScriptControllerHaiku : public UIScriptController {
33+
public:
34+
explicit UIScriptControllerHaiku(UIScriptContext& context)
35+
: UIScriptController(context)
36+
{
37+
}
38+
39+
void notImplemented() const { fprintf(stderr, "UIScriptControllerHaiku is not implemented\n"); }
40+
41+
void doAsyncTask(JSValueRef) override;
42+
// Preferences
43+
44+
virtual void overridePreference(JSStringRef preference, JSStringRef value) { notImplemented(); }
45+
46+
// Zooming
47+
48+
virtual void zoomToScale(double scale, JSValueRef callback) { notImplemented(); }
49+
virtual void immediateZoomToScale(double scale) { notImplemented(); }
50+
virtual void setViewScale(double) { notImplemented(); }
51+
virtual double zoomScale() const { notImplemented(); return 1; }
52+
virtual double minimumZoomScale() const { notImplemented(); return 1; }
53+
virtual double maximumZoomScale() const { notImplemented(); return 1; }
54+
55+
// Viewports
56+
57+
virtual void setMinimumEffectiveWidth(double) { notImplemented(); }
58+
virtual void setAllowsViewportShrinkToFit(bool) { notImplemented(); }
59+
60+
virtual Optional<bool> stableStateOverride() const { notImplemented(); return WTF::nullopt; }
61+
virtual void setStableStateOverride(Optional<bool>) { notImplemented(); }
62+
63+
virtual JSObjectRef contentVisibleRect() const { notImplemented(); return nullptr; }
64+
65+
virtual void setSafeAreaInsets(double top, double right, double bottom, double left) { notImplemented(); }
66+
67+
// View Parenting and Visibility
68+
69+
virtual void becomeFirstResponder() { notImplemented(); }
70+
virtual void resignFirstResponder() { notImplemented(); }
71+
72+
virtual void copyText(JSStringRef) { notImplemented(); }
73+
74+
virtual void firstResponderSuppressionForWebView(bool) { notImplemented(); }
75+
virtual void makeWindowContentViewFirstResponder() { notImplemented(); }
76+
virtual bool isWindowContentViewFirstResponder() const { notImplemented(); return false; }
77+
78+
virtual void removeViewFromWindow(JSValueRef) { notImplemented(); }
79+
virtual void addViewToWindow(JSValueRef) { notImplemented(); }
80+
81+
// Compositing
82+
83+
virtual JSObjectRef propertiesOfLayerWithID(uint64_t layerID) const { notImplemented(); return nullptr; }
84+
85+
// Scrolling
86+
87+
virtual bool scrollUpdatesDisabled() const { notImplemented(); return false; }
88+
virtual void setScrollUpdatesDisabled(bool) { notImplemented(); }
89+
90+
virtual void scrollToOffset(long x, long y) { notImplemented(); }
91+
92+
virtual void immediateScrollToOffset(long x, long y) { notImplemented(); }
93+
virtual void immediateScrollElementAtContentPointToOffset(long x, long y, long xScrollOffset, long yScrollOffset) { notImplemented(); }
94+
95+
virtual double contentOffsetX() const { notImplemented(); return 0; }
96+
virtual double contentOffsetY() const { notImplemented(); return 0; }
97+
98+
virtual JSRetainPtr<JSStringRef> scrollingTreeAsText() const { notImplemented(); return nullptr; }
99+
100+
// Touches
101+
102+
virtual void touchDownAtPoint(long x, long y, long touchCount, JSValueRef callback) { notImplemented(); }
103+
virtual void liftUpAtPoint(long x, long y, long touchCount, JSValueRef callback) { notImplemented(); }
104+
virtual void singleTapAtPoint(long x, long y, JSValueRef callback) { notImplemented(); }
105+
virtual void singleTapAtPointWithModifiers(long x, long y, JSValueRef modifierArray, JSValueRef callback) { notImplemented(); }
106+
virtual void twoFingerSingleTapAtPoint(long x, long y, JSValueRef callback) { notImplemented(); }
107+
virtual void doubleTapAtPoint(long x, long y, float delay, JSValueRef callback) { notImplemented(); }
108+
virtual void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback) { notImplemented(); }
109+
virtual void longPressAtPoint(long x, long y, JSValueRef callback) { notImplemented(); }
110+
111+
virtual void activateAtPoint(long x, long y, JSValueRef callback) { notImplemented(); }
112+
113+
// Keyboard
114+
115+
virtual void enterText(JSStringRef) { notImplemented(); }
116+
virtual void typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback) { notImplemented(); }
117+
118+
virtual void keyDown(JSStringRef character, JSValueRef modifierArray) { notImplemented(); }
119+
virtual void toggleCapsLock(JSValueRef callback) { notImplemented(); }
120+
virtual void setContinuousSpellCheckingEnabled(bool) { notImplemented(); }
121+
122+
virtual void rawKeyDown(JSStringRef) { notImplemented(); }
123+
virtual void rawKeyUp(JSStringRef) { notImplemented(); }
124+
125+
virtual void keyboardAccessoryBarNext() { notImplemented(); }
126+
virtual void keyboardAccessoryBarPrevious() { notImplemented(); }
127+
128+
virtual void applyAutocorrection(JSStringRef newString, JSStringRef oldString, JSValueRef callback) { notImplemented(); }
129+
130+
virtual bool isShowingKeyboard() const { notImplemented(); return false; }
131+
virtual bool hasInputSession() const { notImplemented(); return false; }
132+
133+
virtual void setKeyboardInputModeIdentifier(JSStringRef) { notImplemented(); }
134+
135+
virtual void replaceTextAtRange(JSStringRef, int location, int length) { notImplemented(); }
136+
virtual void removeAllDynamicDictionaries() { notImplemented(); }
137+
138+
// Stylus
139+
140+
virtual void stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback) { notImplemented(); }
141+
virtual void stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback) { notImplemented(); }
142+
virtual void stylusUpAtPoint(long x, long y, JSValueRef callback) { notImplemented(); }
143+
virtual void stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback) { notImplemented(); }
144+
virtual void stylusTapAtPointWithModifiers(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef modifierArray, JSValueRef callback) { notImplemented(); }
145+
146+
// Event Stream
147+
148+
virtual void sendEventStream(JSStringRef eventsJSON, JSValueRef callback) { notImplemented(); }
149+
virtual void playBackEventStream(JSStringRef stream, JSValueRef callback) { notImplemented(); }
150+
151+
// Form Controls
152+
153+
virtual void dismissFilePicker(JSValueRef callback) { notImplemented(); }
154+
virtual void dismissFormAccessoryView() { notImplemented(); }
155+
virtual void selectFormAccessoryPickerRow(long) { notImplemented(); }
156+
virtual JSRetainPtr<JSStringRef> textContentType() const { notImplemented(); return nullptr; }
157+
virtual JSRetainPtr<JSStringRef> selectFormPopoverTitle() const { notImplemented(); return nullptr; }
158+
virtual JSRetainPtr<JSStringRef> formInputLabel() const { notImplemented(); return nullptr; }
159+
virtual void setTimePickerValue(long hour, long minute) { notImplemented(); }
160+
virtual bool isShowingDataListSuggestions() const { notImplemented(); return false; }
161+
virtual JSObjectRef calendarType() const { notImplemented(); return nullptr; }
162+
virtual void setDefaultCalendarType(JSStringRef calendarIdentifier, JSStringRef localeIdentifier) { notImplemented(); }
163+
virtual JSObjectRef inputViewBounds() const { notImplemented(); return nullptr; }
164+
virtual void activateDataListSuggestion(unsigned, JSValueRef) { notImplemented(); }
165+
166+
// Share Sheet
167+
168+
virtual void setShareSheetCompletesImmediatelyWithResolution(bool resolved) { notImplemented(); }
169+
170+
// Find in Page
171+
172+
virtual void findString(JSStringRef, unsigned long options, unsigned long maxCount) { notImplemented(); }
173+
174+
// Accessibility
175+
176+
virtual void simulateAccessibilitySettingsChangeNotification(JSValueRef callback) { notImplemented(); }
177+
virtual void retrieveSpeakSelectionContent(JSValueRef) { notImplemented(); }
178+
virtual JSRetainPtr<JSStringRef> accessibilitySpeakSelectionContent() const { notImplemented(); return nullptr; }
179+
virtual JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const { notImplemented(); return nullptr; }
180+
181+
// Swipe
182+
183+
virtual void beginBackSwipe(JSValueRef callback) { notImplemented(); }
184+
virtual void completeBackSwipe(JSValueRef callback) { notImplemented(); }
185+
186+
// Child View Controllers
187+
188+
virtual bool isShowingPopover() const { notImplemented(); return false; }
189+
virtual bool isPresentingModally() const { notImplemented(); return false; }
190+
191+
// Context Menus
192+
193+
virtual bool isDismissingMenu() const { notImplemented(); return false; }
194+
virtual bool isShowingMenu() const { notImplemented(); return false; }
195+
virtual JSObjectRef rectForMenuAction(JSStringRef action) const { notImplemented(); return nullptr; }
196+
virtual JSObjectRef menuRect() const { notImplemented(); return nullptr; }
197+
198+
// Selection
199+
200+
virtual JSObjectRef textSelectionRangeRects() const { notImplemented(); return nullptr; }
201+
virtual JSObjectRef textSelectionCaretRect() const { notImplemented(); return nullptr; }
202+
virtual JSObjectRef selectionStartGrabberViewRect() const { notImplemented(); return nullptr; }
203+
virtual JSObjectRef selectionEndGrabberViewRect() const { notImplemented(); return nullptr; }
204+
virtual JSObjectRef selectionCaretViewRect() const { notImplemented(); return nullptr; }
205+
virtual JSObjectRef selectionRangeViewRects() const { notImplemented(); return nullptr; }
206+
207+
// Rotation
208+
209+
virtual void simulateRotation(DeviceOrientation*, JSValueRef) { notImplemented(); }
210+
virtual void simulateRotationLikeSafari(DeviceOrientation*, JSValueRef) { notImplemented(); }
211+
212+
// Editable Images
213+
214+
virtual void drawSquareInEditableImage() { notImplemented(); }
215+
virtual long numberOfStrokesInEditableImage() { notImplemented(); return 0; }
216+
217+
// Undo/Redo
218+
219+
virtual JSRetainPtr<JSStringRef> lastUndoLabel() const { notImplemented(); return nullptr; }
220+
virtual JSRetainPtr<JSStringRef> firstRedoLabel() const { notImplemented(); return nullptr; }
221+
222+
// Attachment Elements
223+
224+
virtual JSObjectRef attachmentInfo(JSStringRef attachmentIdentifier) { notImplemented(); return nullptr; }
225+
226+
};
227+
228+
}

Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ DeviceOrientation* toDeviceOrientation(JSContextRef context, JSValueRef value)
5858
return nullptr;
5959
}
6060

61-
#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN) && !PLATFORM(WPE)
61+
#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN) && !PLATFORM(WPE) && !PLATFORM(HAIKU)
6262
Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
6363
{
6464
return adoptRef(*new UIScriptController(context));

0 commit comments

Comments
 (0)