Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fc00df8
ad android method and add platform class
bparrishMines Nov 12, 2024
efc63c0
update platform class
bparrishMines Nov 12, 2024
ca5c47d
add app facing portion
bparrishMines Nov 12, 2024
70be676
android implementation
bparrishMines Nov 12, 2024
d0e0de9
ios implementation
bparrishMines Nov 12, 2024
c10c14f
fix android test
bparrishMines Nov 12, 2024
7f9a563
update app facing test
bparrishMines Nov 12, 2024
5b3e3ae
ios test
bparrishMines Nov 12, 2024
bae565f
version bump
bparrishMines Nov 12, 2024
e5abb39
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 12, 2024
3071bf5
fix up changelog
bparrishMines Nov 12, 2024
bf2a118
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 12, 2024
aa443bc
create new android and ios implementations
bparrishMines Nov 13, 2024
832d86e
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 13, 2024
efa6b2d
fix tests
bparrishMines Nov 13, 2024
63eabc3
fix lint and add comment
bparrishMines Nov 13, 2024
b69a9bd
add enable preloading to example
bparrishMines Nov 13, 2024
e7aaf61
update excerpts
bparrishMines Nov 13, 2024
4c8bc86
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 13, 2024
300a608
obey contract
bparrishMines Nov 14, 2024
b2abcd1
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 14, 2024
3b79dd0
use duration
bparrishMines Nov 14, 2024
e80a923
review comments
bparrishMines Nov 14, 2024
1e58518
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 14, 2024
9d85bf8
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 16, 2024
d9b81e6
fix lints
bparrishMines Nov 16, 2024
35e05c5
fix excerpts
bparrishMines Nov 16, 2024
aea49fe
add null clarification and doc fix
bparrishMines Nov 19, 2024
4b4bf9c
Merge branch 'main' of github.com:flutter/packages into ima_adsrendering
bparrishMines Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix android test
  • Loading branch information
bparrishMines committed Nov 12, 2024
commit c10c14f02d12aa113b14b4f2e07ac8b540bddfc6
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export 'src/platform_interface/platform_interface.dart'
AdErrorType,
AdEvent,
AdEventType,
AdsLoadErrorData;
AdsLoadErrorData,
UIElement;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AndroidAdsManager extends PlatformAdsManager {
}

final ima.AdsRenderingSettings androidSettings =
await ima.ImaSdkFactory.instance.createAdsRenderingSettings();
await _proxy.instanceImaSdkFactory().createAdsRenderingSettings();
await Future.wait(<Future<void>>[
if (settings.bitrate != null)
androidSettings.setBitrateKbps(settings.bitrate!),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ class _FakeImaSdkSettings_11 extends _i1.SmartFake
);
}

class _FakeImaSdkFactory_12 extends _i1.SmartFake implements _i2.ImaSdkFactory {
_FakeImaSdkFactory_12(
class _FakeAdsRenderingSettings_12 extends _i1.SmartFake
implements _i2.AdsRenderingSettings {
_FakeAdsRenderingSettings_12(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -163,8 +164,8 @@ class _FakeImaSdkFactory_12 extends _i1.SmartFake implements _i2.ImaSdkFactory {
);
}

class _FakeVideoAdPlayer_13 extends _i1.SmartFake implements _i2.VideoAdPlayer {
_FakeVideoAdPlayer_13(
class _FakeImaSdkFactory_13 extends _i1.SmartFake implements _i2.ImaSdkFactory {
_FakeImaSdkFactory_13(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -173,9 +174,19 @@ class _FakeVideoAdPlayer_13 extends _i1.SmartFake implements _i2.VideoAdPlayer {
);
}

class _FakeVideoAdPlayerCallback_14 extends _i1.SmartFake
class _FakeVideoAdPlayer_14 extends _i1.SmartFake implements _i2.VideoAdPlayer {
_FakeVideoAdPlayer_14(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}

class _FakeVideoAdPlayerCallback_15 extends _i1.SmartFake
implements _i2.VideoAdPlayerCallback {
_FakeVideoAdPlayerCallback_14(
_FakeVideoAdPlayerCallback_15(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -184,8 +195,8 @@ class _FakeVideoAdPlayerCallback_14 extends _i1.SmartFake
);
}

class _FakeVideoView_15 extends _i1.SmartFake implements _i2.VideoView {
_FakeVideoView_15(
class _FakeVideoView_16 extends _i1.SmartFake implements _i2.VideoView {
_FakeVideoView_16(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -194,8 +205,8 @@ class _FakeVideoView_15 extends _i1.SmartFake implements _i2.VideoView {
);
}

class _FakeOffset_16 extends _i1.SmartFake implements _i3.Offset {
_FakeOffset_16(
class _FakeOffset_17 extends _i1.SmartFake implements _i3.Offset {
_FakeOffset_17(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -204,8 +215,8 @@ class _FakeOffset_16 extends _i1.SmartFake implements _i3.Offset {
);
}

class _FakeSize_17 extends _i1.SmartFake implements _i3.Size {
_FakeSize_17(
class _FakeSize_18 extends _i1.SmartFake implements _i3.Size {
_FakeSize_18(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -214,9 +225,9 @@ class _FakeSize_17 extends _i1.SmartFake implements _i3.Size {
);
}

class _FakeExpensiveAndroidViewController_18 extends _i1.SmartFake
class _FakeExpensiveAndroidViewController_19 extends _i1.SmartFake
implements _i4.ExpensiveAndroidViewController {
_FakeExpensiveAndroidViewController_18(
_FakeExpensiveAndroidViewController_19(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -225,9 +236,9 @@ class _FakeExpensiveAndroidViewController_18 extends _i1.SmartFake
);
}

class _FakeSurfaceAndroidViewController_19 extends _i1.SmartFake
class _FakeSurfaceAndroidViewController_20 extends _i1.SmartFake
implements _i4.SurfaceAndroidViewController {
_FakeSurfaceAndroidViewController_19(
_FakeSurfaceAndroidViewController_20(
Object parent,
Invocation parentInvocation,
) : super(
Expand Down Expand Up @@ -1066,20 +1077,45 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory {
)),
) as _i6.Future<_i2.AdsRequest>);

@override
_i6.Future<_i2.AdsRenderingSettings> createAdsRenderingSettings() =>
(super.noSuchMethod(
Invocation.method(
#createAdsRenderingSettings,
[],
),
returnValue: _i6.Future<_i2.AdsRenderingSettings>.value(
_FakeAdsRenderingSettings_12(
this,
Invocation.method(
#createAdsRenderingSettings,
[],
),
)),
returnValueForMissingStub: _i6.Future<_i2.AdsRenderingSettings>.value(
_FakeAdsRenderingSettings_12(
this,
Invocation.method(
#createAdsRenderingSettings,
[],
),
)),
) as _i6.Future<_i2.AdsRenderingSettings>);

@override
_i2.ImaSdkFactory pigeon_copy() => (super.noSuchMethod(
Invocation.method(
#pigeon_copy,
[],
),
returnValue: _FakeImaSdkFactory_12(
returnValue: _FakeImaSdkFactory_13(
this,
Invocation.method(
#pigeon_copy,
[],
),
),
returnValueForMissingStub: _FakeImaSdkFactory_12(
returnValueForMissingStub: _FakeImaSdkFactory_13(
this,
Invocation.method(
#pigeon_copy,
Expand Down Expand Up @@ -1298,14 +1334,14 @@ class MockVideoAdPlayer extends _i1.Mock implements _i2.VideoAdPlayer {
#pigeon_copy,
[],
),
returnValue: _FakeVideoAdPlayer_13(
returnValue: _FakeVideoAdPlayer_14(
this,
Invocation.method(
#pigeon_copy,
[],
),
),
returnValueForMissingStub: _FakeVideoAdPlayer_13(
returnValueForMissingStub: _FakeVideoAdPlayer_14(
this,
Invocation.method(
#pigeon_copy,
Expand Down Expand Up @@ -1456,14 +1492,14 @@ class MockVideoAdPlayerCallback extends _i1.Mock
#pigeon_copy,
[],
),
returnValue: _FakeVideoAdPlayerCallback_14(
returnValue: _FakeVideoAdPlayerCallback_15(
this,
Invocation.method(
#pigeon_copy,
[],
),
),
returnValueForMissingStub: _FakeVideoAdPlayerCallback_14(
returnValueForMissingStub: _FakeVideoAdPlayerCallback_15(
this,
Invocation.method(
#pigeon_copy,
Expand Down Expand Up @@ -1543,14 +1579,14 @@ class MockVideoView extends _i1.Mock implements _i2.VideoView {
#pigeon_copy,
[],
),
returnValue: _FakeVideoView_15(
returnValue: _FakeVideoView_16(
this,
Invocation.method(
#pigeon_copy,
[],
),
),
returnValueForMissingStub: _FakeVideoView_15(
returnValueForMissingStub: _FakeVideoView_16(
this,
Invocation.method(
#pigeon_copy,
Expand Down Expand Up @@ -1589,11 +1625,11 @@ class MockSurfaceAndroidViewController extends _i1.Mock
@override
_i4.PointTransformer get pointTransformer => (super.noSuchMethod(
Invocation.getter(#pointTransformer),
returnValue: (_i3.Offset position) => _FakeOffset_16(
returnValue: (_i3.Offset position) => _FakeOffset_17(
this,
Invocation.getter(#pointTransformer),
),
returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_16(
returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_17(
this,
Invocation.getter(#pointTransformer),
),
Expand Down Expand Up @@ -1657,14 +1693,14 @@ class MockSurfaceAndroidViewController extends _i1.Mock
#setSize,
[size],
),
returnValue: _i6.Future<_i3.Size>.value(_FakeSize_17(
returnValue: _i6.Future<_i3.Size>.value(_FakeSize_18(
this,
Invocation.method(
#setSize,
[size],
),
)),
returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_17(
returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_18(
this,
Invocation.method(
#setSize,
Expand Down Expand Up @@ -1777,7 +1813,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock
#onFocus: onFocus,
},
),
returnValue: _FakeExpensiveAndroidViewController_18(
returnValue: _FakeExpensiveAndroidViewController_19(
this,
Invocation.method(
#initExpensiveAndroidView,
Expand All @@ -1792,7 +1828,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock
},
),
),
returnValueForMissingStub: _FakeExpensiveAndroidViewController_18(
returnValueForMissingStub: _FakeExpensiveAndroidViewController_19(
this,
Invocation.method(
#initExpensiveAndroidView,
Expand Down Expand Up @@ -1831,7 +1867,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock
#onFocus: onFocus,
},
),
returnValue: _FakeSurfaceAndroidViewController_19(
returnValue: _FakeSurfaceAndroidViewController_20(
this,
Invocation.method(
#initSurfaceAndroidView,
Expand All @@ -1846,7 +1882,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock
},
),
),
returnValueForMissingStub: _FakeSurfaceAndroidViewController_19(
returnValueForMissingStub: _FakeSurfaceAndroidViewController_20(
this,
Invocation.method(
#initSurfaceAndroidView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import 'ads_manager_test.mocks.dart';
MockSpec<ima.AdEvent>(),
MockSpec<ima.AdEventListener>(),
MockSpec<ima.AdsManager>(),
MockSpec<ima.AdsRenderingSettings>(),
MockSpec<ima.ImaSdkFactory>(),
])
void main() {
group('AndroidAdsManager', () {
Expand All @@ -32,12 +34,45 @@ void main() {
verify(mockAdsManager.destroy());
});

test('init', () {
test('init', () async {
final MockAdsManager mockAdsManager = MockAdsManager();
final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager);
adsManager.init(AdsManagerInitParams());

verify(mockAdsManager.init(null));
final MockImaSdkFactory mockImaSdkFactory = MockImaSdkFactory();
final MockAdsRenderingSettings mockAdsRenderingSettings =
MockAdsRenderingSettings();
when(mockImaSdkFactory.createAdsRenderingSettings()).thenAnswer(
(_) => Future<ima.AdsRenderingSettings>.value(mockAdsRenderingSettings),
);

final AndroidAdsManager adsManager = AndroidAdsManager(
mockAdsManager,
proxy: InteractiveMediaAdsProxy(
instanceImaSdkFactory: () => mockImaSdkFactory,
),
);

final PlatformAdsRenderingSettings settings =
PlatformAdsRenderingSettings(
bitrate: 1000,
enablePreloading: false,
loadVideoTimeout: 12,
mimeTypes: <String>['value'],
playAdsAfterTime: 2.0,
uiElements: <UIElement>{UIElement.countdown},
);
await adsManager.init(settings);

verifyInOrder(<Future<void>>[
mockAdsRenderingSettings.setBitrateKbps(1000),
mockAdsRenderingSettings.setEnablePreloading(false),
mockAdsRenderingSettings.setLoadVideoTimeout(12),
mockAdsRenderingSettings.setMimeTypes(<String>['value']),
mockAdsRenderingSettings.setPlayAdsAfterTime(2.0),
mockAdsRenderingSettings.setUiElements(
<ima.UiElement>[ima.UiElement.countdown],
),
mockAdsManager.init(mockAdsRenderingSettings),
]);
});

test('start', () {
Expand Down
Loading