Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
a7d78963
Commit
a7d78963
authored
9 months ago
by
Parth Sane
Committed by
Gerrit Code Review
9 months ago
Browse files
Options
Downloads
Plain Diff
Merge "Add tests for ServiceManager Java Binder API" into main
parents
108b688e
0149ca4a
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
core/tests/coretests/src/android/os/BinderTest.java
+28
-0
28 additions, 0 deletions
core/tests/coretests/src/android/os/BinderTest.java
with
28 additions
and
0 deletions
core/tests/coretests/src/android/os/BinderTest.java
+
28
−
0
View file @
a7d78963
...
...
@@ -20,6 +20,8 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyBoolean
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyInt
;
import
static
org
.
testng
.
Assert
.
assertThrows
;
import
android.platform.test.annotations.IgnoreUnderRavenwood
;
...
...
@@ -27,6 +29,9 @@ import android.platform.test.ravenwood.RavenwoodRule;
import
androidx.test.filters.SmallTest
;
import
com.android.internal.os.BinderInternal
;
import
org.junit.Rule
;
import
org.junit.Test
;
...
...
@@ -81,4 +86,27 @@ public class BinderTest {
binder
.
setExtension
(
null
);
assertNull
(
binder
.
getExtension
());
}
@SmallTest
@Test
(
expected
=
java
.
lang
.
SecurityException
.
class
)
public
void
testServiceManagerNativeSecurityException
()
throws
RemoteException
{
// Find the service manager
IServiceManager
sServiceManager
=
ServiceManagerNative
.
asInterface
(
Binder
.
allowBlocking
(
BinderInternal
.
getContextObject
()));
Binder
binder
=
new
Binder
();
sServiceManager
.
addService
(
"ValidName"
,
binder
,
anyBoolean
(),
anyInt
());
}
@SmallTest
@Test
(
expected
=
java
.
lang
.
NullPointerException
.
class
)
public
void
testServiceManagerNativeNullptrException
()
throws
RemoteException
{
// Find the service manager
IServiceManager
sServiceManager
=
ServiceManagerNative
.
asInterface
(
Binder
.
allowBlocking
(
BinderInternal
.
getContextObject
()));
sServiceManager
.
addService
(
"ValidName"
,
null
,
anyBoolean
(),
anyInt
());
}
}
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