class PortableUITest
Defined at line 30 of file ../../src/ui/testing/util/portable_ui_test.h
Public Members
static const auto kTestUIStack
static const auto kTestUIStackRef
Public Methods
void PortableUITest ()
Defined at line 35 of file ../../src/ui/testing/util/portable_ui_test.h
void PortableUITest (component_testing::RealmBuilder realm_builder)
Defined at line 36 of file ../../src/ui/testing/util/portable_ui_test.h
void SetUp ()
Defined at line 113 of file ../../src/ui/testing/util/portable_ui_test.cc
void TearDown ()
Defined at line 142 of file ../../src/ui/testing/util/portable_ui_test.cc
void LaunchClient ()
Attaches a client view to the scene, and waits for it to render.
Defined at line 210 of file ../../src/ui/testing/util/portable_ui_test.cc
void LaunchClientWithEmbeddedView ()
Attaches a client view that embeds a child view to the scene, and waits for
both to render.
Defined at line 235 of file ../../src/ui/testing/util/portable_ui_test.cc
void WaitForViewPresentation ()
Returns when a view has fully connected to the scene.
Defined at line 191 of file ../../src/ui/testing/util/portable_ui_test.cc
bool HasViewConnected (zx_koid_t view_ref_koid)
Returns true when the specified view is fully connected to the scene AND
has presented at least one frame of content.
Defined at line 198 of file ../../src/ui/testing/util/portable_ui_test.cc
Screenshot TakeScreenshot (ScreenshotFormat format)
Helper method to take a screenshot.
Defined at line 276 of file ../../src/ui/testing/util/portable_ui_test.cc
bool TakeScreenshotUntil (fit::function<bool (const ui_testing::Screenshot &)> predicate, zx::duration predicate_timeout, zx::duration step, ScreenshotFormat format)
Helper method to take a screenshot until predicate is true. Returns false if
|predicate_timeout| is reached.
Defined at line 296 of file ../../src/ui/testing/util/portable_ui_test.cc
fuchsia_math::SizeU display_size ()
Return display size by connecting to |fuchsia::ui::display::singleton::Info| protocol.
Defined at line 306 of file ../../src/ui/testing/util/portable_ui_test.cc
uint32_t display_height ()
Return display height by connecting to |fuchsia::ui::display::singleton::Info| protocol.
Defined at line 324 of file ../../src/ui/testing/util/portable_ui_test.cc
uint32_t display_width ()
Return display width by connecting to |fuchsia::ui::display::singleton::Info| protocol.
Defined at line 322 of file ../../src/ui/testing/util/portable_ui_test.cc
void RegisterTouchScreen ()
Registers a fake touch screen device with an injection coordinate space
spanning [-1000, 1000] on both axes.
Defined at line 326 of file ../../src/ui/testing/util/portable_ui_test.cc
void InjectTap (int32_t x, int32_t y)
Simulates a tap at location (x, y).
Defined at line 340 of file ../../src/ui/testing/util/portable_ui_test.cc
void InjectTapWithRetry (int32_t x, int32_t y)
Injects an input event, and posts a task to retry after `kTapRetryInterval`.
We post the retry task because the first input event we send to Flutter may be lost.
The reason the first event may be lost is that there is a race condition as the scene
owner starts up.
More specifically: in order for our app
to receive the injected input, two things must be true before we inject touch input:
* The Scenic root view must have been installed, and
* The Input Pipeline must have received a viewport to inject touch into.
The problem we have is that the `is_rendering` signal that we monitor only guarantees us
the view is ready. If the viewport is not ready in Input Pipeline at that time, it will
drop the touch event.
TODO(https://fxbug.dev/42179163): Improve synchronization and remove retry logic.
Defined at line 351 of file ../../src/ui/testing/util/portable_ui_test.cc
void InjectSwipe (int start_x, int start_y, int end_x, int end_y, int move_event_count)
Injects a swipe from the given starting location to the given end location
in injector coordinate space.
Defined at line 357 of file ../../src/ui/testing/util/portable_ui_test.cc
void InjectTouchEvent (fuchsia_input_report::TouchInputReport report)
Injects a touch event.
Defined at line 374 of file ../../src/ui/testing/util/portable_ui_test.cc
void RegisterMouse ()
Registers a fake mouse device, for which mouse movement is measured on a
scale of [-1000, 1000] on both axes and scroll is measured from [-100, 100]
on both axes.
Defined at line 383 of file ../../src/ui/testing/util/portable_ui_test.cc
void SimulateMouseEvent (const std::vector<fuchsia_ui_test_input::MouseButton> & pressed_buttons, int movement_x, int movement_y)
Helper method to simulate combinations of button presses/releases and/or
mouse movements.
Defined at line 395 of file ../../src/ui/testing/util/portable_ui_test.cc
void SimulateMouseScroll (const std::vector<fuchsia_ui_test_input::MouseButton> & pressed_buttons, int scroll_x, int scroll_y, bool use_physical_units)
Helper method to simulate a mouse scroll event.
Set `use_physical_units` to true to specify scroll in physical pixels and
false to specify scroll in detents.
Defined at line 404 of file ../../src/ui/testing/util/portable_ui_test.cc
void RegisterKeyboard ()
Register a fake keyboard.
Defined at line 424 of file ../../src/ui/testing/util/portable_ui_test.cc
void SimulateUsAsciiTextEntry (const std::string & str)
Helper method to simulate a string in us ascii to the fake keyboard.
Defined at line 436 of file ../../src/ui/testing/util/portable_ui_test.cc
Protected Methods
component_testing::RealmBuilder & realm_builder ()
Defined at line 130 of file ../../src/ui/testing/util/portable_ui_test.h
std::optional<component_testing::RealmRoot> & realm_root ()
Defined at line 131 of file ../../src/ui/testing/util/portable_ui_test.h
const std::optional<zx_koid_t> & client_root_view_ref_koid ()
Defined at line 133 of file ../../src/ui/testing/util/portable_ui_test.h
int touch_injection_request_count ()
Defined at line 135 of file ../../src/ui/testing/util/portable_ui_test.h
float device_pixel_ratio ()
Methods to control the test-ui-stack parameters. Override as necessary.
Defined at line 138 of file ../../src/ui/testing/util/portable_ui_test.h
uint32_t display_width_px ()
`display_width_px()` and `display_height_px()` must be either both zero
or both non-zero.
Defined at line 142 of file ../../src/ui/testing/util/portable_ui_test.h
uint32_t display_height_px ()
Defined at line 143 of file ../../src/ui/testing/util/portable_ui_test.h
uint32_t display_refresh_rate_millihertz ()
Defined at line 144 of file ../../src/ui/testing/util/portable_ui_test.h
uint32_t display_rotation ()
Defined at line 145 of file ../../src/ui/testing/util/portable_ui_test.h
bool suspend_enabled ()
Defined at line 146 of file ../../src/ui/testing/util/portable_ui_test.h