Commit 7345a5f4 authored by Jiewei Qian's avatar Jiewei Qian Committed by Commit Bot

autotestPrivate: include App's install source in getAllInstalledApps

This CL adds install source to thr return value of getAllInstalledApps.

Bug: 1095524
Change-Id: Ief54598f1005657ccc6f3e674e396077a42b1ca0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2371067
Commit-Queue: Jiewei Qian  <qjw@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801248}
parent d60b38a9
......@@ -326,6 +326,30 @@ api::autotest_private::AppType GetAppType(apps::mojom::AppType type) {
return api::autotest_private::AppType::APP_TYPE_NONE;
}
api::autotest_private::AppInstallSource GetAppInstallSource(
apps::mojom::InstallSource source) {
switch (source) {
case apps::mojom::InstallSource::kUnknown:
return api::autotest_private::AppInstallSource::
APP_INSTALL_SOURCE_UNKNOWN;
case apps::mojom::InstallSource::kSystem:
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_SYSTEM;
case apps::mojom::InstallSource::kPolicy:
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_POLICY;
case apps::mojom::InstallSource::kOem:
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_OEM;
case apps::mojom::InstallSource::kDefault:
return api::autotest_private::AppInstallSource::
APP_INSTALL_SOURCE_DEFAULT;
case apps::mojom::InstallSource::kSync:
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_SYNC;
case apps::mojom::InstallSource::kUser:
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_USER;
}
NOTREACHED();
return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_NONE;
}
api::autotest_private::AppWindowType GetAppWindowType(ash::AppType type) {
switch (type) {
case ash::AppType::ARC_APP:
......@@ -2864,6 +2888,7 @@ AutotestPrivateGetAllInstalledAppsFunction::Run() {
app.short_name = update.ShortName();
app.additional_search_terms = update.AdditionalSearchTerms();
app.type = GetAppType(update.AppType());
app.install_source = GetAppInstallSource(update.InstallSource());
app.readiness = GetAppReadiness(update.Readiness());
app.show_in_launcher = ConvertMojomOptionalBool(update.ShowInLauncher());
app.show_in_search = ConvertMojomOptionalBool(update.ShowInSearch());
......
......@@ -42,6 +42,17 @@ namespace autotestPrivate {
Borealis
};
// A mapping of apps::mojom::InstallSource
enum AppInstallSource {
Unknown,
System,
Policy,
Oem,
Default,
Sync,
User
};
// A mapping of apps::mojom::Readiness
enum AppReadiness {
Ready,
......@@ -308,6 +319,7 @@ namespace autotestPrivate {
DOMString name;
DOMString shortName;
AppType? type;
AppInstallSource? installSource;
AppReadiness? readiness;
DOMString[] additionalSearchTerms;
boolean? showInLauncher;
......
......@@ -471,6 +471,7 @@ var defaultTests = [
chrome.test.assertEq(chromium.showInLauncher, true);
chrome.test.assertEq(chromium.showInSearch, true);
chrome.test.assertEq(chromium.type, 'Extension');
chrome.test.assertEq(chromium.installSource, 'System');
}));
},
// This test verifies that only Chromium is available by default.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment