iCuke 0.5.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/README.rdoc +8 -7
- data/Rakefile +10 -30
- data/VERSION +1 -1
- data/app/.gitignore +3 -0
- data/app/LICENSE +20 -0
- data/app/Readme.markdown +3 -0
- data/app/Shared/AppDelegate_Shared.h +17 -0
- data/app/Shared/AppDelegate_Shared.m +25 -0
- data/app/{images/yellowslide.png → Shared/Icon.png} +0 -0
- data/app/Shared/ModalViewController.h +15 -0
- data/app/Shared/ModalViewController.m +96 -0
- data/app/Shared/TestViewController_Shared.h +15 -0
- data/app/Shared/TestViewController_Shared.m +43 -0
- data/app/{Info.plist → Shared/Universal-Info.plist} +17 -4
- data/app/Shared/Universal_Prefix.pch +8 -0
- data/app/Shared/main.m +14 -0
- data/app/Universal.xcodeproj/project.pbxproj +301 -0
- data/app/iPad/AppDelegate_Pad.h +15 -0
- data/app/iPad/AppDelegate_Pad.m +28 -0
- data/app/iPad/Default-Landscape.png +0 -0
- data/app/iPad/Default-Portrait.png +0 -0
- data/app/iPad/MainWindow_Pad.xib +343 -0
- data/app/iPad/TestViewController_Pad.h +15 -0
- data/app/iPad/TestViewController_Pad.m +52 -0
- data/app/iPhone/AppDelegate_Phone.h +15 -0
- data/app/iPhone/AppDelegate_Phone.m +28 -0
- data/app/{images/segment_search.png → iPhone/Default.png} +0 -0
- data/app/iPhone/MainWindow_Phone.xib +363 -0
- data/app/iPhone/TestViewController_Phone.h +15 -0
- data/app/iPhone/TestViewController_Phone.m +36 -0
- data/bin/.gitignore +1 -0
- data/bin/icuke +10 -0
- data/bin/icuke-module +17 -0
- data/ext/.gitignore +1 -0
- data/ext/Rakefile +6 -0
- data/ext/WaxSim/Simulator.h +31 -0
- data/ext/WaxSim/Simulator.m +131 -0
- data/ext/WaxSim/WaxSim.m +110 -0
- data/ext/WaxSim/WaxSim.xcodeproj/project.pbxproj +238 -0
- data/ext/WaxSim/WaxSim_Prefix.pch +7 -0
- data/ext/WaxSim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +126 -0
- data/ext/iCuke/Rakefile +14 -17
- data/ext/iCuke/libicuke-sdk3.1.dylib +0 -0
- data/ext/iCuke/libicuke-sdk4.0.dylib +0 -0
- data/ext/iCuke/libicuke.dylib +0 -0
- data/ext/iCuke/{DefaultsResponse.h → sdk3.1/DefaultsResponse.h} +0 -0
- data/ext/iCuke/{DefaultsResponse.m → sdk3.1/DefaultsResponse.m} +0 -0
- data/ext/iCuke/{EventResponse.h → sdk3.1/EventResponse.h} +0 -0
- data/ext/iCuke/{EventResponse.m → sdk3.1/EventResponse.m} +0 -0
- data/ext/iCuke/sdk3.1/ModuleResponse.h +5 -0
- data/ext/iCuke/sdk3.1/ModuleResponse.m +76 -0
- data/ext/iCuke/sdk3.1/Rakefile +20 -0
- data/ext/iCuke/{Recorder.h → sdk3.1/Recorder.h} +0 -0
- data/ext/iCuke/{Recorder.m → sdk3.1/Recorder.m} +0 -0
- data/ext/iCuke/{RecorderResponse.h → sdk3.1/RecorderResponse.h} +0 -0
- data/ext/iCuke/{RecorderResponse.m → sdk3.1/RecorderResponse.m} +0 -0
- data/ext/iCuke/{SynthesizeSingleton.h → sdk3.1/SynthesizeSingleton.h} +0 -0
- data/ext/iCuke/{ViewResponse.h → sdk3.1/ViewResponse.h} +0 -0
- data/ext/iCuke/{ViewResponse.m → sdk3.1/ViewResponse.m} +0 -0
- data/ext/iCuke/{Viewer.h → sdk3.1/Viewer.h} +0 -0
- data/ext/iCuke/sdk3.1/Viewer.m +203 -0
- data/ext/iCuke/{iCukeHTTPResponseHandler.h → sdk3.1/iCukeHTTPResponseHandler.h} +0 -0
- data/ext/iCuke/{iCukeHTTPResponseHandler.m → sdk3.1/iCukeHTTPResponseHandler.m} +0 -0
- data/ext/iCuke/{iCukeHTTPServer.h → sdk3.1/iCukeHTTPServer.h} +0 -0
- data/ext/iCuke/{iCukeHTTPServer.m → sdk3.1/iCukeHTTPServer.m} +0 -0
- data/ext/iCuke/{iCukeServer.h → sdk3.1/iCukeServer.h} +0 -2
- data/ext/iCuke/{iCukeServer.m → sdk3.1/iCukeServer.m} +22 -20
- data/ext/iCuke/{json → sdk3.1/json}/JSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSObject+SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSObject+SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSString+SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSString+SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonBase.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonBase.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonParser.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonParser.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonWriter.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonWriter.m +0 -0
- data/ext/iCuke/sdk4.0/DefaultsResponse.h +5 -0
- data/ext/iCuke/sdk4.0/DefaultsResponse.m +66 -0
- data/ext/iCuke/sdk4.0/EventResponse.h +5 -0
- data/ext/iCuke/sdk4.0/EventResponse.m +130 -0
- data/ext/iCuke/sdk4.0/ModuleResponse.h +5 -0
- data/ext/iCuke/sdk4.0/ModuleResponse.m +76 -0
- data/ext/iCuke/sdk4.0/Rakefile +20 -0
- data/ext/iCuke/sdk4.0/Recorder.h +17 -0
- data/ext/iCuke/sdk4.0/Recorder.m +90 -0
- data/ext/iCuke/sdk4.0/RecorderResponse.h +6 -0
- data/ext/iCuke/sdk4.0/RecorderResponse.m +68 -0
- data/ext/iCuke/sdk4.0/SynthesizeSingleton.h +68 -0
- data/ext/iCuke/sdk4.0/ViewResponse.h +5 -0
- data/ext/iCuke/sdk4.0/ViewResponse.m +84 -0
- data/ext/iCuke/sdk4.0/Viewer.h +8 -0
- data/ext/iCuke/{Viewer.m → sdk4.0/Viewer.m} +14 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.h +50 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.m +381 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPServer.h +53 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPServer.m +365 -0
- data/ext/iCuke/sdk4.0/iCukeServer.h +14 -0
- data/ext/iCuke/sdk4.0/iCukeServer.m +65 -0
- data/ext/iCuke/sdk4.0/json/JSON.h +50 -0
- data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.h +68 -0
- data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.m +53 -0
- data/ext/iCuke/sdk4.0/json/NSString+SBJSON.h +58 -0
- data/ext/iCuke/sdk4.0/json/NSString+SBJSON.m +55 -0
- data/ext/iCuke/sdk4.0/json/SBJSON.h +75 -0
- data/ext/iCuke/sdk4.0/json/SBJSON.m +212 -0
- data/ext/iCuke/sdk4.0/json/SBJsonBase.h +86 -0
- data/ext/iCuke/sdk4.0/json/SBJsonBase.m +78 -0
- data/ext/iCuke/sdk4.0/json/SBJsonParser.h +87 -0
- data/ext/iCuke/sdk4.0/json/SBJsonParser.m +475 -0
- data/ext/iCuke/sdk4.0/json/SBJsonWriter.h +129 -0
- data/ext/iCuke/sdk4.0/json/SBJsonWriter.m +228 -0
- data/features/iphone.feature +15 -0
- data/features/support/env.rb +1 -1
- data/iCuke.gemspec +118 -114
- data/lib/icuke/cucumber.rb +93 -64
- data/lib/icuke/screen.rb +110 -0
- data/lib/icuke/sdk.rb +134 -0
- data/lib/icuke/simulate.rb +9 -5
- data/lib/icuke/simulator.rb +10 -11
- data/lib/icuke/waxsim.rb +36 -0
- data/lib/icuke.rb +2 -1
- metadata +124 -129
- data/app/AlertsViewController.h +0 -59
- data/app/AlertsViewController.m +0 -341
- data/app/AppDelegate.h +0 -60
- data/app/AppDelegate.m +0 -101
- data/app/ButtonsViewController.h +0 -80
- data/app/ButtonsViewController.m +0 -448
- data/app/Constants.h +0 -58
- data/app/ControlsViewController.h +0 -72
- data/app/ControlsViewController.m +0 -379
- data/app/ImagesViewController.h +0 -62
- data/app/ImagesViewController.m +0 -137
- data/app/MainViewController.h +0 -57
- data/app/MainViewController.m +0 -262
- data/app/Picker/CustomPickerDataSource.h +0 -55
- data/app/Picker/CustomPickerDataSource.m +0 -135
- data/app/Picker/CustomView.h +0 -62
- data/app/Picker/CustomView.m +0 -119
- data/app/PickerViewController.h +0 -88
- data/app/PickerViewController.m +0 -402
- data/app/Prefix.pch +0 -5
- data/app/ReadMe.txt +0 -82
- data/app/SearchBarController.h +0 -58
- data/app/SearchBarController.m +0 -105
- data/app/SegmentViewController.h +0 -54
- data/app/SegmentViewController.m +0 -195
- data/app/TextFieldController.h +0 -67
- data/app/TextFieldController.m +0 -342
- data/app/TextViewController.h +0 -57
- data/app/TextViewController.m +0 -164
- data/app/ToolbarViewController.h +0 -74
- data/app/ToolbarViewController.m +0 -303
- data/app/TransitionViewController.h +0 -64
- data/app/TransitionViewController.m +0 -178
- data/app/UICatalog.xcodeproj/project.pbxproj +0 -615
- data/app/WebViewController.h +0 -57
- data/app/WebViewController.m +0 -173
- data/app/en.lproj/AlertsViewController.xib +0 -144
- data/app/en.lproj/ButtonsViewController.xib +0 -147
- data/app/en.lproj/ControlsViewController.xib +0 -147
- data/app/en.lproj/ImagesViewController.xib +0 -264
- data/app/en.lproj/Localizable.strings +0 -41
- data/app/en.lproj/MainWindow.xib +0 -306
- data/app/en.lproj/PickerViewController.xib +0 -415
- data/app/en.lproj/SearchBarController.xib +0 -142
- data/app/en.lproj/SegmentViewController.xib +0 -143
- data/app/en.lproj/TextFieldController.xib +0 -167
- data/app/en.lproj/TextViewController.xib +0 -149
- data/app/en.lproj/ToolbarViewController.xib +0 -491
- data/app/en.lproj/TransitionViewController.xib +0 -255
- data/app/en.lproj/WebViewController.xib +0 -141
- data/app/images/12-6AM.png +0 -0
- data/app/images/12-6PM.png +0 -0
- data/app/images/6-12AM.png +0 -0
- data/app/images/6-12PM.png +0 -0
- data/app/images/Default.png +0 -0
- data/app/images/Icon.png +0 -0
- data/app/images/UIButton_custom.png +0 -0
- data/app/images/blueButton.png +0 -0
- data/app/images/orangeslide.png +0 -0
- data/app/images/scene1.jpg +0 -0
- data/app/images/scene2.jpg +0 -0
- data/app/images/scene3.jpg +0 -0
- data/app/images/scene4.jpg +0 -0
- data/app/images/scene5.jpg +0 -0
- data/app/images/segment_check.png +0 -0
- data/app/images/segment_tools.png +0 -0
- data/app/images/slider_ball.png +0 -0
- data/app/images/whiteButton.png +0 -0
- data/app/main.m +0 -58
- data/features/uicatalog.feature +0 -20
- data/lib/icuke/com.apple.Accessibility.plist +0 -0
- data/lib/icuke/headless.rb +0 -54
- data/lib/icuke/xcode.rb +0 -164
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
#import "Recorder.h"
|
|
4
|
+
#import "Viewer.h"
|
|
5
|
+
|
|
6
|
+
@interface UIApplication (Recording)
|
|
7
|
+
|
|
8
|
+
-(void)_addRecorder:(id)recorder;
|
|
9
|
+
-(void)_removeRecorder:(id)recorder;
|
|
10
|
+
-(void)_playbackEvents:(NSArray*)events atPlaybackRate:(float)playbackRate messageWhenDone:(id)target withSelector:(SEL)selector;
|
|
11
|
+
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
static Recorder *sharedRecorder = nil;
|
|
15
|
+
|
|
16
|
+
@implementation Recorder
|
|
17
|
+
|
|
18
|
+
+(Recorder *)sharedRecorder {
|
|
19
|
+
if (sharedRecorder == nil) {
|
|
20
|
+
sharedRecorder = [[super allocWithZone:NULL] init];
|
|
21
|
+
}
|
|
22
|
+
return sharedRecorder;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
-(id)init {
|
|
26
|
+
self = [super init];
|
|
27
|
+
|
|
28
|
+
eventList = [[NSMutableArray alloc] init];
|
|
29
|
+
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
-(void)dealloc {
|
|
34
|
+
[eventList release];
|
|
35
|
+
[super dealloc];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
-(void)record {
|
|
39
|
+
[eventList removeAllObjects];
|
|
40
|
+
|
|
41
|
+
NSLog(@"Starting recording");
|
|
42
|
+
|
|
43
|
+
[[UIApplication sharedApplication] _addRecorder: self];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
-(void)saveToFile:(NSString*)path {
|
|
47
|
+
NSLog(@"Saving events to file: %@", path);
|
|
48
|
+
|
|
49
|
+
[eventList writeToFile: path atomically: YES];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
-(void)stop {
|
|
53
|
+
NSLog(@"Stopping recording");
|
|
54
|
+
|
|
55
|
+
[[UIApplication sharedApplication] _removeRecorder: self];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
-(void)recordApplicationEvent:(NSDictionary*)event {
|
|
59
|
+
NSLog(@"Recorded event: %@", event);
|
|
60
|
+
|
|
61
|
+
[eventList addObject:event];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
-(void)load:(NSArray*)events {
|
|
65
|
+
NSLog(@"Loading events");
|
|
66
|
+
|
|
67
|
+
[eventList setArray: events];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
-(void)loadFromFile:(NSString*)path {
|
|
71
|
+
NSLog(@"Loading events from file: %@", path);
|
|
72
|
+
|
|
73
|
+
[eventList setArray: [NSMutableArray arrayWithContentsOfFile: path]];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
-(void)playbackWithDelegate: (id)delegate doneSelector:(SEL)doneSelector {
|
|
77
|
+
NSLog(@"Playback");
|
|
78
|
+
|
|
79
|
+
playbackDelegate = delegate;
|
|
80
|
+
playbackDoneSelector = doneSelector;
|
|
81
|
+
|
|
82
|
+
[[UIApplication sharedApplication] _playbackEvents: eventList atPlaybackRate: 1.0f messageWhenDone: self withSelector: @selector(playbackDone:)];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
-(void)playbackDone:(NSDictionary *)details {
|
|
86
|
+
NSLog(@"Playback complete");
|
|
87
|
+
[playbackDelegate performSelector: playbackDoneSelector];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#import "RecorderResponse.h"
|
|
2
|
+
#import "iCukeHTTPServer.h"
|
|
3
|
+
#import "Recorder.h"
|
|
4
|
+
|
|
5
|
+
@implementation RecorderResponse
|
|
6
|
+
+ (void)load
|
|
7
|
+
{
|
|
8
|
+
[iCukeHTTPResponseHandler registerHandler:self];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
+ (BOOL)canHandleRequest:(CFHTTPMessageRef)aRequest
|
|
12
|
+
method:(NSString *)requestMethod
|
|
13
|
+
url:(NSURL *)requestURL
|
|
14
|
+
headerFields:(NSDictionary *)requestHeaderFields
|
|
15
|
+
{
|
|
16
|
+
if ([requestURL.path isEqualToString:@"/record"] ||
|
|
17
|
+
[requestURL.path isEqualToString:@"/play"] ||
|
|
18
|
+
[requestURL.path isEqualToString:@"/load"] ||
|
|
19
|
+
[requestURL.path isEqualToString:@"/save"] ||
|
|
20
|
+
[requestURL.path isEqualToString:@"/stop"])
|
|
21
|
+
return YES;
|
|
22
|
+
|
|
23
|
+
return NO;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)startResponse
|
|
27
|
+
{
|
|
28
|
+
if ([url.path isEqualToString:@"/record"]) {
|
|
29
|
+
[[Recorder sharedRecorder] record];
|
|
30
|
+
[self finishResponse];
|
|
31
|
+
} else if ([url.path isEqualToString:@"/play"]) {
|
|
32
|
+
[[Recorder sharedRecorder] playbackWithDelegate: self doneSelector: @selector(finishResponse)];
|
|
33
|
+
} else if ([url.path isEqualToString:@"/load"]) {
|
|
34
|
+
[[Recorder sharedRecorder] loadFromFile: [[url query] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
|
35
|
+
[self finishResponse];
|
|
36
|
+
} else if ([url.path isEqualToString:@"/save"]) {
|
|
37
|
+
[[Recorder sharedRecorder] saveToFile: [[url query] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
|
38
|
+
[self finishResponse];
|
|
39
|
+
} else if ([url.path isEqualToString:@"/stop"]) {
|
|
40
|
+
[[Recorder sharedRecorder] stop];
|
|
41
|
+
[self finishResponse];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)finishResponse
|
|
47
|
+
{
|
|
48
|
+
CFHTTPMessageRef response = CFHTTPMessageCreateResponse(kCFAllocatorDefault, 200, NULL, kCFHTTPVersion1_1);
|
|
49
|
+
CFHTTPMessageSetHeaderFieldValue(response, (CFStringRef)@"Connection", (CFStringRef)@"close");
|
|
50
|
+
CFDataRef headerData = CFHTTPMessageCopySerializedMessage(response);
|
|
51
|
+
|
|
52
|
+
@try
|
|
53
|
+
{
|
|
54
|
+
[fileHandle writeData:(NSData *)headerData];
|
|
55
|
+
}
|
|
56
|
+
@catch (NSException *exception)
|
|
57
|
+
{
|
|
58
|
+
// Ignore the exception, it normally just means the client
|
|
59
|
+
// closed the connection from the other end.
|
|
60
|
+
}
|
|
61
|
+
@finally
|
|
62
|
+
{
|
|
63
|
+
CFRelease(headerData);
|
|
64
|
+
[server closeHandler:self];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SynthesizeSingleton.h
|
|
3
|
+
// iTrackSportsBets
|
|
4
|
+
//
|
|
5
|
+
// Created by Matt Gallagher on 20/10/08.
|
|
6
|
+
// Copyright 2008 Matt Gallagher. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
// Permission is given to use this source code file, free of charge, in any
|
|
9
|
+
// project, commercial or otherwise, entirely at your risk, with the condition
|
|
10
|
+
// that any redistribution (in part or whole) of source code must retain
|
|
11
|
+
// this copyright and permission notice. Attribution in compiled projects is
|
|
12
|
+
// appreciated but not required.
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
#define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \
|
|
16
|
+
\
|
|
17
|
+
static classname *shared##classname = nil; \
|
|
18
|
+
\
|
|
19
|
+
+ (classname *)shared##classname \
|
|
20
|
+
{ \
|
|
21
|
+
@synchronized(self) \
|
|
22
|
+
{ \
|
|
23
|
+
if (shared##classname == nil) \
|
|
24
|
+
{ \
|
|
25
|
+
shared##classname = [[self alloc] init]; \
|
|
26
|
+
} \
|
|
27
|
+
} \
|
|
28
|
+
\
|
|
29
|
+
return shared##classname; \
|
|
30
|
+
} \
|
|
31
|
+
\
|
|
32
|
+
+ (id)allocWithZone:(NSZone *)zone \
|
|
33
|
+
{ \
|
|
34
|
+
@synchronized(self) \
|
|
35
|
+
{ \
|
|
36
|
+
if (shared##classname == nil) \
|
|
37
|
+
{ \
|
|
38
|
+
shared##classname = [super allocWithZone:zone]; \
|
|
39
|
+
return shared##classname; \
|
|
40
|
+
} \
|
|
41
|
+
} \
|
|
42
|
+
\
|
|
43
|
+
return nil; \
|
|
44
|
+
} \
|
|
45
|
+
\
|
|
46
|
+
- (id)copyWithZone:(NSZone *)zone \
|
|
47
|
+
{ \
|
|
48
|
+
return self; \
|
|
49
|
+
} \
|
|
50
|
+
\
|
|
51
|
+
- (id)retain \
|
|
52
|
+
{ \
|
|
53
|
+
return self; \
|
|
54
|
+
} \
|
|
55
|
+
\
|
|
56
|
+
- (NSUInteger)retainCount \
|
|
57
|
+
{ \
|
|
58
|
+
return NSUIntegerMax; \
|
|
59
|
+
} \
|
|
60
|
+
\
|
|
61
|
+
- (void)release \
|
|
62
|
+
{ \
|
|
63
|
+
} \
|
|
64
|
+
\
|
|
65
|
+
- (id)autorelease \
|
|
66
|
+
{ \
|
|
67
|
+
return self; \
|
|
68
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#import "ViewResponse.h"
|
|
2
|
+
#import "iCukeHTTPServer.h"
|
|
3
|
+
#import "Viewer.h"
|
|
4
|
+
|
|
5
|
+
// AX API
|
|
6
|
+
extern Boolean AXAPIEnabled(void);
|
|
7
|
+
|
|
8
|
+
@implementation ViewResponse
|
|
9
|
+
+ (void)load
|
|
10
|
+
{
|
|
11
|
+
[iCukeHTTPResponseHandler registerHandler:self];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
+ (BOOL)canHandleRequest:(CFHTTPMessageRef)aRequest
|
|
15
|
+
method:(NSString *)requestMethod
|
|
16
|
+
url:(NSURL *)requestURL
|
|
17
|
+
headerFields:(NSDictionary *)requestHeaderFields
|
|
18
|
+
{
|
|
19
|
+
return [requestURL.path isEqualToString:@"/view"];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
- (void)startResponse
|
|
23
|
+
{
|
|
24
|
+
if (!AXAPIEnabled()) {
|
|
25
|
+
CFHTTPMessageRef response =
|
|
26
|
+
CFHTTPMessageCreateResponse(
|
|
27
|
+
kCFAllocatorDefault, 500, NULL, kCFHTTPVersion1_1);
|
|
28
|
+
CFHTTPMessageSetHeaderFieldValue(
|
|
29
|
+
response, (CFStringRef)@"Content-Type", (CFStringRef)@"text/plain");
|
|
30
|
+
CFHTTPMessageSetHeaderFieldValue(
|
|
31
|
+
response, (CFStringRef)@"Connection", (CFStringRef)@"close");
|
|
32
|
+
CFHTTPMessageSetBody(
|
|
33
|
+
response,
|
|
34
|
+
(CFDataRef)[[NSString stringWithFormat:
|
|
35
|
+
@"Accessiblity Inspector Disabled: "
|
|
36
|
+
@"Please enable the accessibilty inspector in the simulator and retry"]
|
|
37
|
+
dataUsingEncoding:NSUTF8StringEncoding]);
|
|
38
|
+
CFDataRef headerData = CFHTTPMessageCopySerializedMessage(response);
|
|
39
|
+
@try
|
|
40
|
+
{
|
|
41
|
+
[fileHandle writeData:(NSData *)headerData];
|
|
42
|
+
}
|
|
43
|
+
@catch (NSException *exception)
|
|
44
|
+
{
|
|
45
|
+
// Ignore the exception, it normally just means the client
|
|
46
|
+
// closed the connection from the other end.
|
|
47
|
+
}
|
|
48
|
+
@finally
|
|
49
|
+
{
|
|
50
|
+
CFRelease(headerData);
|
|
51
|
+
CFRelease(response);
|
|
52
|
+
[server closeHandler:self];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
CFHTTPMessageRef response = CFHTTPMessageCreateResponse(kCFAllocatorDefault, 200, NULL, kCFHTTPVersion1_1);
|
|
59
|
+
CFHTTPMessageSetHeaderFieldValue(response, (CFStringRef)@"Content-Type", (CFStringRef)@"text/xml");
|
|
60
|
+
CFHTTPMessageSetHeaderFieldValue(response, (CFStringRef)@"Connection", (CFStringRef)@"close");
|
|
61
|
+
|
|
62
|
+
NSData *viewData = [[[Viewer sharedViewer] screen] dataUsingEncoding:NSUTF8StringEncoding];
|
|
63
|
+
|
|
64
|
+
CFHTTPMessageSetHeaderFieldValue(response, (CFStringRef)@"Content-Length",
|
|
65
|
+
(CFStringRef)[NSString stringWithFormat:@"%ld", [viewData length]]);
|
|
66
|
+
CFDataRef headerData = CFHTTPMessageCopySerializedMessage(response);
|
|
67
|
+
|
|
68
|
+
@try
|
|
69
|
+
{
|
|
70
|
+
[fileHandle writeData:(NSData *)headerData];
|
|
71
|
+
[fileHandle writeData:viewData];
|
|
72
|
+
}
|
|
73
|
+
@catch (NSException *exception)
|
|
74
|
+
{
|
|
75
|
+
// Ignore the exception, it normally just means the client
|
|
76
|
+
// closed the connection from the other end.
|
|
77
|
+
}
|
|
78
|
+
@finally
|
|
79
|
+
{
|
|
80
|
+
CFRelease(headerData);
|
|
81
|
+
[server closeHandler:self];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
@end
|
|
@@ -115,6 +115,17 @@ static Viewer *sharedViewer = nil;
|
|
|
115
115
|
|
|
116
116
|
@end
|
|
117
117
|
|
|
118
|
+
@implementation UITableView (AccessibilityVisibilityFix)
|
|
119
|
+
|
|
120
|
+
-(void)appendChildrenToXml:(NSMutableString *)xml {
|
|
121
|
+
// Ignore the accessibility interface here because it doesn't allow us a way to tell if a cell is visible.
|
|
122
|
+
for (UIView *view in [self visibleCells]) {
|
|
123
|
+
[view appendToXml: xml];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@end
|
|
128
|
+
|
|
118
129
|
@interface UIView (Viewer)
|
|
119
130
|
|
|
120
131
|
-(void)appendToXml:(NSMutableString *)xml;
|
|
@@ -151,6 +162,9 @@ static Viewer *sharedViewer = nil;
|
|
|
151
162
|
|
|
152
163
|
-(NSString *)screen {
|
|
153
164
|
NSMutableString *xml = [NSMutableString stringWithString: @"<screen>"];
|
|
165
|
+
CGRect frame = [[UIScreen mainScreen] applicationFrame];
|
|
166
|
+
[xml appendFormat: @"<frame x=\"%f\" y=\"%f\" width=\"%f\" height=\"%f\"/>",
|
|
167
|
+
frame.origin.x, frame.origin.y, frame.size.width, frame.size.height];
|
|
154
168
|
|
|
155
169
|
for (UIWindow *window in [UIApplication sharedApplication].windows) {
|
|
156
170
|
[window appendToXml: xml];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HTTPResponseHandler.h
|
|
3
|
+
// TextTransfer
|
|
4
|
+
//
|
|
5
|
+
// Created by Matt Gallagher on 2009/07/13.
|
|
6
|
+
// Copyright 2009 Matt Gallagher. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
// Permission is given to use this source code file, free of charge, in any
|
|
9
|
+
// project, commercial or otherwise, entirely at your risk, with the condition
|
|
10
|
+
// that any redistribution (in part or whole) of source code must retain
|
|
11
|
+
// this copyright and permission notice. Attribution in compiled projects is
|
|
12
|
+
// appreciated but not required.
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
#if TARGET_OS_IPHONE
|
|
16
|
+
#import <UIKit/UIKit.h>
|
|
17
|
+
#import <CFNetwork/CFNetwork.h>
|
|
18
|
+
#else
|
|
19
|
+
#import <Cocoa/Cocoa.h>
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
@class iCukeHTTPServer;
|
|
23
|
+
|
|
24
|
+
@interface iCukeHTTPResponseHandler : NSObject
|
|
25
|
+
{
|
|
26
|
+
CFHTTPMessageRef request;
|
|
27
|
+
NSString *requestMethod;
|
|
28
|
+
NSDictionary *headerFields;
|
|
29
|
+
NSFileHandle *fileHandle;
|
|
30
|
+
iCukeHTTPServer *server;
|
|
31
|
+
NSURL *url;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (NSUInteger)priority;
|
|
35
|
+
+ (void)registerHandler:(Class)handlerClass;
|
|
36
|
+
|
|
37
|
+
+ (iCukeHTTPResponseHandler *)handlerForRequest:(CFHTTPMessageRef)aRequest
|
|
38
|
+
fileHandle:(NSFileHandle *)requestFileHandle
|
|
39
|
+
server:(iCukeHTTPServer *)aServer;
|
|
40
|
+
|
|
41
|
+
- (id)initWithRequest:(CFHTTPMessageRef)aRequest
|
|
42
|
+
method:(NSString *)method
|
|
43
|
+
url:(NSURL *)requestURL
|
|
44
|
+
headerFields:(NSDictionary *)requestHeaderFields
|
|
45
|
+
fileHandle:(NSFileHandle *)requestFileHandle
|
|
46
|
+
server:(iCukeHTTPServer *)aServer;
|
|
47
|
+
- (void)startResponse;
|
|
48
|
+
- (void)endResponse;
|
|
49
|
+
|
|
50
|
+
@end
|