| // 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. |
| [platforms=("chromeos"), |
| implemented_in="chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h"] |
| namespace autotestPrivate { |
| |
| enum ShelfAlignmentType { |
| // BottomLocked not supported by shelf_prefs. |
| Bottom, Left, Right |
| }; |
| |
| // A mapping of ash::ShelfItemType. |
| enum ShelfItemType { |
| App, |
| PinnedApp, |
| BrowserShortcut, |
| Dialog |
| }; |
| |
| // A mapping of ash::ShelfItemStatus. |
| enum ShelfItemStatus { |
| Closed, |
| Running, |
| Attention |
| }; |
| |
| // A mapping of apps::mojom::Type |
| enum AppType { |
| Arc, |
| BuiltIn, |
| Crostini, |
| Extension, |
| Web |
| }; |
| |
| // A mapping of apps::mojom::Readiness |
| enum AppReadiness { |
| Ready, |
| DisabledByBlacklist, |
| DisabledByPolicy, |
| DisabledByUser, |
| Terminated, |
| UninstalledByUser |
| }; |
| |
| // A subset of Window State types in ash::WindowStateType. We may add more |
| // into the set in the future. |
| enum WindowStateType { |
| Normal, |
| Minimized, |
| Maximized, |
| Fullscreen, |
| LeftSnapped, |
| RightSnapped, |
| PIP |
| }; |
| |
| // A subset of WM event types in ash::WMEventType. We may add more in the |
| // set in the future. |
| enum WMEventType { |
| WMEventNormal, |
| WMEventMaxmize, |
| WMEventMinimize, |
| WMEventFullscreen, |
| WMEventSnapLeft, |
| WMEventSnapRight |
| }; |
| |
| // Display orientation type. |
| enum RotationType { |
| Rotate0, |
| Rotate90, |
| Rotate180, |
| Rotate270 |
| }; |
| |
| // A paramter used in setArcAppWindowState() function. |
| dictionary WindowStateChangeDict { |
| // The WM event to change the ARC window state. |
| WMEventType eventType; |
| |
| // If the initial state is already same as the expected state, should we |
| // treat this case as a failure? Default value is false. |
| boolean? failIfNoChange; |
| }; |
| |
| 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); |
| |
| // |all_policies| will be the full list of policies as returned by the |
| // DictionaryPolicyConversions.ToValue function. |
| callback AllEnterprisePoliciesCallback = void (any all_policies); |
| |
| 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); |
| |
| callback ArcStartTimeCallback = void (double startTime); |
| |
| 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 { |
| // Text response returned from server. |
| DOMString? text; |
| // HTML response returned from server, usually accompanied with |
| // fallback text. |
| DOMString? htmlResponse; |
| // Text messages used as the "fallback" for HTML card rendering. |
| // Generally the fallback text is similar to transcribed TTS, |
| // e.g. "It's exactly 6 o'clock." or "Turning bluetooth off.". |
| DOMString? htmlFallback; |
| }; |
| dictionary AssistantQueryStatus { |
| // Indicates whether this might be a voice interaction. |
| boolean isMicOpen; |
| // Query text sent to Assistant. In the event of a voice interaction, |
| // this field will be same as the speech recognition final result. |
| DOMString queryText; |
| // Response for the current query. |
| AssistantQueryResponse queryResponse; |
| }; |
| callback AssistantQueryStatusCallback = void (AssistantQueryStatus status); |
| |
| 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); |
| |
| dictionary Bounds { |
| double left; |
| double top; |
| double width; |
| double height; |
| }; |
| |
| dictionary ArcAppWindowInfo { |
| Bounds bounds; |
| DOMString displayId; |
| boolean isAnimating; |
| boolean isVisible; |
| }; |
| |
| dictionary ArcAppTracingInfo { |
| boolean success; |
| double fps; |
| double commitDeviation; |
| double renderQuality; |
| }; |
| |
| callback GetArcAppWindowInfoCallback = void (ArcAppWindowInfo info); |
| |
| 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 SetOverviewModeStateCallback = void(boolean finished); |
| |
| callback ArcAppTracingCallback = void(ArcAppTracingInfo info); |
| |
| callback WaitForDisplayRotationCallback = void (boolean success); |
| |
| dictionary App { |
| DOMString appId; |
| DOMString name; |
| DOMString shortName; |
| AppType? type; |
| AppReadiness? readiness; |
| DOMString[] additionalSearchTerms; |
| boolean? showInLauncher; |
| boolean? showInSearch; |
| }; |
| |
| callback GetAllInstalledAppsCallback = void (App[] apps); |
| |
| dictionary ShelfItem { |
| DOMString appId; |
| DOMString launchId; |
| DOMString title; |
| ShelfItemType? type; |
| ShelfItemStatus status; |
| boolean showsTooltip; |
| boolean pinnedByPolicy; |
| boolean hasNotification; |
| }; |
| |
| callback GetShelfItemsCallback = void (ShelfItem[] items); |
| |
| callback GetShelfAutoHideBehaviorCallback = void (DOMString behavior); |
| |
| callback GetShelfAlignmentCallback = void (ShelfAlignmentType alignment); |
| |
| callback WindowStateCallback = void (WindowStateType currentType); |
| |
| callback VoidCallback = void (); |
| |
| callback DOMStringCallback = void (DOMString data); |
| |
| interface Functions { |
| // Must be called to allow autotestPrivateAPI events to be fired. |
| static void initializeEvents(); |
| |
| // 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); |
| |
| // Get state of the policies. |
| // Will contain device policies and policies from the active profile. |
| // The policy values are formatted as they would be for exporting in |
| // chrome://policy. |
| static void getAllEnterprisePolicies( |
| AllEnterprisePoliciesCallback 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 ARC start time. |
| static void getArcStartTime(ArcStartTimeCallback 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); |
| |
| // Get text from ui::Clipboard. |
| // |callback|: Called with result. |
| static void getClipboardTextData(DOMStringCallback callback); |
| |
| // Set text in ui::Clipbaord. |
| // |callback|: Called when operation is complete. |
| static void setClipboardTextData(DOMString data, VoidCallback 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); |
| |
| // Register a component with CrOSComponentManager. |
| // |name|: The name of the component. |
| // |path|: Path to the component. |
| static void registerComponent(DOMString name, DOMString path); |
| |
| // Takes a screenshot and returns the data in base64 encoded PNG format. |
| static void takeScreenshot(TakeScreenshotCallback callback); |
| |
| // Tasks a screenshot for a display. |
| // |display_id|: the display id of the display. |
| // |callback|: called when the operation has completed. |
| static void takeScreenshotForDisplay(DOMString display_id, |
| 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); |
| |
| // Enables/disables the Google Assistant. |
| // |callback|: Called when the operation has completed. |
| static void setAssistantEnabled(boolean enabled, long timeout_ms, |
| VoidCallback callback); |
| |
| // Sends a text query via Google Assistant. |
| // |callback|: Called when response has been received. |
| static void sendAssistantTextQuery(DOMString query, long timeout_ms, |
| AssistantQueryStatusCallback callback); |
| |
| // Invokes |callback| once the current text/voice interaction is completed. |
| // Responds with the the query status if any valid response was caught |
| // before the timeout. This API should be called before sending the query. |
| // To use it for testing a voice query via OKG in Autotest, for example, |
| // you can do: |
| // |
| // // Enable hotword setting for Assistant. |
| // assistant_util.enable_hotword(); |
| // |
| // // Call this API with your callback function. |
| // chrome.autotestPrivate.waitForAssistantQueryStatus(timeout_s, |
| // function(status) {...}); |
| // |
| // then start Assistant via OKG and send voice query before timeout. |
| // |
| // TODO(meilinw@): disable warmer welcome to avoid an unintended early |
| // return of this API when launching Assistant via hotkey. |
| // TODO(meilinw@): update the comment above to use Tast instead after |
| // adding API to enable hotword in Tast. |
| static void waitForAssistantQueryStatus( |
| long timeout_s, |
| AssistantQueryStatusCallback 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 list of all installed applications |
| static void getAllInstalledApps(GetAllInstalledAppsCallback callback); |
| |
| // Get the list of all shelf items |
| static void getShelfItems(GetShelfItemsCallback 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); |
| |
| // Enter or exit the overview mode. |
| // |start|: whether entering to or exiting from the overview mode. |
| // |callback|: called after the overview mode switch finishes. |
| static void setOverviewModeState(boolean start, |
| SetOverviewModeStateCallback callback); |
| |
| // Show virtual keyboard of the current input method if it's available. |
| static void showVirtualKeyboardIfEnabled(); |
| |
| // Send WM event to change the ARC app window's window state. |
| // |packageName|: the package name of the ARC app window. |
| // |eventType|: WM event type to send to the ARC app window. |
| // |callback|: called when the window state is changed. |
| static void setArcAppWindowState(DOMString packageName, |
| WindowStateChangeDict change, |
| WindowStateCallback callback); |
| |
| // Get ARC app window's window state. |
| // |packageName|: the package name of the ARC app window. |
| // |callback| is invoked with the window state. |
| static void getArcAppWindowState(DOMString packageName, WindowStateCallback callback); |
| |
| // Get various information on an ARC window. |
| // |packageName|: the package name of the ARC app window. |
| // |callback|: called when the operation has completed. |
| static void getArcAppWindowInfo(DOMString packageName, |
| GetArcAppWindowInfoCallback callback); |
| |
| // Start ARC performance tracing for the active ARC app window. |
| // |callback|: Called when the operation has completed. |
| static void arcAppTracingStart(VoidCallback callback); |
| |
| // Stop ARC performance tracing if it was started and analyze results. |
| // |callback|: callback to deliver tracing results. |
| static void arcAppTracingStopAndAnalyze(ArcAppTracingCallback callback); |
| |
| // Swap the windows in the split view. |
| // |callback|: Called when the operation has completed. |
| static void swapWindowsInSplitView(VoidCallback callback); |
| |
| // Set ARC app window focused. |
| // |packageName|: the package name of the ARC app window. |
| // |callback|: called when the operation has completed. |
| static void setArcAppWindowFocus(DOMString packageName, |
| VoidCallback callback); |
| // Invokes the callback when the display rotation animation is finished, or |
| // invokes it immediately if it is not animating. The callback argument |
| // is true if the display's rotation is same as |rotation|, or false otherwise. |
| // |displayId|: display that contains the shelf. |
| // |rotation|: the target rotation. |
| // |callback|: called when the operation has completed. |
| static void waitForDisplayRotation(DOMString displayId, |
| RotationType rotation, |
| WaitForDisplayRotationCallback callback); |
| }; |
| |
| interface Events { |
| // Fired when the data in ui::Clipboard is changed. |
| static void onClipboardDataChanged(); |
| }; |
| }; |