class UITestManager

Defined at line 31 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.h

Library class to manage test realm and scene setup on behalf of UI

integration test clients.

Public Methods

void ~UITestManager ()

Defined at line 34 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.h

void UITestManager (UITestRealm::Config config)

Defined at line 39 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

component_testing::Realm AddSubrealm ()

Adds a child to the realm under construction, and returns the new child.

Must NOT be called after BuildRealm().

Defined at line 45 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

void BuildRealm ()

Calls realm_builder_.Build();

Defined at line 47 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

void TeardownRealm (component_testing::ScopedChild::TeardownCallback on_teardown_complete)

Calls realm_.Teardown();

Defined at line 91 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

std::unique_ptr<sys::ServiceDirectory> CloneExposedServicesDirectory ()

Returns a clone of the realm's exposed services directory.

Clients should call this method once, and retain the handle returned.

MUST be called AFTER BuildRealm().

Defined at line 96 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

void InitializeScene ()

Creates the root of the scene (either via scene manager or by direct

construction), and attaches the client view via

fuchsia.ui.app.ViewProvider.

MUST be called AFTER BuildRealm().

`use_scene_provider` indicates whether UITestManager should use

`fuchsia.ui.test.scene.Controller` to initialize the scene, or use the raw

scene manager APIs.

Defined at line 100 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

std::optional<zx_koid_t> ClientViewRefKoid ()

Returns the view ref koid of the client view if it's available, and false

otherwise.

NOTE: Different scene owners have different policies about client view

refs, so users should NOT use this method as a proxy for determining that

the client view is attached to the scene. Use |ClientViewIsRendering| for

that purpose.

Defined at line 221 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

bool ClientViewIsRendering ()

Convenience method to inform the client if its view is rendering.

Syntactic sugar for `ViewIsRendering(ClientViewRefKoid())`.

Returns true if the client's view ref koid is present in the most recent

view tree snapshot received from scenic.

Defined at line 177 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

bool ClientViewIsFocused ()

Convenience method to inform the client if its view is focused.

Defined at line 185 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

bool ViewIsFocused (zx_koid_t view_ref_koid)

Convenience method to inform if a view is focused by its koid.

Defined at line 189 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

float ClientViewScaleFactor ()

Convenience method that returns the scale factor applied to the client view.

Defined at line 205 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

bool ViewIsRendering (zx_koid_t view_ref_koid)

Convenience method to inform the client if the view specified by

`view_ref_koid` is rendering content.

Returns true if `view_ref_koid` is present in the most recent view tree

snapshot received from scenic.

Defined at line 164 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

std::optional<fuchsia::ui::observation::geometry::ViewDescriptor> FindViewFromSnapshotByKoid (zx_koid_t view_ref_koid)

Attempts to find the `ViewDescriptor` for a view with `view_ref_koid` in the most recent

`ViewTreeSnapshot`.

Returns the descriptor if it is found, or `std::nullopt` if no view with the given

`view_ref_koid` could be found.

Defined at line 172 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

std::pair<uint64_t, uint64_t> GetDisplayDimensions ()

Returns the width and height of the display in pixels as returned by

|fuchsia.ui.display.singleton| protocol.

Defined at line 110 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc

Screenshot TakeScreenshot (ScreenshotFormat format)

Takes a screenshot using the |fuchsia.ui.composition.Screenshot| protocol, converts it into

|ui_testing::Screenshot| and returns it. Note that this is a blocking call i.e the client has

to wait until |fuchsia.ui.composition.Screenshot.Take| finishes execution.

Defined at line 114 of file ../../src/ui/testing/ui_test_manager/ui_test_manager.cc