summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/ManifestClassGenerator_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/java/ManifestClassGenerator_test.cpp')
-rw-r--r--tools/aapt2/java/ManifestClassGenerator_test.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/aapt2/java/ManifestClassGenerator_test.cpp b/tools/aapt2/java/ManifestClassGenerator_test.cpp
index ada563409d19..c324238d3ecb 100644
--- a/tools/aapt2/java/ManifestClassGenerator_test.cpp
+++ b/tools/aapt2/java/ManifestClassGenerator_test.cpp
@@ -16,8 +16,10 @@
#include "java/ManifestClassGenerator.h"
+#include "io/StringStream.h"
#include "test/Test.h"
+using ::aapt::io::StringOutputStream;
using ::testing::HasSubstr;
using ::testing::Not;
@@ -144,12 +146,9 @@ static ::testing::AssertionResult GetManifestClassText(IAaptContext* context, xm
return ::testing::AssertionFailure() << "manifest_class == nullptr";
}
- std::stringstream out;
- if (!manifest_class->WriteJavaFile(manifest_class.get(), "android", true, &out)) {
- return ::testing::AssertionFailure() << "failed to write java file";
- }
-
- *out_str = out.str();
+ StringOutputStream out(out_str);
+ manifest_class->WriteJavaFile(manifest_class.get(), "android", true, &out);
+ out.Flush();
return ::testing::AssertionSuccess();
}