blob: 126acf23264481aed9a07fe0defde5945ed48fad [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module crosapi.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
import "chromeos/crosapi/mojom/app_service_types.mojom";
[Stable, Extensible]
enum TouchEventType {
kUnknown = 0,
kPressed = 1,
kMoved = 2,
kReleased = 3,
// Touch events can be cancelled if mouse capture or touch capture changes in
// the middle of a gesture. For example, a long-press might change window or
// focus activation state in a way that cancels the gesture, even though the
// user has not released their finger. See ui::GestureRecognizer.
kCancelled = 4
};
// Augments a bool to include an 'unknown' value.
[Stable, Extensible]
enum OptionalBoolean {
[Default] kUnknown = 0,
kFalse,
kTrue,
};
// Implemented in lacros-chrome.
// Lets the Ash browser tests that require Lacros to send commands to this
// lacros-chrome instance.
// Next version: 2
// Next method id: 2
[Stable, Uuid="20e7f031-f4e1-4ad9-bd91-ad59eb8b1504"]
interface StandaloneBrowserTestController {
// Installs a test web app in lacros-chrome given a start URL and mode (open
// in a tab or window) and returns the ID of the installed app (see
// |web_app::GenerateAppId|).
InstallWebApp@0(string start_url, WindowMode mode) => (string app_id);
// Loads a fake extension in lacros-chrome, assigns it the given name and
// returns the ID of the loaded extension.
[MinVersion=1]
LoadVpnExtension@1(string extension_name) => (string extension_id);
};
// Allows callers running in lacros to trigger test events that are passed to
// the active Vpn configuration.
// See chrome/browser/lacros/vpn_provider_lacros_apitest.cc for details.
// Next version: 1
// Next method id: 2
[Stable, Uuid="e2bca22e-32e9-40b3-a0bc-035b41534496"]
interface TestShillController {
// Simulate |data| being received by the configuration determined by
// |extension_id| and |configuration_name|.
OnPacketReceived@0(string extension_id, string configuration_name,
array<uint8> data);
// Simulate |message| being received by the configuration determined by
// |extension_id| and |configuration_name|.
OnPlatformMessage@1(string extension_id, string configuration_name,
uint32 message);
};
// This interface is implemented by Ash-Chrome.
// This interface provides tests a mechanism to mutate or query ash.
// In the future, this interface may merge with an automation or a11y interface.
// Next version: 16
// Next method id: 25
[Stable, Uuid="1f93f9d7-e466-466c-a675-c21b48cf30d3"]
interface TestController {
// Clicks the middle of the views element identified by |element_name|.
[MinVersion=11]
ClickElement@20(string element_name) => (bool success);
// Clicks the middle of the window. Assumes that the window exists and is
// visible on screen. |window_id| should be obtained from
// PlatformWindow::GetWindowUniqueId(). A typical format might be:
// "org.chromium.lacros.9A82A161B2A0B9BADF75E9BB958B9FCB"
ClickWindow@1(string window_id);
// Checks whether an item with a given ID exists in the shelf.
[MinVersion=5]
DoesItemExistInShelf@9(string item_id) => (bool exists);
// Checks if ash is currently showing any views UI element with the given
// element_name.
[MinVersion=11]
DoesElementExist@19(string element_name) => (bool exists);
// Queries whether a window with the given |window_id| exists and is either
// visible or minimized. |window_id| should be obtained from
// PlatformWindow::GetWindowUniqueId(). A typical format might be:
// "org.chromium.lacros.9A82A161B2A0B9BADF75E9BB958B9FCB"
DoesWindowExist@0(string window_id) => (bool exist);
// Causes ash to enter or exit overview mode. The callback is invoked after
// overview mode is entered (and the animation is finished).
[MinVersion=1]
EnterOverviewMode@2() => ();
[MinVersion=1]
ExitOverviewMode@3() => ();
// Causes ash to enter tablet mode. The callback is invoked after animations
// are finished. Note that tablet mode cannot be activated if mouse devices
// are connected; the callback will run, but ash will not be in tablet mode.
[MinVersion=2]
EnterTabletMode@4() => ();
// Causes ash to exit tablet mode. The callback is invoked after animations
// are finished.
[MinVersion=2]
ExitTabletMode@5() => ();
// Gets the context menu for a shelf item. This assumes the item is already in
// the shelf.
[MinVersion=7]
GetContextMenuForShelfItem@13(string item_id) => (array<string> items);
// Returns the value of the ash::kMinimizeOnBackKey property for the given
// window.
// This allows the client (eg lacros) to verify assumptions eg whether
// the current active tab should react to a system wide back gesture.
//
// Note: For simplicity, the return callback is called with `true` in case
// the property is not set, of the window is not found.
[MinVersion=4]
GetMinimizeOnBackKeyWindowProperty@10(string window_id)
=> (OptionalBoolean value);
// Returns the position of a window's top-left corner in global "screen"
// coordinates in DIPs. By design, Wayland clients do not know the global
// position of their windows on the display. However, for window manager
// integration testing, some tests may need to assert a window is in a certain
// position (e.g. at the top of the display). Returns null if the window does
// not exist.
[MinVersion=3]
GetWindowPositionInScreen@8(string window_id) => (gfx.mojom.Point? position);
// Pins or unpins an item to the shelf. This assumes the item is already in
// the shelf. Returns |false| on any error.
[MinVersion=6]
PinOrUnpinItemInShelf@11(string item_id, bool pin) => (bool success);
// Select the context menu item for the shelf item with |item_id| at |index|.
// Returns false on any error.
[MinVersion=11]
SelectContextMenuForShelfItem@18(string item_id, uint32 index)
=> (bool success);
// Simulates a user left-clicking an item in the shelf. This assumes the item
// is already in the shelf. Returns |false| on any error.
[MinVersion=6]
SelectItemInShelf@12(string item_id) => (bool success);
// Creates a touch event and dispatches it to the window with |window_id|.
// Returns immediately if the window does not exist. The |pointer_id|
// specifies which touch-point is involved in a multi-touch gesture.
// |pointer_id| is typically 0, meaning the first touch-point, usually the
// index finger. |location_in_window| is in DIPs, in coordinates relative to
// the window origin with 0,0 representing top-left. Note that the location
// is a float, as some input devices report sub-pixel positions for touch
// events.
[MinVersion=3]
SendTouchEvent@7(string window_id, TouchEventType type, uint8 pointer_id,
gfx.mojom.PointF location_in_window) => ();
// Get the number of open Ash browser windows.
[MinVersion=8]
GetOpenAshBrowserWindows@14() => (uint32 number);
// Close all browser windows.
// Note: Usually there should be no Ash window open unless the test opened
// one.
[MinVersion=8]
CloseAllBrowserWindows@15() => (bool success);
// Register a lacros-chrome test controller with ash-chrome to let ash-chrome
// send commands to lacros-chrome.
[MinVersion=9] RegisterStandaloneBrowserTestController@16(
pending_remote<StandaloneBrowserTestController> controller);
// Provides a mechanism for lacros to tell ash to perform tab scrubbing.
[MinVersion=10]
TriggerTabScrubbing@17(float x_offset) => (bool scrubbing);
// Simulates a user always selecting the specified app from future
// Sharesheets.
[MinVersion=12]
SetSelectedSharesheetApp@21(string app_id) => ();
// Returns the version of ash-chrome, e.g. "103.0.5029.0". The returned string
// is intended to be compatible with the base::Version(StringPiece)
// constructor.
// Consider using the convenience wrapper
// lacros_test_helper.h:IsAshVersionAtLeastForTesting instead.
// Introduced in M-103.
[MinVersion=13]
GetAshVersion@22() => (string ash_version);
// Binds |test_shill_controller| that can be used to simulate packet/message
// events.
[MinVersion=14]
BindTestShillController@23(
pending_receiver<TestShillController> test_shill_controller) => ();
// Creates and then cancels a print job.
[MinVersion=15]
CreateAndCancelPrintJob@24(string job_title) => ();
};