summaryrefslogtreecommitdiff
path: root/java/droidstubs_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-11-02 16:56:39 -0700
committer Colin Cross <ccross@android.com> 2023-12-03 17:22:56 -0800
commitf61d03d241334e355216e46fecb06a84e8626f8a (patch)
treeb0cb060a6bf37e655bd8362adc9bd8b94e4feb55 /java/droidstubs_test.go
parent5c1d5fb21b19d6bcc8b0f83bc68124c21b31fabc (diff)
Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in ContentFromFileRuleForTests in order to retrieve the file rule contents from the Config. Add it and update all the tests that use it in order to simply review of the next CL. Bug: 306029038 Test: go test ./... Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r--java/droidstubs_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index f86e1acef..7b89dded4 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -84,7 +84,7 @@ func TestDroidstubs(t *testing.T) {
for _, c := range testcases {
m := ctx.ModuleForTests(c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, manifest)
cmdline := String(sboxProto.Commands[0].Command)
android.AssertStringContainsEquals(t, "api-versions generation flag", cmdline, "--generate-api-levels", c.generate_xml)
if c.expectedJarFilename != "" {
@@ -133,7 +133,7 @@ func getAndroidJarPatternsForDroidstubs(t *testing.T, sdkType string) []string {
m := ctx.ModuleForTests("foo-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmd := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmd := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
r := regexp.MustCompile(`--android-jar-pattern [^ ]+/android.jar`)
return r.FindAllString(cmd, -1)
}
@@ -212,7 +212,7 @@ func TestDroidstubsSandbox(t *testing.T) {
t.Errorf("Expected inputs %q, got %q", w, g)
}
- manifest := android.RuleBuilderSboxProtoForTests(t, m.Output("metalava.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, ctx, m.Output("metalava.sbox.textproto"))
if g, w := manifest.Commands[0].GetCommand(), "reference __SBOX_SANDBOX_DIR__/out/.intermediates/foo/gen/foo.txt"; !strings.Contains(g, w) {
t.Errorf("Expected command to contain %q, got %q", w, g)
}
@@ -302,7 +302,7 @@ func TestDroidstubsWithSdkExtensions(t *testing.T) {
})
m := ctx.ModuleForTests("baz-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmdline := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "sdk-extensions-root present", cmdline, "--sdk-extensions-root sdk/extensions")
android.AssertStringDoesContain(t, "sdk-extensions-info present", cmdline, "--sdk-extensions-info sdk/extensions/info.txt")
}
@@ -434,6 +434,6 @@ func TestDroidstubsHideFlaggedApi(t *testing.T) {
m := result.ModuleForTests("foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--hide-annotation android.annotation.FlaggedApi")
}