Skip to content

Commit

Permalink
Merge branch 'release/1.3.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mnetapps committed Dec 22, 2017
2 parents 14483b1 + 0e4d6d4 commit b950509
Show file tree
Hide file tree
Showing 15 changed files with 309 additions and 17 deletions.
12 changes: 12 additions & 0 deletions Example/MNAdSdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
8A70D3F01EB0984800F4B63E /* rewardedResponseVideo320x250.json in Resources */ = {isa = PBXBuildFile; fileRef = 8A70D3EE1EB0970C00F4B63E /* rewardedResponseVideo320x250.json */; };
8A70D3F41EB09A0700F4B63E /* MNetTestInterstitialVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A70D3F31EB09A0700F4B63E /* MNetTestInterstitialVideo.m */; };
8ACD24911FDE80A400ABDDC3 /* vast-wrapper-linear.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8ACD24901FDE80A400ABDDC3 /* vast-wrapper-linear.xml */; };
8AE0013E1FE8E4C500D57CA9 /* MNetContextLinkTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8AE0013D1FE8E4C500D57CA9 /* MNetContextLinkTests.m */; };
8AEF2CBE1EAE2E6F00BAE4DE /* MNetVASTParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8AEF2CBD1EAE2E6F00BAE4DE /* MNetVASTParserTest.m */; };
AE0AE4B31F6680280008B282 /* MNetPrefetchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE0AE4B21F6680280008B282 /* MNetPrefetchTests.m */; };
AE0FBDC71F614AB9003435F7 /* MNetBidStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE0FBDC61F614AB9003435F7 /* MNetBidStoreTests.m */; };
Expand Down Expand Up @@ -80,6 +81,8 @@
AEAE57B31EAFCF1A00430540 /* MNetTestAdRequestFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = AEAE57B21EAFCF1A00430540 /* MNetTestAdRequestFormat.m */; };
AEB5AE821F1511910055C58A /* MNetHBFilterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB5AE811F1511910055C58A /* MNetHBFilterTest.m */; };
AEC8DDF41F9F5B3200912901 /* MNetAuctionLoggerManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEC8DDF31F9F5B3200912901 /* MNetAuctionLoggerManagerTests.m */; };
AEC914491FEA37D300E58EA5 /* MNetTestChildContentRequests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEC914481FEA37D300E58EA5 /* MNetTestChildContentRequests.m */; };
AEC9144B1FEA61D900E58EA5 /* MNetPulseRegulationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEC9144A1FEA61D900E58EA5 /* MNetPulseRegulationTests.m */; };
AED94DF01E72DF7300470329 /* MNDemoConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = AED94DEF1E72DF7300470329 /* MNDemoConstants.m */; };
AEDA10291F28779E00A28A6F /* MNetURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEDA10281F28779E00A28A6F /* MNetURLTests.m */; };
AEDC59531F324A5800228A69 /* MNetSampleModelClass.m in Sources */ = {isa = PBXBuildFile; fileRef = AEDC59521F324A5800228A69 /* MNetSampleModelClass.m */; };
Expand Down Expand Up @@ -140,6 +143,7 @@
8A70D3EE1EB0970C00F4B63E /* rewardedResponseVideo320x250.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rewardedResponseVideo320x250.json; sourceTree = "<group>"; };
8A70D3F31EB09A0700F4B63E /* MNetTestInterstitialVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetTestInterstitialVideo.m; sourceTree = "<group>"; };
8ACD24901FDE80A400ABDDC3 /* vast-wrapper-linear.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "vast-wrapper-linear.xml"; sourceTree = "<group>"; };
8AE0013D1FE8E4C500D57CA9 /* MNetContextLinkTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MNetContextLinkTests.m; sourceTree = "<group>"; };
8AEF2CBD1EAE2E6F00BAE4DE /* MNetVASTParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetVASTParserTest.m; sourceTree = "<group>"; };
AE0AE4B21F6680280008B282 /* MNetPrefetchTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetPrefetchTests.m; sourceTree = "<group>"; };
AE0FBDC61F614AB9003435F7 /* MNetBidStoreTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetBidStoreTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -188,6 +192,8 @@
AEAE57B21EAFCF1A00430540 /* MNetTestAdRequestFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetTestAdRequestFormat.m; sourceTree = "<group>"; };
AEB5AE811F1511910055C58A /* MNetHBFilterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetHBFilterTest.m; sourceTree = "<group>"; };
AEC8DDF31F9F5B3200912901 /* MNetAuctionLoggerManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MNetAuctionLoggerManagerTests.m; sourceTree = "<group>"; };
AEC914481FEA37D300E58EA5 /* MNetTestChildContentRequests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MNetTestChildContentRequests.m; sourceTree = "<group>"; };
AEC9144A1FEA61D900E58EA5 /* MNetPulseRegulationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MNetPulseRegulationTests.m; sourceTree = "<group>"; };
AED94DEE1E72DF7300470329 /* MNDemoConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MNDemoConstants.h; sourceTree = "<group>"; };
AED94DEF1E72DF7300470329 /* MNDemoConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNDemoConstants.m; sourceTree = "<group>"; };
AEDA10281F28779E00A28A6F /* MNetURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetURLTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -414,6 +420,7 @@
isa = PBXGroup;
children = (
AE12772E1F5E9C8900450657 /* MNetAppLinkTests.m */,
8AE0013D1FE8E4C500D57CA9 /* MNetContextLinkTests.m */,
);
name = MNetAppLinkTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -448,6 +455,7 @@
isa = PBXGroup;
children = (
AE4A8BC51F27174A00295139 /* MNetPulseStoreTests.m */,
AEC9144A1FEA61D900E58EA5 /* MNetPulseRegulationTests.m */,
);
name = MNetPulseTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -577,6 +585,7 @@
isa = PBXGroup;
children = (
AEAE57B21EAFCF1A00430540 /* MNetTestAdRequestFormat.m */,
AEC914481FEA37D300E58EA5 /* MNetTestChildContentRequests.m */,
);
name = MNetAdRequests;
sourceTree = "<group>";
Expand Down Expand Up @@ -905,6 +914,7 @@
buildActionMask = 2147483647;
files = (
AE33C9011EAE9078003BF9ED /* XCTest+MNetTestUtils.h in Sources */,
AEC9144B1FEA61D900E58EA5 /* MNetPulseRegulationTests.m in Sources */,
AEC8DDF41F9F5B3200912901 /* MNetAuctionLoggerManagerTests.m in Sources */,
AEF8F4B41F8B8A9C00F1D4DE /* MNetMacroManagerTests.m in Sources */,
AE699B2F1F6B316500D4867B /* MNetResponseParserPredictBidsTest.m in Sources */,
Expand All @@ -924,6 +934,7 @@
AE5CBE0B1F96887600E6DB37 /* MNetAuctionTests.m in Sources */,
AE5754CC1F2A16DA00D55E93 /* MNetHttpClientTests.m in Sources */,
AEDA10291F28779E00A28A6F /* MNetURLTests.m in Sources */,
AEC914491FEA37D300E58EA5 /* MNetTestChildContentRequests.m in Sources */,
AE1241051EAE94CC00EED2F4 /* MNetTestBannerIncomplete.m in Sources */,
AE37516F1F86425400DB2BA7 /* MNetTpdReusePrefetch.m in Sources */,
8A4CBFCC1F668B47009CCB02 /* MNetAdViewReuseRepositoryTests.m in Sources */,
Expand All @@ -947,6 +958,7 @@
8AEF2CBE1EAE2E6F00BAE4DE /* MNetVASTParserTest.m in Sources */,
AE59CD0A1F2B7A5800704798 /* MNetJSONToObjectParserTests.m in Sources */,
AE75A4951EAE9D8D00B782D5 /* MNetTestBannerLoad.m in Sources */,
8AE0013E1FE8E4C500D57CA9 /* MNetContextLinkTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/MNAdSdk/MNAdSdk-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.3</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
1 change: 0 additions & 1 deletion Example/MNAdSdk/MNShowAdViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ - (IBAction)loadAdAction:(id)sender {
[mnetAdView setDelegate:self];
[mnetAdView setSize:MNET_BANNER_AD_SIZE];
[mnetAdView setRootViewController:self];

// Initializing with lat-long
CLLocation *customLocation = [[CLLocation alloc]initWithLatitude:LATITUDE longitude:LONGITUDE];
[mnetAdView setCustomLocation:customLocation];
Expand Down
27 changes: 14 additions & 13 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ PODS:
- AFNetworking/Reachability (3.1.0)
- AFNetworking/Security (3.1.0)
- AFNetworking/Serialization (3.1.0)
- Firebase/AdMob (4.7.0):
- Firebase/AdMob (4.8.0):
- Firebase/Core
- Google-Mobile-Ads-SDK (= 7.26.0)
- Firebase/Core (4.7.0):
- Google-Mobile-Ads-SDK (= 7.27.0)
- Firebase/Core (4.8.0):
- FirebaseAnalytics (= 4.0.5)
- FirebaseCore (= 4.0.12)
- FirebaseCore (= 4.0.13)
- FirebaseAnalytics (4.0.5):
- FirebaseCore (~> 4.0)
- FirebaseInstanceID (~> 2.0)
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- nanopb (~> 0.3)
- FirebaseCore (4.0.12):
- FirebaseCore (4.0.13):
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- FirebaseInstanceID (2.0.7)
- Google-Mobile-Ads-SDK (7.26.0)
- FirebaseInstanceID (2.0.8):
- FirebaseCore (~> 4.0)
- Google-Mobile-Ads-SDK (7.27.0)
- GoogleToolboxForMac/Defines (2.1.3)
- GoogleToolboxForMac/NSData+zlib (2.1.3):
- GoogleToolboxForMac/Defines (= 2.1.3)
- MBProgressHUD (1.1.0)
- MNetAdSdk (1.2.3)
- MNetAdSdk (1.3.0)
- mopub-ios-sdk (4.12.0):
- mopub-ios-sdk/MoPubSDK (= 4.12.0)
- mopub-ios-sdk/MoPubSDK (4.12.0)
Expand Down Expand Up @@ -65,14 +66,14 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS:
AFNetworkActivityLogger: e77f68d014becb33c4306a23f56a64906ff72670
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
Firebase: dbfb98ccec2dcfcd21ab9cc1b4981a3f3c8c5e26
Firebase: 710decbbc6d9d48530e9a5dba3209740c3532e05
FirebaseAnalytics: 5b02a63ead2c3f0259cfc7f15e053e440587ecf8
FirebaseCore: 6cf108b63997bc08c04a1ffa55a3ac0d71a59ffc
FirebaseInstanceID: 148c25c986c8699e67304b114e365713dce467f2
Google-Mobile-Ads-SDK: 22d4a6fe18d526adcc12a86d8cc2d53872700966
FirebaseCore: 3c02ec652db3d03fdc8bc6d9154af3e20d64b6f5
FirebaseInstanceID: 81df5805a08001e69138664bdd02c6719a9ac80f
Google-Mobile-Ads-SDK: 83f7f890e638ce8f1debd440ea363338c9f6be3b
GoogleToolboxForMac: 2501e2ad72a52eb3dfe7bd9aee7dad11b858bd20
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
MNetAdSdk: 21534fdf64cb17b5448c10be1894046311b9c3dd
MNetAdSdk: 5c6fa4c081e0c72a8e24ac8e66e28c2851550cfb
mopub-ios-sdk: f1223e3f54a4ff68394f4fd9e42651801cf09704
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
Nocilla: 7af7a386071150cc8aa5da4da97d060f049dd61c
Expand Down
66 changes: 66 additions & 0 deletions Example/Tests/MNetContextLinkTests.m
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
76 changes: 76 additions & 0 deletions Example/Tests/MNetPulseRegulationTests.m
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
23 changes: 23 additions & 0 deletions Example/Tests/MNetTestBannerLoad.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,29 @@ - (void)testBannerAdUrlLoad{
}];
}

- (void)testContextLink{
validBannerAdUrlRequestStub([self class]);
stubPrefetchReq([self class]);
NSString *contextLink = @"https://media.net";

self.bannerAdViewExpectation = [self expectationWithDescription:@"Ad view loaded"];

MNetAdView *bannerAd = [[MNetAdView alloc] init];
[bannerAd setSize:MNET_BANNER_AD_SIZE];
[bannerAd setAdUnitId:DEMO_MN_AD_UNIT_320x50];
[bannerAd setRootViewController:[self getViewController]];
[bannerAd setContextLink:contextLink];
[bannerAd setDelegate:self];
[bannerAd loadAd];

[self waitForExpectationsWithTimeout:30 handler:^(NSError * _Nullable error) {
if(error){
NSLog(@"Test timed out! - %@", error);
}
}];
XCTAssertTrue([[bannerAd.adBaseObj fetchVCLink] isEqualToString:contextLink]);
}

-(void)mnetAdDidLoad:(MNetAdView *)adView{
EXPECTATION_FULFILL(self.bannerAdViewExpectation);
}
Expand Down
Loading

0 comments on commit b950509

Please sign in to comment.