From e846c67f899ec9e3e4cbc4ef24cf2453436874c2 Mon Sep 17 00:00:00 2001 From: Aldo Becerril Date: Tue, 19 Dec 2023 09:11:51 -0800 Subject: [PATCH] Updated iOS tests --- .../FLTGoogleMobileAdsPluginMethodCallsTest.m | 11 +++++++---- .../FLTGoogleMobileAdsReaderWriterTest.m | 13 ++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsPluginMethodCallsTest.m b/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsPluginMethodCallsTest.m index bc405cd38..732963500 100644 --- a/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsPluginMethodCallsTest.m +++ b/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsPluginMethodCallsTest.m @@ -171,7 +171,7 @@ - (void)testSetSameAppKeyEnabledYes { XCTAssertTrue(resultInvoked); XCTAssertNil(returnedResult); OCMVerify([gadRequestConfigurationMock - setSameAppKeyEnabled:[OCMArg isEqual:@(YES)]]); + setPublisherFirstPartyIDEnabled:[OCMArg isEqual:@(YES)]]); } - (void)testRegisterWebView { @@ -226,7 +226,8 @@ - (void)testSetSameAppKeyEnabledNo { XCTAssertTrue(resultInvoked); XCTAssertNil(returnedResult); - OCMVerify([gadRequestConfigurationMock setSameAppKeyEnabled:NO]); + OCMVerify( + [gadRequestConfigurationMock setPublisherFirstPartyIDEnabled:NO]); FlutterMethodCall *methodCallWithBool = [FlutterMethodCall methodCallWithMethodName:@"MobileAds#setSameAppKeyEnabled" @@ -244,7 +245,8 @@ - (void)testSetSameAppKeyEnabledNo { XCTAssertTrue(resultInvokedWithBool); XCTAssertNil(returnedResultWithBool); - OCMVerify([gadRequestConfigurationMock setSameAppKeyEnabled:NO]); + OCMVerify( + [gadRequestConfigurationMock setPublisherFirstPartyIDEnabled:NO]); } - (void)testSetAppMuted { @@ -361,7 +363,8 @@ - (void)testGetVersionString { [_fltGoogleMobileAdsPlugin handleMethodCall:methodCall result:result]; XCTAssertTrue(resultInvoked); - XCTAssertEqual(returnedResult, [GADMobileAds.sharedInstance sdkVersion]); + XCTAssertEqual(returnedResult, + GADGetStringFromVersionNumber(GADMobileAds.sharedInstance.versionNumber)); } - (void)testOpenDebugMenu { diff --git a/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsReaderWriterTest.m b/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsReaderWriterTest.m index 845b984fe..3699deba0 100644 --- a/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsReaderWriterTest.m +++ b/packages/google_mobile_ads/example/ios/RunnerTests/FLTGoogleMobileAdsReaderWriterTest.m @@ -63,9 +63,10 @@ - (void)testEncodeDecodeRequestConfiguration { GADRequestConfiguration *requestConfiguration = [GADRequestConfiguration alloc]; requestConfiguration.maxAdContentRating = GADMaxAdContentRatingMatureAudience; - [GADMobileAds.sharedInstance.requestConfiguration - tagForChildDirectedTreatment:YES]; - [GADMobileAds.sharedInstance.requestConfiguration tagForUnderAgeOfConsent:NO]; + GADMobileAds.sharedInstance.requestConfiguration + .tagForChildDirectedTreatment = @YES; + GADMobileAds.sharedInstance.requestConfiguration + .tagForUnderAgeOfConsent = @NO; NSArray *testDeviceIds = [[NSArray alloc] initWithObjects:@"test-device-id", nil]; requestConfiguration.testDeviceIdentifiers = testDeviceIds; @@ -383,7 +384,8 @@ - (void)testEncodeDecodeFLTGADLoadError { NSString *identifier = @"test-identifier"; NSString *className = @"test-class-name"; OCMStub([mockResponseInfo responseIdentifier]).andReturn(identifier); - OCMStub([mockResponseInfo adNetworkClassName]).andReturn(className); + OCMStub(mockResponseInfo.loadedAdNetworkResponseInfo.adNetworkClassName) + .andReturn(className); NSDictionary *userInfo = @{ NSLocalizedDescriptionKey : @"message", GADErrorUserInfoKeyResponseInfo : mockResponseInfo @@ -413,7 +415,8 @@ - (void)testEncodeDecodeFLTGADLoadErrorWithResponseInfo { NSString *identifier = @"test-identifier"; NSString *className = @"test-class-name"; OCMStub([mockResponseInfo responseIdentifier]).andReturn(identifier); - OCMStub([mockResponseInfo adNetworkClassName]).andReturn(className); + OCMStub(mockResponseInfo.loadedAdNetworkResponseInfo.adNetworkClassName) + .andReturn(className); OCMStub([mockResponseInfo adNetworkInfoArray]).andReturn(@[ mockNetworkResponse ]);