(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestSettingDebuggableFlag(t *testing.T) { |
| 26 | assert := assert.To(t) |
| 27 | for _, fn := range []string{ |
| 28 | "testdata/manifest1.binxml", |
| 29 | "testdata/manifest2.binxml", |
| 30 | "testdata/manifest4.binxml", |
| 31 | "testdata/manifest6.binxml", |
| 32 | } { |
| 33 | originalData, err := ioutil.ReadFile(fn) |
| 34 | assert.For("err").ThatError(err).Succeeded() |
| 35 | |
| 36 | tree, err := decodeXmlTree(bytes.NewReader(originalData)) |
| 37 | assert.For("err").ThatError(err).Succeeded() |
| 38 | |
| 39 | assert.For("xml").ThatString(tree.toXmlString()).DoesNotContain(`android:debuggable="true"`) |
| 40 | setManifestApplicationDebuggableAttributeToTrue(tree) |
| 41 | |
| 42 | xmlString := tree.toXmlString() |
| 43 | assert.For("xml").ThatString(xmlString).Contains(`android:debuggable="true"`) |
| 44 | |
| 45 | // Make sure we haven't broken the binary representation and that it still parses after the change. |
| 46 | _, err = decodeXmlTree(bytes.NewReader(tree.encode())) |
| 47 | assert.For("err").ThatError(err).Succeeded() |
| 48 | } |
| 49 | } |
nothing calls this directly
no test coverage detected