Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a8e6894a
authored
Oct 21, 2022
by
bachinger
Committed by
Rohit Singh
Oct 24, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add DAI specific methods to AdPlaybackState
PiperOrigin-RevId: 482755468
parent
fd2ba37b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
library/common/src/main/java/com/google/android/exoplayer2/source/ads/AdPlaybackState.java
library/common/src/test/java/com/google/android/exoplayer2/source/ads/AdPlaybackStateTest.java
library/common/src/main/java/com/google/android/exoplayer2/source/ads/AdPlaybackState.java
View file @
a8e6894a
This diff is collapsed.
Click to expand it.
library/common/src/test/java/com/google/android/exoplayer2/source/ads/AdPlaybackStateTest.java
View file @
a8e6894a
...
...
@@ -313,6 +313,51 @@ public class AdPlaybackStateTest {
}
@Test
public
void
withOriginalAdCount
()
{
AdPlaybackState
state
=
new
AdPlaybackState
(
TEST_ADS_ID
,
/* adGroupTimesUs...= */
5_000_000
)
.
withAdCount
(
/* adGroupIndex= */
0
,
/* adCount= */
2
);
state
=
state
.
withOriginalAdCount
(
/* adGroupIndex= */
0
,
/* originalAdCount= */
3
);
assertThat
(
state
.
getAdGroup
(
0
).
count
).
isEqualTo
(
2
);
assertThat
(
state
.
getAdGroup
(
0
).
originalCount
).
isEqualTo
(
3
);
}
@Test
public
void
withOriginalAdCount_unsetValue_defaultsToIndexUnset
()
{
AdPlaybackState
state
=
new
AdPlaybackState
(
TEST_ADS_ID
,
/* adGroupTimesUs...= */
5_000_000
)
.
withAdCount
(
/* adGroupIndex= */
0
,
/* adCount= */
2
);
assertThat
(
state
.
getAdGroup
(
0
).
count
).
isEqualTo
(
2
);
assertThat
(
state
.
getAdGroup
(
0
).
originalCount
).
isEqualTo
(
C
.
INDEX_UNSET
);
}
@Test
public
void
withLastAdGroupRemoved
()
{
AdPlaybackState
state
=
new
AdPlaybackState
(
TEST_ADS_ID
,
/* adGroupTimesUs...= */
5_000_000
);
state
=
state
.
withAdCount
(
/* adGroupIndex= */
0
,
3
)
.
withAdDurationsUs
(
/* adGroupIndex= */
0
,
10_000L
,
20_000L
,
30_000L
)
.
withPlayedAd
(
/* adGroupIndex= */
0
,
/* adIndexInAdGroup= */
0
)
.
withPlayedAd
(
/* adGroupIndex= */
0
,
/* adIndexInAdGroup= */
1
)
.
withIsServerSideInserted
(
/* adGroupIndex= */
0
,
true
);
state
=
state
.
withLastAdRemoved
(
0
);
assertThat
(
state
.
getAdGroup
(
/* adGroupIndex= */
0
).
states
).
asList
().
hasSize
(
2
);
assertThat
(
state
.
getAdGroup
(
/* adGroupIndex= */
0
).
durationsUs
)
.
asList
()
.
containsExactly
(
10_000L
,
20_000L
)
.
inOrder
();
assertThat
(
state
.
getAdGroup
(
/* adGroupIndex= */
0
).
states
)
.
asList
()
.
containsExactly
(
AD_STATE_PLAYED
,
AD_STATE_PLAYED
);
}
@Test
public
void
withResetAdGroup_resetsAdsInFinalStates
()
{
AdPlaybackState
state
=
new
AdPlaybackState
(
TEST_ADS_ID
,
TEST_AD_GROUP_TIMES_US
);
state
=
state
.
withAdCount
(
/* adGroupIndex= */
1
,
/* adCount= */
5
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment