Permalink
Browse files

Handle change in error message on iOS 5

  • Loading branch information...
1 parent 033ce99 commit 65ea7d1d684d6b9cb731bf65cd53b6ce5357e988 @newyankeecodeshop committed Nov 19, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 Tests/TScriptObject.m
View
9 Tests/TScriptObject.m
@@ -247,7 +247,14 @@ - (void)testThrowException
NSError* error = result;
GHAssertTrue([[error domain] isEqualToString:@"GAJavaScriptException"], @"Wrong domain! %@", [error domain]);
- GHAssertTrue([[error localizedDescription] hasPrefix:@"Result of expression 'window.fake'"], @"Missing error message");
+
+ // The error message text changed on iOS 5, so we test for it by checking for the new UIWebView method.
+ //
+ if ([_engine.webView respondsToSelector:@selector(mediaPlaybackAllowsAirPlay)])
+ GHAssertTrue([[error localizedDescription] hasPrefix:@"'undefined' is not an object"], @"Missing error message");
+ else
+ GHAssertTrue([[error localizedDescription] hasPrefix:@"Result of expression 'window.fake'"], @"Missing error message");
+
}
@end

0 comments on commit 65ea7d1

Please sign in to comment.