Commit e1d57dbb authored by bdakin@apple.com's avatar bdakin@apple.com
Browse files

WebKitTools:

2008-06-24  Sam Weinig and Beth Dakin  <bdakin@apple.com and sam@webkit.org>

        Reviewed by Darin.

        Fix for <rdar://problem/5884881> Make DumpRenderTree support 
        accessibility tests

        This patch adds some basic support for accessibility layout tests 
        on the Mac.

        * DumpRenderTree/AccessibilityController.cpp: Added.
        (AccessibilityController::AccessibilityController):
        (AccessibilityController::~AccessibilityController):
        (dumpCurrentAttributesCallback):
        (AccessibilityController::makeWindowObject):
        (AccessibilityController::getJSClass):
        (AccessibilityController::staticFunctions):
        * DumpRenderTree/AccessibilityController.h: Added.
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
        * DumpRenderTree/mac/AccessibilityControllerMac.mm: Added.
        (descriptionOfValue):
        (AccessibilityController::dumpCurrentAttributes):
        * DumpRenderTree/mac/DumpRenderTree.mm:
        * DumpRenderTree/mac/FrameLoadDelegate.h:
        * DumpRenderTree/mac/FrameLoadDelegate.mm:
        (-[FrameLoadDelegate init]):
        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):

LayoutTests:

2008-06-24  Sam Weinig and Beth Dakin  <bdakin@apple.com and sam@webkit.org>

        Reviewed by Darin.
        
        First test for <rdar://problem/5884881> Make DumpRenderTree support 
        accessibility tests

        * accessibility: Added.
        * accessibility/document-attributes-expected.txt: Added.
        * accessibility/document-attributes.html: Added.
        * platform/gtk/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34776 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c0dac789
2008-06-24 Sam Weinig and Beth Dakin <bdakin@apple.com and sam@webkit.org>
Reviewed by Darin.
First test for <rdar://problem/5884881> Make DumpRenderTree support
accessibility tests
* accessibility: Added.
* accessibility/document-attributes-expected.txt: Added.
* accessibility/document-attributes.html: Added.
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
2008-06-24 Sam Weinig <sam@webkit.org>
 
Reviewed by Anders Carlsson.
AXRole: AXWebArea
AXSubrole:
AXRoleDescription: HTML content
AXChildren: <array of size 0>
AXHelp:
AXParent: <AXWebArea>
AXPosition: NSPoint: {-10000, 10900}
AXSize: NSSize: {0, 0}
AXTitle:
AXDescription:
AXValue:
AXFocused: 0
AXEnabled: 1
AXWindow: <AXWebArea>
AXSelectedTextMarkerRange:
AXStartTextMarker: <AXWebArea>
AXEndTextMarker: <AXWebArea>
AXVisited: 0
AXLinkedUIElements:
AXSelected: 0
AXBlockQuoteLevel: 0
AXLinkUIElements: <array of size 0>
AXLoaded: 1
AXLayoutCount: 2
AXURL: LayoutTests/accessibility/document-attributes.html
<html>
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var log = function(msg)
{
document.getElementById("console").appendChild(document.createTextNode(msg + "\n"));
}
onload = function()
{
if (window.accessibilityController)
log(accessibilityController.dumpCurrentAttributes());
else
log("This test requires DumpRenderTree to run.")
}
</script>
</head>
<body>
<pre id="console"></pre>
</body>
</html>
......@@ -4,4 +4,6 @@ editing/execCommand/print.html
storage/quota-tracking.html
storage/success-callback.html
# Application cache
http/tests/appcache
\ No newline at end of file
http/tests/appcache
# Missing AccessibilityController implementation
accessibility
# ------- missing features in DRT
accessibility
editing/selection/4975120.html
editing/selection/5109817.html
editing/selection/5354455-1.html
......
......@@ -407,3 +407,6 @@ http/tests/appcache
# <rdar://problem/5961006> LayoutTests that send an OPTIONS request don't work on Windows due to Apache 1.3
http/tests/xmlhttprequest/access-control-basic-not-get-allow-async.html
http/tests/xmlhttprequest/access-control-basic-not-get-allow.html
# Still need to implement AccessibilityController for DumpRenderTree on Windows
accessibility
2008-06-24 Sam Weinig and Beth Dakin <bdakin@apple.com and sam@webkit.org>
Reviewed by Darin.
Fix for <rdar://problem/5884881> Make DumpRenderTree support
accessibility tests
This patch adds some basic support for accessibility layout tests
on the Mac.
* DumpRenderTree/AccessibilityController.cpp: Added.
(AccessibilityController::AccessibilityController):
(AccessibilityController::~AccessibilityController):
(dumpCurrentAttributesCallback):
(AccessibilityController::makeWindowObject):
(AccessibilityController::getJSClass):
(AccessibilityController::staticFunctions):
* DumpRenderTree/AccessibilityController.h: Added.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/mac/AccessibilityControllerMac.mm: Added.
(descriptionOfValue):
(AccessibilityController::dumpCurrentAttributes):
* DumpRenderTree/mac/DumpRenderTree.mm:
* DumpRenderTree/mac/FrameLoadDelegate.h:
* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate init]):
(-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
2008-06-24 John Sullivan <sullivan@apple.com>
 
Reviewed by Dan Bernstein
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AccessibilityController.h"
#import <JavaScriptCore/JSRetainPtr.h>
AccessibilityController::AccessibilityController()
{
}
AccessibilityController::~AccessibilityController()
{
}
static JSValueRef dumpCurrentAttributesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
JSRetainPtr<JSStringRef> attributes(Adopt, controller->dumpCurrentAttributes());
return JSValueMakeString(context, attributes.get());
}
// Object Creation
void AccessibilityController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
{
JSRetainPtr<JSStringRef> accessibilityControllerStr(Adopt, JSStringCreateWithUTF8CString("accessibilityController"));
JSValueRef accessibilityControllerObject = JSObjectMake(context, getJSClass(), this);
JSObjectSetProperty(context, windowObject, accessibilityControllerStr.get(), accessibilityControllerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
}
JSClassRef AccessibilityController::getJSClass()
{
static JSClassRef accessibilityControllerClass;
if (!accessibilityControllerClass) {
JSStaticFunction* staticFunctions = AccessibilityController::staticFunctions();
JSClassDefinition classDefinition = {
0, kJSClassAttributeNone, "AccessibilityController", 0, 0, staticFunctions,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
accessibilityControllerClass = JSClassCreate(&classDefinition);
}
return accessibilityControllerClass;
}
JSStaticFunction* AccessibilityController::staticFunctions()
{
static JSStaticFunction staticFunctions[] = {
{ "dumpCurrentAttributes", dumpCurrentAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
return staticFunctions;
}
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AccessibilityController_h
#define AccessibilityController_h
#include <JavaScriptCore/JSObjectRef.h>
class AccessibilityController {
public:
AccessibilityController();
~AccessibilityController();
void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
// Controller Methods - platfrom independant implementations
JSStringRef dumpCurrentAttributes();
private:
static JSClassRef getJSClass();
static JSStaticFunction* staticFunctions();
};
#endif // AccessibilityController_h
......@@ -90,6 +90,8 @@
BCB284D00CFA83CC007E533E /* PixelDumpSupportCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB284890CFA8202007E533E /* PixelDumpSupportCG.h */; };
BCB284D60CFA83D1007E533E /* PixelDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */; };
BCB284F60CFA84F8007E533E /* ImageDiffCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */; };
BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */; };
BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */; };
BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF6C64F0C98E9C000AC063E /* GCController.cpp */; };
/* End PBXBuildFile section */
......@@ -200,6 +202,9 @@
BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = PixelDumpSupportMac.mm; path = mac/PixelDumpSupportMac.mm; sourceTree = "<group>"; };
BCB284B20CFA82CB007E533E /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageDiffCG.cpp; path = cg/ImageDiffCG.cpp; sourceTree = "<group>"; };
BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityController.h; sourceTree = "<group>"; };
BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = "<group>"; };
BCF6C64F0C98E9C000AC063E /* GCController.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = GCController.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -285,6 +290,9 @@
1422A2690AF6F45200E1A883 /* Controllers */ = {
isa = PBXGroup;
children = (
BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */,
BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */,
BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */,
BCA18B360C9B021900114369 /* AppleScriptController.h */,
BCA18B370C9B021900114369 /* AppleScriptController.m */,
BCA18B6B0C9B08DB00114369 /* EventSendingController.h */,
......@@ -589,6 +597,8 @@
BCB284CD0CFA83C8007E533E /* PixelDumpSupportCG.cpp in Sources */,
BCB284D60CFA83D1007E533E /* PixelDumpSupportMac.mm in Sources */,
BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */,
BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */,
BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "DumpRenderTree.h"
#import "AccessibilityController.h"
#import <Foundation/Foundation.h>
#import <JavaScriptCore/JSStringRef.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebHTMLView.h>
#import <wtf/Vector.h>
#import <wtf/RetainPtr.h>
static NSString* descriptionOfValue(id valueObject, id focusedAccessibilityObject)
{
if (!valueObject)
return NULL;
if ([valueObject isKindOfClass:[NSArray class]])
return [NSString stringWithFormat:@"<array of size %d>", [(NSArray*)valueObject count]];
// Strip absolute URL paths
NSString* description = [valueObject description];
NSRange range = [description rangeOfString:@"LayoutTests"];
if (range.length)
return [description substringFromIndex:range.location];
// Strip pointer locations
if ([description rangeOfString:@": 0x"].length) {
NSString* role = [focusedAccessibilityObject accessibilityAttributeValue:@"AXRole"];
NSString* title = [focusedAccessibilityObject accessibilityAttributeValue:@"AXTitle"];
if ([title length])
return [NSString stringWithFormat:@"<%@: '%@'>", role, title];
return [NSString stringWithFormat:@"<%@>", role];
}
return [valueObject description];
}
JSStringRef AccessibilityController::dumpCurrentAttributes()
{
WebHTMLView* view = [[mainFrame frameView] documentView];
id accessibilityObject = [view accessibilityFocusedUIElement];
NSArray* supportedAttributes = [accessibilityObject accessibilityAttributeNames];
Vector<UniChar> buffer;
for (NSUInteger i = 0; i < [supportedAttributes count]; ++i) {
NSString* attribute = [supportedAttributes objectAtIndex:i];
id valueObject = [accessibilityObject accessibilityAttributeValue:attribute];
NSString* value = descriptionOfValue(valueObject, accessibilityObject);
Vector<UniChar> attributeBuffer([attribute length]);
[attribute getCharacters:attributeBuffer.data()];
buffer.append(attributeBuffer);
buffer.append(':');
buffer.append(' ');
Vector<UniChar> valueBuffer([value length]);
[value getCharacters:valueBuffer.data()];
buffer.append(valueBuffer);
buffer.append('\n');
}
return JSStringCreateWithCharacters(buffer.data(), buffer.size());
}
......@@ -29,6 +29,7 @@
#import "DumpRenderTree.h"
#import "AccessibilityController.h"
#import "CheckedMalloc.h"
#import "DumpRenderTreePasteboard.h"
#import "DumpRenderTreeWindow.h"
......
......@@ -28,10 +28,12 @@
#import <Foundation/Foundation.h>
class AccessibilityController;
class GCController;
@interface FrameLoadDelegate : NSObject
{
AccessibilityController* accessibilityController;
GCController* gcController;
}
@end
......@@ -29,6 +29,7 @@
#import "DumpRenderTree.h"
#import "FrameLoadDelegate.h"
#import "AccessibilityController.h"
#import "AppleScriptController.h"
#import "EventSendingController.h"
#import "GCController.h"
......@@ -94,8 +95,10 @@
- (id)init
{
if ((self = [super init]))
if ((self = [super init])) {
gcController = new GCController;
accessibilityController = new AccessibilityController;
}
return self;
}
......@@ -243,6 +246,9 @@
gcController->makeWindowObject(context, globalObject, &exception);
ASSERT(!exception);
accessibilityController->makeWindowObject(context, globalObject, &exception);
ASSERT(!exception);
// Make Old-Style controllers
EventSendingController *esc = [[EventSendingController alloc] init];
[obj setValue:esc forKey:@"eventSender"];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment