Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f71e4ed3 authored by Paul Duffin's avatar Paul Duffin
Browse files

Remove uses of buildDir from java/app_set_test.go

Remove any uses, either direct (or indirect via testJavaConfig or
similar methods), of the package level buildDir variable from this
file.

Bug: 182885307
Test: m nothing
Change-Id: I64b13dcb310e0a0a2049b5e3b0ea0115e7e9c2f5
parent fb8bc951
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package java

import (
	"fmt"
	"reflect"
	"testing"

@@ -96,20 +97,24 @@ func TestAndroidAppSet_Variants(t *testing.T) {
	}

	for _, test := range testCases {
		config := testAppConfig(nil, bp, nil)
		config.TestProductVariables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI
		config.TestProductVariables.Platform_sdk_version = &test.sdkVersion
		ctx := android.GroupFixturePreparers(
			PrepareForTestWithJavaDefaultModules,
			android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
				variables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI
				variables.Platform_sdk_version = &test.sdkVersion
			}),
			android.FixtureModifyConfig(func(config android.Config) {
				config.Targets[android.Android] = test.targets
		ctx := testContext(config)
		run(t, ctx, config)
			}),
		).RunTestWithBp(t, bp)

		module := ctx.ModuleForTests("foo", "android_common")
		const packedSplitApks = "foo.zip"
		params := module.Output(packedSplitApks)
		for k, v := range test.expected {
			if actual := params.Args[k]; actual != v {
				t.Errorf("%s: bad build arg value for '%s': '%s', expected '%s'",
					test.name, k, actual, v)
			}
			t.Run(test.name, func(t *testing.T) {
				android.AssertStringEquals(t, fmt.Sprintf("arg value for `%s`", k), v, params.Args[k])
			})
		}
	}
}