Title: [98409] trunk/Tools
- Revision
- 98409
- Author
- wei...@apple.com
- Date
- 2011-10-25 16:19:00 -0700 (Tue, 25 Oct 2011)
Log Message
Add WKBrowsingContextLoadDelegateTest test for a failed load
https://bugs.webkit.org/show_bug.cgi?id=70859
Reviewed by Anders Carlsson.
* TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm:
(TEST_F): Add TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadFail).
(-[SimpleLoadFailDelegate browsingContextControllerDidFailProvisionalLoad:withError:]):
Test that we are getting the correct NSError code and domain.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (98408 => 98409)
--- trunk/Tools/ChangeLog 2011-10-25 23:17:59 UTC (rev 98408)
+++ trunk/Tools/ChangeLog 2011-10-25 23:19:00 UTC (rev 98409)
@@ -1,3 +1,16 @@
+2011-10-25 Sam Weinig <s...@webkit.org>
+
+ Add WKBrowsingContextLoadDelegateTest test for a failed load
+ https://bugs.webkit.org/show_bug.cgi?id=70859
+
+ Reviewed by Anders Carlsson.
+
+ * TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm:
+ (TEST_F): Add TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadFail).
+
+ (-[SimpleLoadFailDelegate browsingContextControllerDidFailProvisionalLoad:withError:]):
+ Test that we are getting the correct NSError code and domain.
+
2011-10-25 Erik Arvidsson <a...@chromium.org>
JS Test Harness: Make successfullyParsed optional
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm (98408 => 98409)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm 2011-10-25 23:17:59 UTC (rev 98408)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm 2011-10-25 23:19:00 UTC (rev 98409)
@@ -63,6 +63,7 @@
}
};
+
static bool simpleLoadDone;
@interface SimpleLoadDelegate : NSObject <WKBrowsingContextLoadDelegate>
@@ -85,17 +86,53 @@
TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoad)
{
// Add the load delegate.
- SimpleLoadDelegate *simpleLoadDelegate = [[SimpleLoadDelegate alloc] init];
- view.browsingContextController.loadDelegate = simpleLoadDelegate;
+ SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] init];
+ view.browsingContextController.loadDelegate = loadDelegate;
// Load the file.
NSURL *nsURL = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html"];
[view.browsingContextController loadFileURL:nsURL restrictToFilesWithin:nil];
- // Wait for the load.
+ // Wait for the load to finish.
TestWebKitAPI::Util::run(&simpleLoadDone);
// Tear down the delegate.
view.browsingContextController.loadDelegate = nil;
- [simpleLoadDelegate release];
+ [loadDelegate release];
}
+
+
+static bool simpleLoadFailDone;
+
+@interface SimpleLoadFailDelegate : NSObject <WKBrowsingContextLoadDelegate>
+@end
+
+@implementation SimpleLoadFailDelegate
+
+- (void)browsingContextControllerDidFailProvisionalLoad:(WKBrowsingContextController *)sender withError:(NSError *)error
+{
+ EXPECT_EQ(-1100, error.code);
+ EXPECT_WK_STREQ(NSURLErrorDomain, error.domain);
+
+ simpleLoadFailDone = true;
+}
+
+@end
+
+TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadFail)
+{
+ // Add the load delegate.
+ SimpleLoadFailDelegate *loadDelegate = [[SimpleLoadFailDelegate alloc] init];
+ view.browsingContextController.loadDelegate = loadDelegate;
+
+ // Load a non-existent file.
+ NSURL *nsURL = [NSURL URLWithString:@"file:///does-not-exist.html"];
+ [view.browsingContextController loadFileURL:nsURL restrictToFilesWithin:nil];
+
+ // Wait for the load to fail.
+ TestWebKitAPI::Util::run(&simpleLoadFailDone);
+
+ // Tear down the delegate.
+ view.browsingContextController.loadDelegate = nil;
+ [loadDelegate release];
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes