#import "PixelDumpSupport.h"
#import "PolicyDelegate.h"
#import "ResourceLoadDelegate.h"
+#import "StorageTrackerDelegate.h"
#import "UIDelegate.h"
#import "WebArchiveDumpSupport.h"
#import "WorkQueue.h"
#import <WebKit/WebPreferencesPrivate.h>
#import <WebKit/WebPreferenceKeysPrivate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebStorageManagerPrivate.h>
#import <WebKit/WebTypesInternal.h>
#import <WebKit/WebViewPrivate.h>
#import <getopt.h>
static ResourceLoadDelegate *resourceLoadDelegate;
static HistoryDelegate *historyDelegate;
PolicyDelegate *policyDelegate;
+StorageTrackerDelegate *storageDelegate;
static int dumpPixels;
static int threaded;
[WebView registerURLSchemeAsLocal:@"feedsearch"];
[webView setContinuousSpellCheckingEnabled:YES];
+ [webView setGrammarCheckingEnabled:YES];
+ [webView setInteractiveFormValidationEnabled:YES];
+ [webView setValidationMessageTimerMagnification:-1];
// To make things like certain NSViews, dragging, and plug-ins work, put the WebView a window, but put it off-screen so you don't see it.
// Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates.
[defaults setBool:NO forKey:@"AppleScrollAnimationEnabled"];
[defaults setBool:NO forKey:@"NSOverlayScrollersEnabled"];
+ [defaults setObject:@"Always" forKey:@"AppleShowScrollBars"];
if (initialValue)
CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), initialValue.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
NSString *path = libraryPathForDumpRenderTree();
[defaults setObject:[path stringByAppendingPathComponent:@"Databases"] forKey:WebDatabaseDirectoryDefaultsKey];
+ [defaults setObject:[path stringByAppendingPathComponent:@"LocalStorage"] forKey:WebStorageDirectoryDefaultsKey];
[defaults setObject:[path stringByAppendingPathComponent:@"LocalCache"] forKey:WebKitLocalCacheDefaultsKey];
WebPreferences *preferences = [WebPreferences standardPreferences];
[preferences setOfflineWebApplicationCacheEnabled:YES];
[preferences setDeveloperExtrasEnabled:NO];
[preferences setLoadsImagesAutomatically:YES];
+ [preferences setLoadsSiteIconsIgnoringImageLoadingPreference:NO];
[preferences setFrameFlatteningEnabled:NO];
+ [preferences setSpatialNavigationEnabled:NO];
[preferences setEditingBehavior:WebKitEditingMacBehavior];
if (persistentUserStyleSheetLocation) {
[preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
// So, turn it off for now, but we might want to turn it back on some day.
[preferences setUsesPageCache:NO];
[preferences setAcceleratedCompositingEnabled:YES];
+#if USE(CA) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ [preferences setCanvasUsesAcceleratedDrawing:YES];
+ [preferences setAcceleratedDrawingEnabled:NO];
+#endif
[preferences setWebGLEnabled:NO];
[preferences setUsePreHTML5ParserQuirks:NO];
[preferences setAsynchronousSpellCheckingEnabled:NO];
resourceLoadDelegate = [[ResourceLoadDelegate alloc] init];
policyDelegate = [[PolicyDelegate alloc] init];
historyDelegate = [[HistoryDelegate alloc] init];
+ storageDelegate = [[StorageTrackerDelegate alloc] init];
}
// ObjC++ doens't seem to let me pass NSObject*& sadly.
releaseAndZero(&resourceLoadDelegate);
releaseAndZero(&uiDelegate);
releaseAndZero(&policyDelegate);
+ releaseAndZero(&storageDelegate);
}
static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[])
return [[item1 target] caseInsensitiveCompare:[item2 target]];
}
+static NSData *dumpAudio()
+{
+ const char *encodedAudioData = gLayoutTestController->encodedAudioData().c_str();
+
+ NSData *data = [NSData dataWithBytes:encodedAudioData length:gLayoutTestController->encodedAudioData().length()];
+ return data;
+}
+
static void dumpHistoryItem(WebHistoryItem *item, int indent, BOOL current)
{
int start = 0;
static void dumpFrameScrollPosition(WebFrame *f)
{
- NSPoint scrollPosition = [[[[f frameView] documentView] superview] bounds].origin;
+ WebScriptObject* scriptObject = [f windowObject];
+ NSPoint scrollPosition = NSMakePoint(
+ [[scriptObject valueForKey:@"pageXOffset"] floatValue],
+ [[scriptObject valueForKey:@"pageYOffset"] floatValue]);
if (ABS(scrollPosition.x) > 0.00000001 || ABS(scrollPosition.y) > 0.00000001) {
if ([f parentFrame] != nil)
printf("frame '%s' ", [[f name] UTF8String]);
gLayoutTestController->setDumpAsText(true);
gLayoutTestController->setGeneratePixelResults(false);
}
- if (gLayoutTestController->dumpAsText()) {
+ if (gLayoutTestController->dumpAsAudio()) {
+ resultData = dumpAudio();
+ resultMimeType = @"audio/wav";
+ } else if (gLayoutTestController->dumpAsText()) {
resultString = dumpFramesAsText(mainFrame);
} else if (gLayoutTestController->dumpAsPDF()) {
resultData = dumpFrameAsPDF(mainFrame);
printf("Content-Type: %s\n", [resultMimeType UTF8String]);
+ if (gLayoutTestController->dumpAsAudio())
+ printf("Content-Transfer-Encoding: base64\n");
+
if (resultData) {
fwrite([resultData bytes], 1, [resultData length], stdout);
return strstr(pathOrURL, "inspector/");
}
+static bool shouldDumpAsText(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "dumpAsText/");
+}
+
static bool shouldEnableDeveloperExtras(const char* pathOrURL)
{
return true;
[(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES];
[webView makeTextStandardSize:nil];
[webView resetPageZoom:nil];
+ [webView _scaleWebView:1.0 atOrigin:NSZeroPoint];
[webView setTabKeyCyclesThroughElements:YES];
[webView setPolicyDelegate:nil];
[policyDelegate setPermissive:NO];
[[webView undoManager] removeAllActions];
[WebView _removeAllUserContentFromGroup:[webView groupName]];
[[webView window] setAutodisplay:NO];
+ [webView _setMinimumTimerInterval:[WebView _defaultMinimumTimerInterval]];
resetDefaultsToConsistentValues();
// Clear the contents of the general pasteboard
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+
+ [mainFrame _clearOpener];
}
static void runTest(const string& testPathOrURL)
gLayoutTestController->setDeveloperExtrasEnabled(true);
if (shouldOpenWebInspector(pathOrURL.c_str()))
gLayoutTestController->showWebInspector();
+ if (shouldDumpAsText(pathOrURL.c_str())) {
+ gLayoutTestController->setDumpAsText(true);
+ gLayoutTestController->setGeneratePixelResults(false);
+ }
}
if ([WebHistory optionalSharedHistory])