Convert android/androidmk_test.go to test fixtures
Bug: 182885307 Test: m nothing Change-Id: Ic3969988a6fa642be3e8fc23c8d008f13128b846
This commit is contained in:
@@ -141,21 +141,17 @@ func customModuleFactory() Module {
|
|||||||
// bp module and then returns the config and the custom module called "foo".
|
// bp module and then returns the config and the custom module called "foo".
|
||||||
func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *customModule) {
|
func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *customModule) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(buildDir, nil, bp, nil)
|
result := emptyTestFixtureFactory.RunTest(t,
|
||||||
config.katiEnabled = true // Enable androidmk Singleton
|
// Enable androidmk Singleton
|
||||||
|
PrepareForTestWithAndroidMk,
|
||||||
|
FixtureRegisterWithContext(func(ctx RegistrationContext) {
|
||||||
|
ctx.RegisterModuleType("custom", customModuleFactory)
|
||||||
|
}),
|
||||||
|
FixtureWithRootAndroidBp(bp),
|
||||||
|
)
|
||||||
|
|
||||||
ctx := NewTestContext(config)
|
module := result.ModuleForTests("foo", "").Module().(*customModule)
|
||||||
ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
|
return result.TestContext, module
|
||||||
ctx.RegisterModuleType("custom", customModuleFactory)
|
|
||||||
ctx.Register()
|
|
||||||
|
|
||||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
|
||||||
FailIfErrored(t, errs)
|
|
||||||
_, errs = ctx.PrepareBuildActions(config)
|
|
||||||
FailIfErrored(t, errs)
|
|
||||||
|
|
||||||
module := ctx.ModuleForTests("foo", "").Module().(*customModule)
|
|
||||||
return ctx, module
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
|
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user