CPURLConnectionAsyncTest manual test.

This commit is contained in:
cacaodev committed 2015-10-07 18:04:28 +02:00
1 parent e8da7baee2
commit 13e1be1f74
10 files changed
+653

No files matched your search

@@ -0,0 +1,212 @@
/*
* AppController.j
* CPURLConnectionAsyncTest
*
* Created by You on February 1, 2012.
* Copyright 2012, Your Company All rights reserved.
This test needs to be at the root of your Web Server (http://localhost/CPURLConnectionAsyncTest/) and with php enabled.
For each test, we start 3 async connections and we setup the resulting operations to be dependant one from each other. The connection received after the smallest delay is dependant on a connection received with a longer delay.
We test that dedendant operations are perfomed before their dependencies.
We also test that in the completionHandler(response, data, error), the data and error params are mututally exclusive.*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
CPLogRegister(CPLogConsole);
@implementation AppController : CPObject
{
@outlet CPTextField testField;
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
CPOperationQueue queue;
CPArray results;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (CPURLConnection)startAsyncConnection:(CPInteger)idx responseStatus:(CPInteger)aStatus delay:(CPInteger)aDelay isLast:(BOOL)isLast
{
var resourcePath = [[CPBundle mainBundle] resourcePath],
url = [CPURL URLWithString:[CPString stringWithFormat:@"%@delayed.php?sleep=%@&status=%@", resourcePath, aDelay, aStatus]];
var request = [CPURLRequest requestWithURL:url];
return [self startAsyncConnection:idx request:request isLast:isLast];
}
- (CPURLConnection)startAsyncConnection:(CPInteger)idx request:(CPURLRequest)request isLast:(BOOL)isLast
{
var connection = [CPURLConnection sendAsynchronousRequest:request queue:queue completionHandler:function (response, data, error)
{
var status;
if (error == nil)
error = [CPNull null];
if (data == nil)
data = [CPNull null];
if (response == nil)
status = -1;
else
status = [response statusCode];
CPLog.debug([request URL] + "\nRESPONSE:" + response + "\nDATA:" + data + "\nERROR:" + [error description]);
[results addObject:@{"conn_id":idx, "data":data, "status":status, "error":error}];
// We received all the responses to the connections we launched (3).
if ([results count] == 3)
{
var test = [self testResults];
[testField setStringValue:((test) ? "Test passed" : @"Test failed")];
}
}];
return connection;
}
- (BOOL)testResults
{
if ([results count] !== 3)
return NO;
// In theses tests, we send connections 1,2,3 and we expect the operations to be performed in reverse order: 3,2,1 because of the dependencies we set up.
if (![[results valueForKey:@"conn_id"] isEqualToArray:@[3,2,1]])
return NO;
var nul = [CPNull null];
for (var i = 0; i < [results count]; i++)
{
var res = [results objectAtIndex:i],
noData = [res objectForKey:@"data"] == nul,
noError = [res objectForKey:@"error"] == nul;
if (noData == noError)
return NO;
}
return YES;
}
- (IBAction)test1:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 responseStatus:200 delay:2 isLast:NO];
var connection3 = [self startAsyncConnection:3 responseStatus:200 delay:3 isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test2:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 responseStatus:404 delay:2 isLast:NO];
var connection3 = [self startAsyncConnection:3 responseStatus:200 delay:3 isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test3:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 responseStatus:200 delay:2 isLast:NO];
var connection3 = [self startAsyncConnection:3 responseStatus:404 delay:3 isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test4:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 responseStatus:403 delay:2 isLast:NO];
var connection3 = [self startAsyncConnection:3 responseStatus:404 delay:3 isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test5:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:404 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 responseStatus:1000 delay:2 isLast:NO];
var connection3 = [self startAsyncConnection:3 responseStatus:404 delay:3 isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test6:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
var request = [CPURLRequest requestWithURL:"dummy"];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 request:request isLast:NO];
var connection3 = [self startAsyncConnection:3 request:request isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (IBAction)test7:(id)sender
{
results = @[];
queue = [[CPOperationQueue alloc] init];
var resourcePath = [[CPBundle mainBundle] resourcePath],
url = [CPURL URLWithString:[CPString stringWithFormat:@"%@delayed.php?sleep=%@&status=%@", resourcePath, 10, 200]];
var timeoutrequest = [CPURLRequest requestWithURL:url cachePolicy:CPURLRequestUseProtocolCachePolicy timeoutInterval:3];
var nourl = [CPURLRequest requestWithURL:@"nourl"];
[testField setStringValue:@"Waiting for response ..."];
var connection1 = [self startAsyncConnection:1 responseStatus:200 delay:1 isLast:YES];
var connection2 = [self startAsyncConnection:2 request:nourl isLast:NO];
var connection3 = [self startAsyncConnection:3 request:timeoutrequest isLast:NO];
[[connection1 operation] addDependency:[connection2 operation]];
[[connection2 operation] addDependency:[connection3 operation]];
}
- (void)awakeFromCib
{
// This is called when the cib is done loading.
// You can implement this method on any object instantiated from a Cib.
// It's a useful hook for setting up current UI values, and other things.
// In this case, we want the window from Cib to become our full browser window
[theWindow setFullPlatformWindow:YES];
}
@end
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPURLConnectionAsyncTest</string>
</dict>
</plist>
@@ -0,0 +1,94 @@
/*
* Jakefile
* CPURLConnectionAsyncTest
*
* Created by You on February 1, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CPURLConnectionAsyncTest", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPURLConnectionAsyncTest.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPURLConnectionAsyncTest");
task.setIdentifier("com.yourcompany.CPURLConnectionAsyncTest");
task.setVersion("1.0");
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPURLConnectionAsyncTest");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CPURLConnectionAsyncTest"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CPURLConnectionAsyncTest", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPURLConnectionAsyncTest", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPURLConnectionAsyncTest"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPURLConnectionAsyncTest"), FILE.join("Build", "Deployment", "CPURLConnectionAsyncTest")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPURLConnectionAsyncTest"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPURLConnectionAsyncTest"), FILE.join("Build", "Desktop", "CPURLConnectionAsyncTest", "CPURLConnectionAsyncTest.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPURLConnectionAsyncTest", "CPURLConnectionAsyncTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPURLConnectionAsyncTest"));
print("----------------------------");
}
@@ -0,0 +1 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;25E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;41E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;42E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;43E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;44E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;41E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;37E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;45E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;41E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;28E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;46E;E;D;K;10;$classnameS;21;CPCibControlConnectorK;8;$classesA;S;21;CPCibControlConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;32E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;47E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;33E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;48E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;34E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;49E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;35E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;50E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;38E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;51E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;39E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;52E;E;D;K;6;$classD;K;6;CP$UIDd;2;18E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;40E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;53E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;42E;E;D;K;10;$classnameS;20;_CPCibWindowTemplateK;8;$classesA;S;20;_CPCibWindowTemplateS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;27E;K;30;_CPCibWindowTemplateMaxSizeKeyD;K;6;CP$UIDd;2;54E;K;32;_CPCibWindowTemplateViewClassKeyD;K;6;CLine truncated
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1050" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="450" id="451"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="934" height="466"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="372">
<rect key="frame" x="0.0" y="0.0" width="934" height="466"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" id="463">
<rect key="frame" x="17" y="418" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 1" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="464">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test1:" target="450" id="476"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="465">
<rect key="frame" x="17" y="385" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 2" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="466">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test2:" target="450" id="477"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="467">
<rect key="frame" x="17" y="352" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 3" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="468">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test3:" target="450" id="478"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="469">
<rect key="frame" x="17" y="319" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 4" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="470">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test4:" target="450" id="479"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="471">
<rect key="frame" x="134" y="427" width="312" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="472">
<font key="font" size="13" name=".HelveticaNeueDeskInterface-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" id="473">
<rect key="frame" x="17" y="286" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 5" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="474">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test5:" target="450" id="480"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="481">
<rect key="frame" x="17" y="253" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 6" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="482">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test6:" target="450" id="484"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="KwH-Ah-BVw">
<rect key="frame" x="17" y="221" width="77" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test 7" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="I77-Tv-gg9">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="test7:" target="450" id="cAo-pW-veR"/>
</connections>
</button>
</subviews>
</view>
<point key="canvasLocation" x="502" y="325"/>
</window>
<customObject id="450" customClass="AppController">
<connections>
<outlet property="testField" destination="471" id="475"/>
<outlet property="theWindow" destination="371" id="459"/>
</connections>
</customObject>
</objects>
</document>
@@ -0,0 +1,17 @@
<?php
date_default_timezone_set('UTC');
// current time
$in = date("H:i:s:e", time());
$code = $_GET["status"];
http_response_code($code);
$sleep = $_GET["sleep"];
sleep($sleep);
$out = date("H:i:s:e", time());
echo json_encode(array($in,$out));
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,103 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
CPURLConnectionAsyncTest
Created by You on February 1, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CPURLConnectionAsyncTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CPURLConnectionAsyncTest...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,77 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
CPURLConnectionAsyncTest
Created by You on February 1, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CPURLConnectionAsyncTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CPURLConnectionAsyncTest...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,18 @@
/*
* AppController.j
* CPURLConnectionAsyncTest
*
* Created by You on February 1, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}