Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove residual logs #41

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public boolean hasNext() {

@Override
public AndroidResource next() {
System.out.println(zipEntry);
byte[] entryData;
try {
entryData = readAllBytes(baseSplitZipStream);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.google.wear.watchface.dfx.memory;

import static com.google.common.truth.Truth.assertThat;
import static com.google.wear.watchface.dfx.memory.EvaluationSettings.parseFromArguments;
import static com.google.wear.watchface.dfx.memory.ResourceMemoryEvaluator.evaluateMemoryFootprint;
import static com.google.wear.watchface.dfx.memory.ResourceMemoryEvaluator.evaluateWatchFaceForLayout;
Expand All @@ -12,9 +13,12 @@

import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.samsung.watchface.WatchFaceXmlValidator;
import java.io.File;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -1266,6 +1270,26 @@ public void evaluateWatchFaceForLayout_handlesHoneyfaceWatchFaces() throws Excep
}
}

@Test
public void main_writesJsonInReportMode() {
ByteArrayOutputStream outStreamCaptor = new ByteArrayOutputStream();
PrintStream old = System.out;
System.setOut(new PrintStream(outStreamCaptor));
String watchFacePath =
Paths.get(SAMPLE_WF_BASE_ARTIFACTS_PATH, "bundle/release/sample-wf-release.aab")
.toString();

ResourceMemoryEvaluator.main(
new String[] {
"--watch-face", watchFacePath, "--schema-version", "1", "--report"
});
System.out.flush();
System.setOut(old);

JsonElement jsonElement = JsonParser.parseString(outStreamCaptor.toString());
assertThat(jsonElement.isJsonObject()).isTrue();
}

private static void putSimpleResource(
Map<String, DrawableResourceDetails> map, String resourceName, long size) {
map.put(
Expand All @@ -1282,22 +1306,6 @@ private static void putSimpleResource(
}
}

/**
* Utility function that resolves the given watch face module name to its path in the built
* artifacts. These artifacts are built in gradle by making the "test" task depend on the watch
* face module's "assembleRelease" task.
*/
private static String resolveWatchFaceModuleAabPath(String watchFaceModule) {
return new File("")
.getAbsoluteFile()
.toPath()
.resolve(
String.format(
"../../samples/%1$s/build/outputs/bundle/release/%1$s-release.aab",
watchFaceModule))
.toString();
}

private static EvaluationSettings getTestEvaluationSettings() {
return new EvaluationSettings("", "");
}
Expand Down
Loading