diff options
author | 2021-03-16 17:30:13 +0000 | |
---|---|---|
committer | 2021-03-17 16:10:56 +0000 | |
commit | 9ca14c19873e7ab65fcdeacec01179a29aa2a217 (patch) | |
tree | 1d2372e222172863a5f3585331291f6f253b8f2f /android/androidmk_test.go | |
parent | 854d661572988dc2692e08340ac48c667ba8c0bb (diff) |
Convert android/androidmk_test.go to test fixtures
Bug: 182885307
Test: m nothing
Change-Id: Ic3969988a6fa642be3e8fc23c8d008f13128b846
Diffstat (limited to 'android/androidmk_test.go')
-rw-r--r-- | android/androidmk_test.go | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/android/androidmk_test.go b/android/androidmk_test.go index 2f568fb13..230b1ec0b 100644 --- a/android/androidmk_test.go +++ b/android/androidmk_test.go @@ -141,21 +141,17 @@ func customModuleFactory() Module { // bp module and then returns the config and the custom module called "foo". func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *customModule) { t.Helper() - config := TestConfig(buildDir, nil, bp, nil) - config.katiEnabled = true // Enable androidmk Singleton - - ctx := NewTestContext(config) - ctx.RegisterSingletonType("androidmk", AndroidMkSingleton) - 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 + result := emptyTestFixtureFactory.RunTest(t, + // Enable androidmk Singleton + PrepareForTestWithAndroidMk, + FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.RegisterModuleType("custom", customModuleFactory) + }), + FixtureWithRootAndroidBp(bp), + ) + + module := result.ModuleForTests("foo", "").Module().(*customModule) + return result.TestContext, module } func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) { |