Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Connectivity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Connectivity
Commits
5db1ea12
Commit
5db1ea12
authored
3 years ago
by
Junyu Lai
Committed by
Gerrit Code Review
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge "[MS44.2] Add unit test for API to query tagged UID summary"
parents
b209f64b
7ef0a175
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/java/android/app/usage/NetworkStatsManagerTest.java
+20
-0
20 additions, 0 deletions
.../unit/java/android/app/usage/NetworkStatsManagerTest.java
with
20 additions
and
0 deletions
tests/unit/java/android/app/usage/NetworkStatsManagerTest.java
+
20
−
0
View file @
5db1ea12
...
...
@@ -220,6 +220,26 @@ public class NetworkStatsManagerTest {
TEST_SUBSCRIBER_ID
));
}
@Test
public
void
testQueryTaggedSummary
()
throws
Exception
{
final
long
startTime
=
1
;
final
long
endTime
=
100
;
reset
(
mStatsSession
);
when
(
mService
.
openSessionForUsageStats
(
anyInt
(),
anyString
())).
thenReturn
(
mStatsSession
);
when
(
mStatsSession
.
getTaggedSummaryForAllUid
(
any
(
NetworkTemplate
.
class
),
anyLong
(),
anyLong
()))
.
thenReturn
(
new
android
.
net
.
NetworkStats
(
0
,
0
));
final
NetworkTemplate
template
=
new
NetworkTemplate
.
Builder
(
NetworkTemplate
.
MATCH_MOBILE
)
.
setMeteredness
(
NetworkStats
.
Bucket
.
METERED_YES
).
build
();
NetworkStats
stats
=
mManager
.
queryTaggedSummary
(
template
,
startTime
,
endTime
);
verify
(
mStatsSession
,
times
(
1
)).
getTaggedSummaryForAllUid
(
eq
(
template
),
eq
(
startTime
),
eq
(
endTime
));
assertFalse
(
stats
.
hasNextBucket
());
}
private
void
assertBucketMatches
(
Entry
expected
,
NetworkStats
.
Bucket
actual
)
{
assertEquals
(
expected
.
uid
,
actual
.
getUid
());
assertEquals
(
expected
.
rxBytes
,
actual
.
getRxBytes
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment