summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/TestInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/TestInvocation.cpp')
-rw-r--r--Tools/WebKitTestRunner/TestInvocation.cpp90
1 files changed, 89 insertions, 1 deletions
diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp
index 9ca75aef7..31b998890 100644
--- a/Tools/WebKitTestRunner/TestInvocation.cpp
+++ b/Tools/WebKitTestRunner/TestInvocation.cpp
@@ -371,7 +371,39 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
WKDoubleRef accuracyWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, accuracyKeyWK.get()));
double accuracy = WKDoubleGetValue(accuracyWK);
- TestController::shared().setMockGeolocationPosition(latitude, longitude, accuracy);
+ WKRetainPtr<WKStringRef> providesAltitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesAltitude"));
+ WKBooleanRef providesAltitudeWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, providesAltitudeKeyWK.get()));
+ bool providesAltitude = WKBooleanGetValue(providesAltitudeWK);
+
+ WKRetainPtr<WKStringRef> altitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("altitude"));
+ WKDoubleRef altitudeWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, altitudeKeyWK.get()));
+ double altitude = WKDoubleGetValue(altitudeWK);
+
+ WKRetainPtr<WKStringRef> providesAltitudeAccuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesAltitudeAccuracy"));
+ WKBooleanRef providesAltitudeAccuracyWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, providesAltitudeAccuracyKeyWK.get()));
+ bool providesAltitudeAccuracy = WKBooleanGetValue(providesAltitudeAccuracyWK);
+
+ WKRetainPtr<WKStringRef> altitudeAccuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("altitudeAccuracy"));
+ WKDoubleRef altitudeAccuracyWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, altitudeAccuracyKeyWK.get()));
+ double altitudeAccuracy = WKDoubleGetValue(altitudeAccuracyWK);
+
+ WKRetainPtr<WKStringRef> providesHeadingKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesHeading"));
+ WKBooleanRef providesHeadingWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, providesHeadingKeyWK.get()));
+ bool providesHeading = WKBooleanGetValue(providesHeadingWK);
+
+ WKRetainPtr<WKStringRef> headingKeyWK(AdoptWK, WKStringCreateWithUTF8CString("heading"));
+ WKDoubleRef headingWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, headingKeyWK.get()));
+ double heading = WKDoubleGetValue(headingWK);
+
+ WKRetainPtr<WKStringRef> providesSpeedKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesSpeed"));
+ WKBooleanRef providesSpeedWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, providesSpeedKeyWK.get()));
+ bool providesSpeed = WKBooleanGetValue(providesSpeedWK);
+
+ WKRetainPtr<WKStringRef> speedKeyWK(AdoptWK, WKStringCreateWithUTF8CString("speed"));
+ WKDoubleRef speedWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, speedKeyWK.get()));
+ double speed = WKDoubleGetValue(speedWK);
+
+ TestController::shared().setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
return;
}
@@ -382,6 +414,56 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetCustomPolicyDelegate")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+
+ WKRetainPtr<WKStringRef> enabledKeyWK(AdoptWK, WKStringCreateWithUTF8CString("enabled"));
+ WKBooleanRef enabledWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, enabledKeyWK.get()));
+ bool enabled = WKBooleanGetValue(enabledWK);
+
+ WKRetainPtr<WKStringRef> permissiveKeyWK(AdoptWK, WKStringCreateWithUTF8CString("permissive"));
+ WKBooleanRef permissiveWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, permissiveKeyWK.get()));
+ bool permissive = WKBooleanGetValue(permissiveWK);
+
+ TestController::shared().setCustomPolicyDelegate(enabled, permissive);
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "ProcessWorkQueue")) {
+ if (TestController::shared().workQueueManager().processWorkQueue()) {
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("WorkQueueProcessedCallback"));
+ WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
+ }
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "QueueBackNavigation")) {
+ ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
+ uint64_t stepCount = WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody));
+ TestController::shared().workQueueManager().queueBackNavigation(stepCount);
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "QueueLoad")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+ WKDictionaryRef loadDataDictionary = static_cast<WKDictionaryRef>(messageBody);
+
+ WKRetainPtr<WKStringRef> urlKey(AdoptWK, WKStringCreateWithUTF8CString("url"));
+ WKStringRef urlWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(loadDataDictionary, urlKey.get()));
+
+ WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target"));
+ WKStringRef targetWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(loadDataDictionary, targetKey.get()));
+
+ TestController::shared().workQueueManager().queueLoad(toWTFString(urlWK), toWTFString(targetWK));
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "QueueReload")) {
+ TestController::shared().workQueueManager().queueReload();
+ return;
+ }
+
ASSERT_NOT_REACHED();
}
@@ -394,6 +476,12 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
return 0;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "IsWorkQueueEmpty")) {
+ bool isEmpty = TestController::shared().workQueueManager().isWorkQueueEmpty();
+ WKRetainPtr<WKTypeRef> result(AdoptWK, WKBooleanCreate(isEmpty));
+ return result;
+ }
+
ASSERT_NOT_REACHED();
return 0;
}