cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/21] ios commit: CordovaLib Unit Tests: added test for CB-3394
Date Fri, 17 May 2013 01:52:08 GMT
CordovaLib Unit Tests: added test for CB-3394


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6bbdd789
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6bbdd789
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6bbdd789

Branch: refs/heads/3.0.0
Commit: 6bbdd78910657d45ddb560adf24003c7910ad0f2
Parents: f108c40
Author: Shazron Abdullah <shazron@apache.org>
Authored: Thu May 16 09:51:34 2013 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Thu May 16 09:51:34 2013 -0700

----------------------------------------------------------------------
 CordovaLibTests/CDVWhitelistTests.m |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6bbdd789/CordovaLibTests/CDVWhitelistTests.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVWhitelistTests.m b/CordovaLibTests/CDVWhitelistTests.m
index 21576a3..b809972 100644
--- a/CordovaLibTests/CDVWhitelistTests.m
+++ b/CordovaLibTests/CDVWhitelistTests.m
@@ -290,4 +290,22 @@
     STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.google.com"]],
nil);
 }
 
+- (void)testWildcardPlusOtherUrls
+{
+    // test for https://issues.apache.org/jira/browse/CB-3394
+
+    NSArray* allowedHosts = [NSArray arrayWithObjects:
+        @"*",
+        @"cordova.apache.org",
+        nil];
+
+    CDVWhitelist* whitelist = [[CDVWhitelist alloc] initWithArray:allowedHosts];
+
+    STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://*.apache.org"]], nil);
+    STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://www.google.com"]],
nil);
+    STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"ftp://cordova.apache.org"]],
nil);
+    STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://cordova.apache.org"]],
nil);
+    STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://cordova.apache.org"]],
nil);
+}
+
 @end


Mime
View raw message