forked from mirrors/linphone-iphone
LinphoneUITester: add some call tests and fix crash when entering invalid caracters in address field
This commit is contained in:
parent
3d858f0a0c
commit
5dfc4d2d13
14 changed files with 230 additions and 123 deletions
|
|
@ -47,7 +47,7 @@
|
|||
<rect key="frame" x="5" y="0.0" width="310" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Enter a address"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Enter an address"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress"/>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="700" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Enter a address"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Enter an address"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress"/>
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ typedef struct _LinphoneManagerSounds {
|
|||
|
||||
- (void)silentPushFailed:(NSTimer*)timer;
|
||||
|
||||
- (void)removeAllAccounts;
|
||||
|
||||
@property (readonly) BOOL isTesting;
|
||||
@property (readonly, strong) FastAddressBook* fastAddressBook;
|
||||
@property Connectivity connectivity;
|
||||
|
|
|
|||
|
|
@ -1885,6 +1885,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
|
|||
}
|
||||
|
||||
- (void)call:(NSString *)address displayName:(NSString *)displayName transfer:(BOOL)transfer {
|
||||
// First verify that network is available, abort otherwise.
|
||||
if (!linphone_core_is_network_reachable(theLinphoneCore)) {
|
||||
UIAlertView *error = [[UIAlertView alloc]
|
||||
initWithTitle:NSLocalizedString(@"Network Error", nil)
|
||||
|
|
@ -1893,96 +1894,92 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
|
|||
@"There is no network connection available, enable WIFI or WWAN prior to place a call",
|
||||
nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
return;
|
||||
}
|
||||
|
||||
// Then check that no GSM calls are in progress, abort otherwise.
|
||||
CTCallCenter *callCenter = [[CTCallCenter alloc] init];
|
||||
if ([callCenter currentCalls] != nil) {
|
||||
LOGE(@"GSM call in progress, cancelling outgoing SIP call request");
|
||||
UIAlertView *error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot make call", nil)
|
||||
message:NSLocalizedString(@"Please terminate GSM call", nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
|
||||
otherButtonTitles:nil];
|
||||
UIAlertView *error =
|
||||
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot make call", nil)
|
||||
message:NSLocalizedString(@"Please terminate GSM call first.", nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneProxyConfig *proxyCfg;
|
||||
// get default proxy
|
||||
linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg);
|
||||
LinphoneCallParams *lcallParams = linphone_core_create_default_call_parameters(theLinphoneCore);
|
||||
if ([self lpConfigBoolForKey:@"edge_opt_preference"]) {
|
||||
bool low_bandwidth = self.network == network_2g;
|
||||
if (low_bandwidth) {
|
||||
LOGI(@"Low bandwidth mode");
|
||||
}
|
||||
linphone_call_params_enable_low_bandwidth(lcallParams, low_bandwidth);
|
||||
}
|
||||
LinphoneCall *call = NULL;
|
||||
|
||||
BOOL addressIsASCII = [address canBeConvertedToEncoding:[NSString defaultCStringEncoding]];
|
||||
|
||||
if ([address length] == 0)
|
||||
return; // just return
|
||||
if (!addressIsASCII) {
|
||||
UIAlertView *error =
|
||||
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
|
||||
message:NSLocalizedString(@"The address should only contain ASCII data", nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
|
||||
otherButtonTitles:nil];
|
||||
LinphoneAddress *addr = NULL;
|
||||
// Continue by checking that the provided address is a valid SIP address, abort otherwise.
|
||||
if ([address length] == 0) {
|
||||
// no address provided... nothing to do
|
||||
} else if (![address canBeConvertedToEncoding:[NSString defaultCStringEncoding]]) {
|
||||
UIAlertView *error = [[UIAlertView alloc]
|
||||
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
|
||||
message:NSLocalizedString(
|
||||
@"Some invalid characters where found in the given SIP address. Please correct it.",
|
||||
nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
}
|
||||
LinphoneAddress *linphoneAddress =
|
||||
linphone_core_interpret_url(theLinphoneCore, [address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
|
||||
if (linphoneAddress) {
|
||||
|
||||
if (displayName != nil) {
|
||||
linphone_address_set_display_name(linphoneAddress,
|
||||
[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
}
|
||||
if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"])
|
||||
linphone_address_set_domain(
|
||||
linphoneAddress, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"wizard"]
|
||||
cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
if (transfer) {
|
||||
linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore),
|
||||
[address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
} else {
|
||||
call = linphone_core_invite_address_with_params(theLinphoneCore, linphoneAddress, lcallParams);
|
||||
}
|
||||
linphone_address_destroy(linphoneAddress);
|
||||
|
||||
} else {
|
||||
|
||||
} else if ((addr = linphone_core_interpret_url(
|
||||
theLinphoneCore, [address cStringUsingEncoding:[NSString defaultCStringEncoding]])) == NULL) {
|
||||
UIAlertView *error = [[UIAlertView alloc]
|
||||
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
|
||||
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
|
||||
@"call or use a valid SIP address (I.E sip:john@example.net)",
|
||||
nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
}
|
||||
} else {
|
||||
// Finally we can make the call
|
||||
LinphoneProxyConfig *proxyCfg;
|
||||
linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg);
|
||||
LinphoneCallParams *lcallParams = linphone_core_create_default_call_parameters(theLinphoneCore);
|
||||
if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
|
||||
LOGI(@"Enabling low bandwidth mode");
|
||||
linphone_call_params_enable_low_bandwidth(lcallParams, YES);
|
||||
}
|
||||
if (displayName != nil) {
|
||||
linphone_address_set_display_name(addr,
|
||||
[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
}
|
||||
if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"]) {
|
||||
linphone_address_set_domain(
|
||||
addr, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"wizard"]
|
||||
cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
}
|
||||
|
||||
if (call) {
|
||||
// The LinphoneCallAppData object should be set on call creation with callback
|
||||
// - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash
|
||||
// We are NOT responsible for creating the AppData.
|
||||
LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
|
||||
if (data == nil)
|
||||
LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
|
||||
/* will be used later to notify user if video was not activated because of the linphone core*/
|
||||
else
|
||||
data->videoRequested = linphone_call_params_video_enabled(lcallParams);
|
||||
if (transfer) {
|
||||
char *caddr = linphone_address_as_string(addr);
|
||||
linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), caddr);
|
||||
ms_free(caddr);
|
||||
} else {
|
||||
LinphoneCall *call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams);
|
||||
if (call) {
|
||||
// The LinphoneCallAppData object should be set on call creation with callback
|
||||
// - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash
|
||||
// We are NOT responsible for creating the AppData.
|
||||
LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
|
||||
if (data == nil) {
|
||||
LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
|
||||
/* will be used later to notify user if video was not activated because of the linphone core*/
|
||||
} else {
|
||||
data->videoRequested = linphone_call_params_video_enabled(lcallParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
linphone_address_destroy(addr);
|
||||
linphone_call_params_destroy(lcallParams);
|
||||
}
|
||||
linphone_call_params_destroy(lcallParams);
|
||||
}
|
||||
|
||||
#pragma mark - Property Functions
|
||||
|
|
@ -2331,4 +2328,10 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
|
|||
// Query our in-app server to retrieve InApp purchases
|
||||
[_iapManager retrievePurchases];
|
||||
}
|
||||
|
||||
- (void)removeAllAccounts {
|
||||
linphone_core_clear_proxy_config([LinphoneManager getLc]);
|
||||
linphone_core_clear_all_auth_info([LinphoneManager getLc]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@
|
|||
break;
|
||||
}
|
||||
[registrationStateLabel setText:message];
|
||||
registrationStateLabel.accessibilityValue = registrationStateImage.accessibilityValue = message;
|
||||
[registrationStateImage setImage:image];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -608,21 +608,28 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
@"SIP account configuration in the settings.",
|
||||
nil);
|
||||
} else {
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"Cannot call %@", nil), lUserName];
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"Cannot call %@.", nil), lUserName];
|
||||
}
|
||||
|
||||
if (linphone_call_get_reason(call) == LinphoneReasonNotFound) {
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"%@ not registered", nil), lUserName];
|
||||
} else {
|
||||
if (message != nil) {
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"%@\nReason was: %@", nil), lMessage, message];
|
||||
}
|
||||
switch (linphone_call_get_reason(call)) {
|
||||
case LinphoneReasonNotFound:
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"%@ is not registered.", nil), lUserName];
|
||||
break;
|
||||
case LinphoneReasonBusy:
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"%@ is busy.", nil), lUserName];
|
||||
break;
|
||||
default:
|
||||
if (message != nil) {
|
||||
lMessage = [NSString stringWithFormat:NSLocalizedString(@"%@\nReason was: %@", nil), lMessage, message];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
lTitle = NSLocalizedString(@"Call failed", nil);
|
||||
UIAlertView *error = [[UIAlertView alloc] initWithTitle:lTitle
|
||||
message:lMessage
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Dismiss", nil)
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)reset {
|
||||
[self clearProxyConfig];
|
||||
[[LinphoneManager instance] removeAllAccounts];
|
||||
[[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"];
|
||||
|
||||
LinphoneCore *lc = [LinphoneManager getLc];
|
||||
|
|
@ -372,17 +372,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[contentView setContentSize:[view bounds].size];
|
||||
}
|
||||
|
||||
- (void)clearProxyConfig {
|
||||
linphone_core_clear_proxy_config([LinphoneManager getLc]);
|
||||
linphone_core_clear_all_auth_info([LinphoneManager getLc]);
|
||||
}
|
||||
|
||||
- (void)setDefaultSettings:(LinphoneProxyConfig *)proxyCfg {
|
||||
LinphoneManager *lm = [LinphoneManager instance];
|
||||
|
||||
[lm configurePushTokenForProxyConfig:proxyCfg];
|
||||
}
|
||||
|
||||
- (BOOL)addProxyConfig:(NSString *)username
|
||||
password:(NSString *)password
|
||||
domain:(NSString *)domain
|
||||
|
|
@ -440,9 +429,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
LinphoneAuthInfo *info = linphone_auth_info_new([username UTF8String], NULL, [password UTF8String], NULL, NULL,
|
||||
linphone_proxy_config_get_domain(proxyCfg));
|
||||
|
||||
[self setDefaultSettings:proxyCfg];
|
||||
|
||||
[self clearProxyConfig];
|
||||
LinphoneManager *lm = [LinphoneManager instance];
|
||||
[lm configurePushTokenForProxyConfig:proxyCfg];
|
||||
[lm removeAllAccounts];
|
||||
|
||||
linphone_proxy_config_enable_register(proxyCfg, true);
|
||||
linphone_core_add_auth_info(lc, info);
|
||||
|
|
@ -454,8 +443,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)addProvisionedProxy:(NSString *)username withPassword:(NSString *)password withDomain:(NSString *)domain {
|
||||
[self clearProxyConfig];
|
||||
|
||||
[[LinphoneManager instance] removeAllAccounts];
|
||||
LinphoneProxyConfig *proxyCfg = linphone_core_create_proxy_config([LinphoneManager getLc]);
|
||||
|
||||
const char *addr = linphone_proxy_config_get_domain(proxyCfg);
|
||||
|
|
|
|||
13
TestsUI/CallTester.h
Normal file
13
TestsUI/CallTester.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// CallTester.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Gautier Pelloux-Prayer on 24/08/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "LinphoneTestCase.h"
|
||||
|
||||
@interface CallTester : LinphoneTestCase
|
||||
|
||||
@end
|
||||
62
TestsUI/CallTester.m
Normal file
62
TestsUI/CallTester.m
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
//
|
||||
// CallTester.m
|
||||
// linphone
|
||||
//
|
||||
// Created by Gautier Pelloux-Prayer on 24/08/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "CallTester.h"
|
||||
#include "LinphoneManager.h"
|
||||
|
||||
@implementation CallTester
|
||||
|
||||
- (void)beforeAll {
|
||||
[super beforeAll];
|
||||
[self switchToValidAccountIfNeeded];
|
||||
}
|
||||
|
||||
- (void)beforeEach {
|
||||
[super beforeEach];
|
||||
if ([tester tryFindingTappableViewWithAccessibilityLabel:@"Back" error:nil]) {
|
||||
[tester tapViewWithAccessibilityLabel:@"Back"];
|
||||
}
|
||||
[tester tapViewWithAccessibilityLabel:@"Dialer"];
|
||||
}
|
||||
|
||||
- (void)afterEach {
|
||||
if ([tester tryFindingTappableViewWithAccessibilityLabel:@"Hangup" error:nil]) {
|
||||
[tester tapViewWithAccessibilityLabel:@"Hangup"];
|
||||
}
|
||||
[super afterEach];
|
||||
}
|
||||
#pragma mark - Tools
|
||||
|
||||
- (void)callURI:(NSString *)address {
|
||||
[tester enterText:address intoViewWithAccessibilityLabel:@"Enter an address"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Call" traits:UIAccessibilityTraitButton];
|
||||
}
|
||||
|
||||
#pragma mark - Tests
|
||||
|
||||
- (void)testCallMeBusy {
|
||||
[self callURI:[self me]];
|
||||
[tester waitForViewWithAccessibilityLabel:[NSString stringWithFormat:@"%@ is busy.", [self me]]];
|
||||
[tester tapViewWithAccessibilityLabel:@"Cancel" traits:UIAccessibilityTraitButton];
|
||||
}
|
||||
|
||||
- (void)testCallUnregisteredUser {
|
||||
NSString *unregisteredUser = [self getUUID];
|
||||
[self callURI:unregisteredUser];
|
||||
[tester waitForViewWithAccessibilityLabel:[NSString stringWithFormat:@"%@ is not registered.", unregisteredUser]];
|
||||
[tester tapViewWithAccessibilityLabel:@"Cancel" traits:UIAccessibilityTraitButton];
|
||||
}
|
||||
|
||||
- (void)testDialInvalidSIPURI {
|
||||
[self callURI:@"🎆123"];
|
||||
[tester waitForViewWithAccessibilityLabel:
|
||||
@"Some invalid characters where found in the given SIP address. Please correct it."];
|
||||
[tester tapViewWithAccessibilityLabel:@"Cancel" traits:UIAccessibilityTraitButton];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -75,8 +75,8 @@
|
|||
NSString *phone = @"+5 15 #0664;447*46";
|
||||
[self createContact:contactName lastName:@"dummy" phoneNumber:phone SIPAddress:nil];
|
||||
[tester tapViewWithAccessibilityLabel:[@"Linphone, " stringByAppendingString:phone]];
|
||||
[tester waitForViewWithAccessibilityLabel:[phone stringByAppendingString:@" not registered"]];
|
||||
[tester tapViewWithAccessibilityLabel:@"Dismiss"];
|
||||
[tester waitForViewWithAccessibilityLabel:[phone stringByAppendingString:@" is not registered."]];
|
||||
[tester tapViewWithAccessibilityLabel:@"Cancel"];
|
||||
}
|
||||
|
||||
- (void)testDeleteContact {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@
|
|||
if (!([language isEqualToString:@"en"] || [language containsString:@"en-"])) {
|
||||
LOGF(@"Language must be 'en' (English) instead of %@", language);
|
||||
}
|
||||
#if DEBUG
|
||||
linphone_core_set_log_level(ORTP_MESSAGE);
|
||||
#else
|
||||
linphone_core_set_log_level(ORTP_WARNING);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)beforeAll {
|
||||
|
|
@ -34,7 +38,7 @@
|
|||
};
|
||||
#endif
|
||||
// go to dialer
|
||||
for (NSString *button in @[ @"Cancel", @"Back", @"Dialer" ]) {
|
||||
for (NSString *button in @[ @"Cancel", @"Back", @"Hangup", @"Dialer" ]) {
|
||||
if ([tester tryFindingTappableViewWithAccessibilityLabel:button error:nil]) {
|
||||
[tester tapViewWithAccessibilityLabel:button traits:UIAccessibilityTraitButton];
|
||||
}
|
||||
|
|
@ -42,11 +46,12 @@
|
|||
}
|
||||
|
||||
- (NSString *)me {
|
||||
return @"testios";
|
||||
return [NSString
|
||||
stringWithFormat:@"testios-%@", [[UIDevice currentDevice].identifierForVendor.UUIDString substringToIndex:6]];
|
||||
}
|
||||
|
||||
- (NSString *)accountDomain {
|
||||
return @"sip.linphone.org";
|
||||
return @"test.linphone.org";
|
||||
}
|
||||
|
||||
- (NSString *)getUUID {
|
||||
|
|
@ -101,26 +106,48 @@ static bool invalidAccount = true;
|
|||
[UIView setAnimationsEnabled:false];
|
||||
|
||||
if (invalidAccount && ![self hasValidProxyConfig]) {
|
||||
LOGI(@"Switching to a test account...");
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Settings"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Run assistant"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
if ([tester tryFindingViewWithAccessibilityLabel:@"Launch Wizard" error:nil]) {
|
||||
[tester tapViewWithAccessibilityLabel:@"Launch Wizard"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
}
|
||||
LinphoneCore *lc = [LinphoneManager getLc];
|
||||
linphone_core_clear_proxy_config(lc);
|
||||
linphone_core_clear_all_auth_info(lc);
|
||||
|
||||
LOGI(@"Switching to a valid account");
|
||||
LinphoneAddress *testAddr = linphone_address_new(
|
||||
[[NSString stringWithFormat:@"sip:%@@%@", [self me], [self accountDomain]] UTF8String]);
|
||||
linphone_address_set_header(testAddr, "X-Create-Account", "yes");
|
||||
linphone_address_set_transport(testAddr, LinphoneTransportTcp);
|
||||
linphone_address_set_port(testAddr, 0);
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Start"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in linphone.org account"];
|
||||
LinphoneProxyConfig *testProxy = linphone_proxy_config_new();
|
||||
linphone_proxy_config_set_identity_address(testProxy, testAddr);
|
||||
char *server_addr = ms_strdup_printf("%s;transport=tcp", linphone_address_get_domain(testAddr));
|
||||
linphone_proxy_config_set_server_addr(testProxy, server_addr);
|
||||
linphone_proxy_config_set_route(testProxy, server_addr);
|
||||
ms_free(server_addr);
|
||||
|
||||
[tester enterText:[self me] intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:@"testtest" intoViewWithAccessibilityLabel:@"Password"];
|
||||
LinphoneAuthInfo *testAuth = linphone_auth_info_new(linphone_address_get_username(testAddr), NULL,
|
||||
linphone_address_get_password(testAddr), NULL, NULL,
|
||||
linphone_address_get_domain(testAddr));
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in"];
|
||||
[[LinphoneManager instance] configurePushTokenForProxyConfig:testProxy];
|
||||
[[LinphoneManager instance] removeAllAccounts];
|
||||
|
||||
linphone_proxy_config_enable_register(testProxy, true);
|
||||
linphone_core_add_auth_info(lc, testAuth);
|
||||
linphone_core_add_proxy_config(lc, testProxy);
|
||||
linphone_core_set_default_proxy_config(lc, testProxy);
|
||||
|
||||
linphone_proxy_config_unref(testProxy);
|
||||
linphone_auth_info_destroy(testAuth);
|
||||
linphone_address_destroy(testAddr);
|
||||
|
||||
// reload address book to prepend proxy config domain to contacts' phone number
|
||||
[[[LinphoneManager instance] fastAddressBook] reload];
|
||||
|
||||
[tester waitForViewWithAccessibilityLabel:@"Registration state"
|
||||
value:@"Registered"
|
||||
traits:UIAccessibilityTraitStaticText];
|
||||
|
||||
[tester waitForViewWithAccessibilityLabel:@"Dialer"];
|
||||
invalidAccount = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,17 +100,16 @@
|
|||
}
|
||||
|
||||
- (void)testLinphoneLogin {
|
||||
|
||||
[self _linphoneLogin:[self me] withPW:@"testtest"];
|
||||
[self _linphoneLogin:@"testios" withPW:@"testtest"];
|
||||
|
||||
// check the registration state
|
||||
UIView *regState = [tester waitForViewWithAccessibilityLabel:@"Registration state"];
|
||||
[tester waitForTimeInterval:1];
|
||||
[tester expectView:regState toContainText:@"Registered"];
|
||||
[tester waitForViewWithAccessibilityLabel:@"Registration state"
|
||||
value:@"Registered"
|
||||
traits:UIAccessibilityTraitStaticText];
|
||||
}
|
||||
|
||||
- (void)testLinphoneLoginWithBadPassword {
|
||||
[self _linphoneLogin:[self me] withPW:@"badPass"];
|
||||
[self _linphoneLogin:@"testios" withPW:@"badPass"];
|
||||
|
||||
[self setInvalidAccountSet:true];
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@
|
|||
63B81A0E1B57DA33009604A6 /* TPKeyboardAvoidingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B81A071B57DA33009604A6 /* TPKeyboardAvoidingScrollView.m */; };
|
||||
63B81A0F1B57DA33009604A6 /* TPKeyboardAvoidingTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B81A091B57DA33009604A6 /* TPKeyboardAvoidingTableView.m */; };
|
||||
63B81A101B57DA33009604A6 /* UIScrollView+TPKeyboardAvoidingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B81A0B1B57DA33009604A6 /* UIScrollView+TPKeyboardAvoidingAdditions.m */; };
|
||||
63B910C21B8B5368004641C9 /* CallTester.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B910BA1B8B5356004641C9 /* CallTester.m */; };
|
||||
63C458261B5680AC009F2D7E /* ring.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2237D4081084D7A9001383EE /* ring.wav */; };
|
||||
63CD4B4F1A5AAC8C00B84282 /* DTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CD4B4E1A5AAC8C00B84282 /* DTAlertView.m */; };
|
||||
63D2680F1B174A5E00A2CC11 /* numpad_one_voicemail_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 63D2680D1B174A5E00A2CC11 /* numpad_one_voicemail_default.png */; };
|
||||
|
|
@ -1108,6 +1109,8 @@
|
|||
63B81A091B57DA33009604A6 /* TPKeyboardAvoidingTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPKeyboardAvoidingTableView.m; sourceTree = "<group>"; };
|
||||
63B81A0A1B57DA33009604A6 /* UIScrollView+TPKeyboardAvoidingAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+TPKeyboardAvoidingAdditions.h"; sourceTree = "<group>"; };
|
||||
63B81A0B1B57DA33009604A6 /* UIScrollView+TPKeyboardAvoidingAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+TPKeyboardAvoidingAdditions.m"; sourceTree = "<group>"; };
|
||||
63B910B91B8B5356004641C9 /* CallTester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallTester.h; sourceTree = "<group>"; };
|
||||
63B910BA1B8B5356004641C9 /* CallTester.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CallTester.m; sourceTree = "<group>"; };
|
||||
63CD4B4D1A5AAC8C00B84282 /* DTAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTAlertView.h; sourceTree = "<group>"; };
|
||||
63CD4B4E1A5AAC8C00B84282 /* DTAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTAlertView.m; sourceTree = "<group>"; };
|
||||
63D2680D1B174A5E00A2CC11 /* numpad_one_voicemail_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = numpad_one_voicemail_default.png; path = Resources/numpad_one_voicemail_default.png; sourceTree = "<group>"; };
|
||||
|
|
@ -2297,7 +2300,6 @@
|
|||
F03A9B9718C0DB6F00C4D7FE /* libc++.dylib */,
|
||||
F0BB8C111936240300974404 /* libcunit.a */,
|
||||
220FAD2910765B400068D98F /* libgsm.a */,
|
||||
223148E31178A08200637D6A /* libilbc.a */,
|
||||
2211DB911475562600DEE054 /* liblinphone.a */,
|
||||
F0BB8C0F193623F200974404 /* liblinphonetester.a */,
|
||||
22405EE916006F0700B92522 /* libmediastreamer_base.a */,
|
||||
|
|
@ -2345,12 +2347,14 @@
|
|||
630589DD1B4E810900EFAE36 /* TestsUI */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63058A0A1B4E81B700EFAE36 /* Info.plist */,
|
||||
630589F21B4E816900EFAE36 /* KIF.xcodeproj */,
|
||||
63B910B91B8B5356004641C9 /* CallTester.h */,
|
||||
63B910BA1B8B5356004641C9 /* CallTester.m */,
|
||||
630589DE1B4E810900EFAE36 /* ChatTester.h */,
|
||||
630589DF1B4E810900EFAE36 /* ChatTester.m */,
|
||||
630589E01B4E810900EFAE36 /* ContactsTester.h */,
|
||||
630589E11B4E810900EFAE36 /* ContactsTester.m */,
|
||||
63058A0A1B4E81B700EFAE36 /* Info.plist */,
|
||||
630589F21B4E816900EFAE36 /* KIF.xcodeproj */,
|
||||
630589E31B4E810900EFAE36 /* LinphoneTestCase.h */,
|
||||
630589E41B4E810900EFAE36 /* LinphoneTestCase.m */,
|
||||
630589E51B4E810900EFAE36 /* WizardTester.h */,
|
||||
|
|
@ -4118,6 +4122,7 @@
|
|||
630589EA1B4E810900EFAE36 /* LinphoneTestCase.m in Sources */,
|
||||
630589EB1B4E810900EFAE36 /* WizardTester.m in Sources */,
|
||||
630589E71B4E810900EFAE36 /* ChatTester.m in Sources */,
|
||||
63B910C21B8B5368004641C9 /* CallTester.m in Sources */,
|
||||
630589E81B4E810900EFAE36 /* ContactsTester.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e7dd35efa0f0d250db66fadb11994b4f48e088b1
|
||||
Subproject commit af43ad89650f70ce5e2fb4a45287aabbdd9b63d6
|
||||
Loading…
Add table
Reference in a new issue