diff options
Diffstat (limited to 'Tools/DumpRenderTree/TestRunner.cpp')
| -rw-r--r-- | Tools/DumpRenderTree/TestRunner.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp index 9f7a7c1be..fe28a2911 100644 --- a/Tools/DumpRenderTree/TestRunner.cpp +++ b/Tools/DumpRenderTree/TestRunner.cpp @@ -699,13 +699,6 @@ static JSValueRef computedStyleIncludingVisitedInfoCallback(JSContextRef context return controller->computedStyleIncludingVisitedInfo(context, arguments[0]); } -static JSValueRef layerTreeAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - // Has mac & windows implementation - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(context, controller->layerTreeAsText().get()); -} - static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1087,10 +1080,40 @@ static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObj if (argumentCount < 3) return JSValueMakeUndefined(context); + double latitude = JSValueToNumber(context, arguments[0], 0); + double longitude = JSValueToNumber(context, arguments[1], 0); + double accuracy = JSValueToNumber(context, arguments[2], 0); + + bool canProvideAltitude = false; + double altitude = 0.; + if (argumentCount > 3 && !JSValueIsUndefined(context, arguments[3])) { + canProvideAltitude = true; + altitude = JSValueToNumber(context, arguments[3], 0); + } + + bool canProvideAltitudeAccuracy = false; + double altitudeAccuracy = 0.; + if (argumentCount > 4 && !JSValueIsUndefined(context, arguments[4])) { + canProvideAltitudeAccuracy = true; + altitudeAccuracy = JSValueToNumber(context, arguments[4], 0); + } + + bool canProvideHeading = false; + double heading = 0.; + if (argumentCount > 5 && !JSValueIsUndefined(context, arguments[5])) { + canProvideHeading = true; + heading = JSValueToNumber(context, arguments[5], 0); + } + + bool canProvideSpeed = false; + double speed = 0.; + if (argumentCount > 6 && !JSValueIsUndefined(context, arguments[6])) { + canProvideSpeed = true; + speed = JSValueToNumber(context, arguments[6], 0); + } + TestRunner* controller = reinterpret_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setMockGeolocationPosition(JSValueToNumber(context, arguments[0], NULL), // latitude - JSValueToNumber(context, arguments[1], NULL), // longitude - JSValueToNumber(context, arguments[2], NULL)); // accuracy + controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed); return JSValueMakeUndefined(context); } @@ -2214,7 +2237,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "ignoreLegacyWebNotificationPermissionRequests", ignoreLegacyWebNotificationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
