blob: 69c6a859272310c24883dbb11729912872337256 [file] [log] [blame]
// Copyright (c) 2012 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.
// API for integration testing. To be used on test images with a test component
// extension.
namespace autotestPrivate {
enum ShelfAlignmentType {
Bottom, Left, Right, BottomLocked
dictionary LoginStatusDict {
// Are we logged in?
boolean isLoggedIn;
// Is the logged-in user the owner?
boolean isOwner;
// Is the screen locked?
boolean isScreenLocked;
// Is the screen ready for password?
boolean isReadyForPassword;
// Is the logged-in user a regular user?
boolean isRegularUser;
// Are we logged into the guest account?
boolean isGuest;
// Are we logged into kiosk-app mode?
boolean isKiosk;
DOMString email;
DOMString displayEmail;
// User image: 'file', 'profile' or a number.
DOMString userImage;
callback LoginStatusCallback = void (LoginStatusDict status);
dictionary ExtensionInfoDict {
DOMString id;
DOMString version;
DOMString name;
DOMString publicKey;
DOMString description;
DOMString backgroundUrl;
DOMString optionsUrl;
DOMString[] hostPermissions;
DOMString[] effectiveHostPermissions;
DOMString[] apiPermissions;
boolean isComponent;
boolean isInternal;
boolean isUserInstalled;
boolean isEnabled;
boolean allowedInIncognito;
boolean hasPageAction;
dictionary ExtensionsInfoArray {
ExtensionInfoDict[] extensions;
callback ExtensionsInfoCallback = void (ExtensionsInfoArray info);
dictionary Notification {
DOMString id;
DOMString type;
DOMString title;
DOMString message;
long priority;
long progress;
callback NotificationArrayCallback = void (Notification[] notifications);
dictionary Printer {
DOMString printerName;
DOMString? printerId;
DOMString? printerType;
DOMString? printerDesc;
DOMString? printerMakeAndModel;
DOMString? printerUri;
DOMString? printerPpd;
callback PrinterArrayCallback = void (Printer[] printers);
dictionary ArcState {
// Whether the ARC is provisioned.
boolean provisioned;
// Whether ARC Terms of Service needs to be shown.
boolean tosNeeded;
callback ArcStateCallback = void (ArcState result);
dictionary PlayStoreState {
// Whether the Play Store allowed for the current user.
boolean allowed;
// Whether the Play Store currently enabled.
boolean? enabled;
// Whether the Play Store managed by policy.
boolean? managed;
callback PlayStoreStateCallback = void (PlayStoreState result);
dictionary HistogramBucket {
// Minimum sample value that can be stored in this bucket (i.e. inclusive).
long min;
// Exclusive maximum value for samples stored this bucket.
long max;
// Number of samples stored in this bucket.
long count;
dictionary Histogram {
// Buckets containing samples.
HistogramBucket[] buckets;
callback HistogramCallback = void (Histogram histogram);
dictionary AssistantQueryResponse {
DOMString? text;
DOMString? htmlResponse;
DOMString? htmlFallback;
callback AssistantQueryResponseCallback =
void(AssistantQueryResponse response);
callback IsAppShownCallback = void (boolean appShown);
callback IsArcProvisionedCallback = void (boolean arcProvisioned);
dictionary ArcAppDict {
DOMString name;
DOMString packageName;
DOMString activity;
DOMString intentUri;
DOMString iconResourceId;
double lastLaunchTime;
double installTime;
boolean sticky;
boolean notificationsEnabled;
boolean ready;
boolean suspended;
boolean showInLauncher;
boolean shortcut;
boolean launchable;
callback GetArcAppCallback = void (ArcAppDict package);
dictionary ArcPackageDict {
DOMString packageName;
long packageVersion;
DOMString lastBackupAndroidId;
double lastBackupTime;
boolean shouldSync;
boolean system;
boolean vpnProvider;
callback GetArcPackageCallback = void (ArcPackageDict package);
callback LaunchArcAppCallback = void (boolean appLaunched);
callback TakeScreenshotCallback = void (DOMString base64Png);
callback GetPrimaryDisplayScaleFactorCallback = void (double scaleFactor);
callback IsTabletModeEnabledCallback = void (boolean enabled);
callback SetTabletModeEnabledCallback = void(boolean enabled);
callback GetShelfAutoHideBehaviorCallback = void (DOMString behavior);
callback GetShelfAlignmentCallback = void (ShelfAlignmentType alignment);
callback VoidCallback = void ();
interface Functions {
// Logout of a user session.
static void logout();
// Restart the browser.
static void restart();
// Shutdown the browser.
// |force|: if set, ignore ongoing downloads and onunbeforeunload handlers.
static void shutdown(boolean force);
// Get login status.
static void loginStatus(LoginStatusCallback callback);
// Locks the screen.
static void lockScreen();
// Get info about installed extensions.
static void getExtensionsInfo(ExtensionsInfoCallback callback);
// Simulates a memory access bug for asan testing.
static void simulateAsanMemoryBug();
// Set the touchpad pointer sensitivity setting.
// |value|: the pointer sensitivity setting index.
static void setTouchpadSensitivity(long value);
// Turn on/off tap-to-click for the touchpad.
// |enabled|: if set, enable tap-to-click.
static void setTapToClick(boolean enabled);
// Turn on/off three finger click for the touchpad.
// |enabled|: if set, enable three finger click.
static void setThreeFingerClick(boolean enabled);
// Turn on/off tap dragging for the touchpad.
// |enabled|: if set, enable tap dragging.
static void setTapDragging(boolean enabled);
// Turn on/off Australian scrolling for devices other than wheel mouse.
// |enabled|: if set, enable Australian scrolling.
static void setNaturalScroll(boolean enabled);
// Set the mouse pointer sensitivity setting.
// |value|: the pointer sensitivity setting index.
static void setMouseSensitivity(long value);
// Swap the primary mouse button for left click.
// |right|: if set, swap the primary mouse button.
static void setPrimaryButtonRight(boolean right);
// Turn on/off reverse scrolling for mice.
// |enabled|: if set, enable reverse scrolling.
static void setMouseReverseScroll(boolean enabled);
// Get visible notifications on the system.
static void getVisibleNotifications(NotificationArrayCallback callback);
// Get state of the ARC session.
static void getArcState(ArcStateCallback callback);
// Get state of the Play Store.
static void getPlayStoreState(PlayStoreStateCallback callback);
// Get list of available printers
static void getPrinterList(PrinterArrayCallback callback);
// Returns true if requested app is shown in Chrome.
static void isAppShown(DOMString appId, IsAppShownCallback callback);
// Returns true if ARC is provisioned.
// [deprecated="Use getArcState()"]
static void isArcProvisioned(IsArcProvisionedCallback callback);
// Gets information about the requested ARC app.
static void getArcApp(DOMString appId, GetArcAppCallback callback);
// Gets information about requested ARC package.
static void getArcPackage(DOMString packageName,
GetArcPackageCallback callback);
// Launches ARC app with optional intent. Returns true if ARC is active,
// app exists and launch request is passed to Android.
static void launchArcApp(DOMString appId, DOMString intent,
LaunchArcAppCallback callback);
// Launches an application from the launcher with the given appId.
static void launchApp(DOMString appId, VoidCallback callback);
// Closes an application the given appId in case it was running.
static void closeApp(DOMString appId, VoidCallback callback);
// Update printer. Printer with empty ID is considered new.
static void updatePrinter(Printer printer);
// Remove printer.
static void removePrinter(DOMString printerId);
// Enable/disable the Play Store.
// |enabled|: if set, enable the Play Store.
// |callback|: Called when the operation has completed.
static void setPlayStoreEnabled(boolean enabled, VoidCallback callback);
// Get details about a histogram displayed at chrome://histogram.
// |name|: Histogram name, e.g. "Accessibility.CrosAutoclick".
// |callback|: Invoked with details.
static void getHistogram(DOMString name, HistogramCallback callback);
// Run the crostini installer GUI to install the default crostini
// vm / container and create sshfs mount. The installer launches the
// crostini terminal app on completion. The installer expects that
// crostini is not already installed.
// |callback|: Called when the operation has completed.
static void runCrostiniInstaller(VoidCallback callback);
// Run the crostini uninstaller GUI to remove the default crostini
// vm / container. The callback is invoked upon completion.
static void runCrostiniUninstaller(VoidCallback callback);
// Enable/disable Crostini in preferences.
// |enabled|: Enable Crostini.
// |callback|: Called when the operation has completed.
static void setCrostiniEnabled(boolean enabled, VoidCallback callback);
// Export the crostini container.
// |path|: The path in Downloads to save the export.
// |callback|: Called when the operation has completed.
static void exportCrostini(DOMString path, VoidCallback callback);
// Import the crostini container.
// |path|: The path in Downloads to read the import.
// |callback|: Called when the operation has completed.
static void importCrostini(DOMString path, VoidCallback callback);
// Takes a screenshot and returns the data in base64 encoded PNG format.
static void takeScreenshot(TakeScreenshotCallback callback);
// Makes a basic request to ML Service, triggering 1. ML Service
// daemon startup, and 2. the initial D-Bus -> Mojo IPC bootstrap.
// |callback|: Called when the operation has completed.
static void bootstrapMachineLearningService(VoidCallback callback);
// Enable/disable the Google Assistant
// |callback|: Called when the operation has completed.
static void setAssistantEnabled(boolean enabled, long timeout_ms,
VoidCallback callback);
// Send a text query via Google Assistant.
// |callback|: Called when response has been received.
static void sendAssistantTextQuery(DOMString query, long timeout_ms,
AssistantQueryResponseCallback callback);
// Set value for the specified user pref in the pref tree.
static void setWhitelistedPref(DOMString pref_name, any value,
VoidCallback callback);
// Enable/disable a Crostini app's "scaled" property.
// |appId|: The Crostini application ID.
// |scaled|: The app is "scaled" when shown, which means it uses low display
// density.
// |callback|: Called when the operation has completed.
static void setCrostiniAppScaled(DOMString appId, boolean scaled,
VoidCallback callback);
// Get the primary display scale factor.
// |callback| is invoked with the scale factor.
static void getPrimaryDisplayScaleFactor(
GetPrimaryDisplayScaleFactorCallback callback);
// Get the tablet mode enabled status.
// |callback| is invoked with the tablet mode enablement status.
static void isTabletModeEnabled(IsTabletModeEnabledCallback callback);
// Enable/disable tablet mode. After calling this function, it won't be
// possible to physically switch to/from tablet mode since that
// functionality will be disabled.
// |enabled|: if set, enable tablet mode.
// |callback|: Called when the operation has completed.
static void setTabletModeEnabled(boolean enabled,
SetTabletModeEnabledCallback callback);
// Get the shelf auto hide behavior.
// |displayId|: display that contains the shelf.
// |callback| is invoked with the shelf auto hide behavior. Possible
// behavior values are: "always", "never" or "hidden".
static void getShelfAutoHideBehavior(DOMString displayId,
GetShelfAutoHideBehaviorCallback callback);
// Set the shelf auto hide behavior.
// |displayId|: display that contains the shelf.
// |behavior|: an enum of "always", "never" or "hidden".
// |callback|: Called when the operation has completed.
static void setShelfAutoHideBehavior(DOMString displayId,
DOMString behavior, VoidCallback callback);
// Get the shelf alignment.
// |displayId|: display that contains the shelf.
// |callback| is invoked with the shelf alignment type.
static void getShelfAlignment(DOMString displayId,
GetShelfAlignmentCallback callback);
// Set the shelf alignment.
// |displayId|: display that contains the shelf.
// |alignment|: the type of alignment to set.
// |callback|: Called when the operation has completed.
static void setShelfAlignment(DOMString displayId,
ShelfAlignmentType alignment, VoidCallback callback);
// Show virtual keyboard of the current input method if it's available.
static void showVirtualKeyboardIfEnabled();