|
static synchronized void | onCreate () |
|
static synchronized void | finish () |
|
static synchronized void | writeFile ( @NonNull String filename, @NonNull CountDownLatch latch) |
|
static void | capture (@NonNull TestableFlutterActivity activity, @NonNull String captureName) throws Exception |
|
Allows to capture screenshots, and transfers the screenshots to the host where they can be further proccessed. On a LUCI environment, the screenshots are sent to Skia Gold.
Definition at line 22 of file ScreenshotUtil.java.
◆ capture()
static void dev.flutter.scenariosui.ScreenshotUtil.capture |
( |
@NonNull TestableFlutterActivity |
activity, |
|
|
@NonNull String |
captureName |
|
) |
| throws Exception |
|
inlinestatic |
Captures a screenshot of the activity, and sends the screenshot bytes to the host where it is further processed.
The activity must be already launched.
- Parameters
-
activity | The target activity. |
fileName | The name of the file. |
Definition at line 125 of file ScreenshotUtil.java.
126 {
127 CountDownLatch latch = new CountDownLatch(1);
128 activity.waitUntilFlutterRendered();
129 ScreenshotUtil.writeFile(captureName, latch);
130 latch.await();
131 }
◆ finish()
static synchronized void dev.flutter.scenariosui.ScreenshotUtil.finish |
( |
| ) |
|
|
inlinestatic |
Closes the connection with the host.
Definition at line 80 of file ScreenshotUtil.java.
80 {
81 if (executor != null && conn != null) {
82 executor.execute(
83 () -> {
84 try {
85 conn.close();
86 conn = null;
87 } catch (IOException e) {
88 throw new RuntimeException(e);
89 }
90 });
91 }
92 }
◆ onCreate()
static synchronized void dev.flutter.scenariosui.ScreenshotUtil.onCreate |
( |
| ) |
|
|
inlinestatic |
Starts the connection with the host.
Definition at line 62 of file ScreenshotUtil.java.
62 {
63 if (executor == null) {
64 executor = Executors.newSingleThreadExecutor();
65 }
66 if (conn == null) {
67 executor.execute(
68 () -> {
69 try {
70 final Socket socket = new Socket(HOST, PORT);
71 conn = new Connection(socket);
72 } catch (IOException e) {
73 throw new RuntimeException(e);
74 }
75 });
76 }
77 }
◆ writeFile()
static synchronized void dev.flutter.scenariosui.ScreenshotUtil.writeFile |
( |
@NonNull String |
filename, |
|
|
@NonNull CountDownLatch |
latch |
|
) |
| |
|
inlinestatic |
Sends the file to the host.
- Parameters
-
filename | The file name. |
fileContent | The file content. |
Definition at line 100 of file ScreenshotUtil.java.
101 {
102 if (executor != null && conn != null) {
103 executor.execute(
104 () -> {
105 try {
106 conn.writeFile(filename);
107 } catch (IOException e) {
108 throw new RuntimeException(e);
109 } finally {
110 latch.countDown();
111 }
112 });
113 }
114 }
The documentation for this class was generated from the following file:
- testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ScreenshotUtil.java