Convert JavaSdkLibrary... tests in java package to test fixtures

These tests rely on files provided by javaMockFS() so need to are being
converted to test fixtures to allow them to remove that dependency
which will allow javaMockFS() to be removed.

Bug: 182638834
Test: m nothing
Change-Id: If736b95d134fe73c0a0ccd438ec31e93568fb929
This commit is contained in:
Paul Duffin
2021-03-12 19:15:01 +00:00
parent 2002bfa817
commit 22b77cd538
2 changed files with 125 additions and 139 deletions

View File

@@ -135,7 +135,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
}
func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
ctx, _ := testJava(t, `
result := javaFixtureFactory.RunTestWithBp(t, `
java_sdk_library {
name: "foo-shared_library",
srcs: ["a.java"],
@@ -148,7 +148,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
`)
// Verify the existence of internal modules
ctx.ModuleForTests("foo-shared_library.xml", "android_common")
result.ModuleForTests("foo-shared_library.xml", "android_common")
testCases := []struct {
moduleName string
@@ -158,8 +158,8 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
{"foo-no_shared_library", nil},
}
for _, tc := range testCases {
mod := ctx.ModuleForTests(tc.moduleName, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
mod := result.ModuleForTests(tc.moduleName, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
if !reflect.DeepEqual(tc.expected, actual) {
t.Errorf("Unexpected required modules - expected: %q, actual: %q", tc.expected, actual)