From 230a1baa614b2f868f64604f743c5e7e5f6a844f Mon Sep 17 00:00:00 2001 From: Aldo Becerril Date: Thu, 18 Jan 2024 11:29:34 -0800 Subject: [PATCH] Added the mediation folder to the pubignore file --- packages/google_mobile_ads/.pubignore | 1 + .../gma_mediation_unity/pubspec.yaml | 5 ++-- .../test/unity_method_channel_test.dart | 30 +++++++++++++++---- .../gma_mediation_unity/test/unity_test.dart | 6 ++-- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/packages/google_mobile_ads/.pubignore b/packages/google_mobile_ads/.pubignore index 6f7c5c20d..a4e81de1f 100644 --- a/packages/google_mobile_ads/.pubignore +++ b/packages/google_mobile_ads/.pubignore @@ -1 +1,2 @@ +# Mediation packages are published independently mediation/ diff --git a/packages/google_mobile_ads/mediation/gma_mediation_unity/pubspec.yaml b/packages/google_mobile_ads/mediation/gma_mediation_unity/pubspec.yaml index 5641a9232..e99cfae3b 100644 --- a/packages/google_mobile_ads/mediation/gma_mediation_unity/pubspec.yaml +++ b/packages/google_mobile_ads/mediation/gma_mediation_unity/pubspec.yaml @@ -1,6 +1,6 @@ name: gma_mediation_unity description: "Mediation Adapter for Unity Ads to use with Google Mobile Ads." -version: 1.0.0-alpha.1 +version: 1.0.0 repository: https://github.com/googleads/googleads-mobile-flutter/tree/main/packages/google_mobile_ads/mediation environment: @@ -10,8 +10,7 @@ environment: dependencies: flutter: sdk: flutter - google_mobile_ads: - path: ../../ + google_mobile_ads: ^4.0.0 plugin_platform_interface: ^2.0.2 dev_dependencies: diff --git a/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_method_channel_test.dart b/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_method_channel_test.dart index 74fde9851..2de428e84 100644 --- a/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_method_channel_test.dart +++ b/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_method_channel_test.dart @@ -1,24 +1,44 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:unity/unity_method_channel.dart'; +import 'package:gma_mediation_unity/unity_adapter.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - MethodChannelUnity platform = MethodChannelUnity(); + final List log = []; const MethodChannel channel = MethodChannel('unity'); setUp(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( + log.clear(); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( channel, (MethodCall methodCall) async { - return '42'; + log.add(methodCall); + switch (methodCall.method) { + case 'setGDPRConsent': + case 'setCCPAConsent': + return null; + default: + assert(false); + return null; + } }, ); }); tearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(channel, null); }); + test('$UnityAdapter.setGDPRConsent', () async { + UnityAdapter.setGDPRConsent(true); + UnityAdapter.setGDPRConsent(false); + + expect(log, [ + isMethodCall('setGDPRConsent', arguments: {'gdprConsent': true}), + isMethodCall('setGDPRConsent', arguments: {'gdprConsent': false}) + ]); + }); } diff --git a/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_test.dart b/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_test.dart index 7d2e2f021..b0820d0ab 100644 --- a/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_test.dart +++ b/packages/google_mobile_ads/mediation/gma_mediation_unity/test/unity_test.dart @@ -1,7 +1,7 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:unity/unity_adapter.dart'; -import 'package:unity/unity_platform_interface.dart'; -import 'package:unity/unity_method_channel.dart'; +import 'package:gma_mediation_unity/unity_adapter.dart'; +import 'package:gma_mediation_unity/unity_platform_interface.dart'; +import 'package:gma_mediation_unity/unity_method_channel.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; class MockUnityPlatform