-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.3.0' into develop
- Loading branch information
Showing
15 changed files
with
309 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// MNetContextLinkTests.m | ||
// MNAdSdk_Tests | ||
// | ||
// Created by kunal.ch on 19/12/17. | ||
// Copyright © 2017 Nithin. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
#import "MNetTestManager.h" | ||
|
||
@interface MNetContextLinkTests : MNetTestManager | ||
|
||
@end | ||
|
||
@implementation MNetContextLinkTests | ||
|
||
- (void)testSetContextLink{ | ||
NSString *contextLink = @"https://media.net"; | ||
MNetAdBaseCommon *adBaseCommon = [[MNetAdBaseCommon alloc] init]; | ||
adBaseCommon.rootViewController = [self getViewController]; | ||
adBaseCommon.contextLink = contextLink; | ||
XCTAssertTrue([adBaseCommon.fetchVCLink isEqualToString:contextLink]); | ||
} | ||
|
||
- (void)testContextLinkNotSet{ | ||
UIViewController *vc = [self getViewController]; | ||
NSString *contextLink = [MNetUtil getLinkForVC:vc]; | ||
MNetAdBaseCommon *adBaseCommon = [[MNetAdBaseCommon alloc] init]; | ||
adBaseCommon.rootViewController = vc; | ||
XCTAssertTrue([adBaseCommon.fetchVCLink isEqualToString:contextLink], @"Adbase common value - %@ and context link - %@", adBaseCommon.fetchVCLink, contextLink); | ||
} | ||
|
||
- (void)testWhenRootViewControllerAndContextLinkSet{ | ||
NSString *contextLink = @"https://media.net"; | ||
NSString *vcLink = [MNetUtil getLinkForVC:[self getViewController]]; | ||
MNetAdBaseCommon *adBaseCommon = [[MNetAdBaseCommon alloc] init]; | ||
adBaseCommon.rootViewController = [self getViewController]; | ||
adBaseCommon.contextLink = contextLink; | ||
XCTAssertFalse([adBaseCommon.fetchVCLink isEqualToString:vcLink]); | ||
XCTAssertTrue([adBaseCommon.fetchVCLink isEqualToString:contextLink]); | ||
} | ||
|
||
- (void)testContextLinkValidity{ | ||
NSString *validcontextLink = @"http://media.net"; | ||
NSString *invalidContextLink = @"media.net"; | ||
NSString *emptyContextLink = @""; | ||
|
||
MNetAdBaseCommon *adBaseCommon = [[MNetAdBaseCommon alloc] init]; | ||
adBaseCommon.rootViewController = [self getViewController]; | ||
|
||
adBaseCommon.contextLink = validcontextLink; | ||
XCTAssertTrue([adBaseCommon.fetchVCLink isEqualToString:validcontextLink]); | ||
|
||
adBaseCommon.contextLink = invalidContextLink; | ||
XCTAssertFalse([adBaseCommon.fetchVCLink isEqualToString:invalidContextLink]); | ||
|
||
adBaseCommon.contextLink = emptyContextLink; | ||
XCTAssertFalse([adBaseCommon.fetchVCLink isEqualToString:emptyContextLink]); | ||
} | ||
|
||
- (void)testContextLinkNil{ | ||
MNetAdBaseCommon *adBaseCommon = [[MNetAdBaseCommon alloc] init]; | ||
XCTAssertNil(adBaseCommon.fetchVCLink); | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// | ||
// MNetPulseRegulationTests.m | ||
// MNAdSdk_Tests | ||
// | ||
// Created by nithin.g on 20/12/17. | ||
// Copyright © 2017 Nithin. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
#import "MNetTestManager.h" | ||
|
||
@interface MNetPulseRegulationTests : MNetTestManager | ||
|
||
@end | ||
|
||
@implementation MNetPulseRegulationTests | ||
|
||
- (void)testPulseWithRegulation{ | ||
[[MNet getInstance] setAppContainsChildDirectedContent:YES]; | ||
|
||
// TODO: Need to fetch the regulated events from the pulse-event types or something I guess | ||
NSArray <NSString *> *allEvents = @[ | ||
MNetPulseEventBase, | ||
MNetPulseEventSessionTime, | ||
MNetPulseEventEnteredBackground, | ||
MNetPulseEventAnalytics, | ||
MNetPulseEventActivityContext, | ||
MNetPulseEventResponseDuration, | ||
MNetPulseEventProcessedPrediction, | ||
MNetPulseEventAdVisible, | ||
MNetPulseEventTrackingSuccess, | ||
MNetPulseEventTrackingError, | ||
MNetPulseEventBannerAdClicked, | ||
MNetPulseEventInterstitialAdClicked, | ||
MNetPulseEventLocalApps, | ||
MNetPulseEventHbAdSlot, | ||
MNetPulseEventError, | ||
MNetPulseEventNetwork, | ||
MNetPulseEventDevice, | ||
MNetPulseEventLocation, | ||
MNetPulseEventDeviceLang, | ||
MNetPulseEventTimezone, | ||
MNetPulseEventAddress, | ||
MNetPulseEventUserAgent, | ||
MNetPulseEventLog, | ||
MNetPulseEventDefault, | ||
MNetPulseEventVideo, | ||
MNetPulseEventImpressionLoad, | ||
MNetPulseEventImpressionSeen, | ||
]; | ||
NSArray <NSString *>*unregulatedEvents = [MNetPulseHttp getUnregulatedPulseEvents]; | ||
XCTAssert([unregulatedEvents count] > 0, @"There are no un-regulated pulse events"); | ||
NSString *dummySubType = @"dummy"; | ||
for(NSString *eventType in allEvents){ | ||
MNetPulseEvent *pulseEvent = [[MNetPulseEvent alloc] initEventWithType:eventType | ||
AndSubType:dummySubType | ||
AndCustomData:nil]; | ||
BOOL isRegulated = [MNetPulseHttp isRegulatedForPulseEvent:pulseEvent]; | ||
BOOL expectedRegulation = YES; | ||
|
||
for(NSString *unregulatedEventType in unregulatedEvents){ | ||
if([unregulatedEventType isEqualToString: eventType]){ | ||
expectedRegulation = NO; | ||
break; | ||
} | ||
} | ||
XCTAssert(isRegulated == expectedRegulation, | ||
@"Event - %@, isRegulated - %@, expectedRegulation - %@", | ||
eventType, | ||
isRegulated?@"yes":@"no", | ||
expectedRegulation?@"yes":@"no" | ||
); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.