Commit 527ae681 authored by Tim Sergeant's avatar Tim Sergeant Committed by Commit Bot

Reland "CrOS: Add Files app to default shelf pins in second position"

This is a reland of 5d6ecbfb

The failing Tast test (ui.ShelfLaunchedApps) has been updated to
ensure it continues passing after this CL is landed.

This is the second of a chain of 3 CLs:

1. crrev.com/c/2538305: Allow Files app to be pinned by default in
   ui.ShelfLaunchedApps
2. crrev.com/c/2538857: Add Files app to default shelf pins in second
   position
3. crrev.com/c/2538307: Update ui.ShelfLaunchedApps to ensure Chrome and
   Files are always pinned

Original change's description:
> CrOS: Add Files app to default shelf pins in second position
>
> This adds the Files app to the spot after the Chrome icon, for new users
> only. There's also some variations of the default pin layout controlled
> by a Finch experiment, I've moved the Files app up in those layouts for
> consistency.
>
> This change was requested for M88 and will be merged back.
>
> Bug: 1148519
> Change-Id: Iae54561fec599b813ba97e82a5678fa834a02db2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537214
> Reviewed-by: Dominick Ng <dominickn@chromium.org>
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
> Auto-Submit: Tim Sergeant <tsergeant@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#827272}

Bug: 1148519
Change-Id: I9186b43a651dea4c4de9e46f849d35da9cc6062c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538857Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Tim Sergeant <tsergeant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827981}
parent 005af3c4
......@@ -48,27 +48,28 @@ namespace {
// Chrome is pinned explicitly.
const char* kDefaultPinnedApps[] = {
extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId,
extension_misc::kYoutubeAppId, arc::kPlayStoreAppId};
extension_misc::kFilesManagerAppId, extension_misc::kGmailAppId,
extension_misc::kGoogleDocAppId, extension_misc::kYoutubeAppId,
arc::kPlayStoreAppId};
const char* kDefaultPinnedApps7Apps[] = {
extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId,
extension_misc::kGooglePhotosAppId, extension_misc::kFilesManagerAppId,
extension_misc::kFilesManagerAppId, extension_misc::kGmailAppId,
extension_misc::kGoogleDocAppId, extension_misc::kGooglePhotosAppId,
extension_misc::kYoutubeAppId, arc::kPlayStoreAppId};
const char* kDefaultPinnedApps10Apps[] = {extension_misc::kGmailAppId,
const char* kDefaultPinnedApps10Apps[] = {extension_misc::kFilesManagerAppId,
extension_misc::kGmailAppId,
extension_misc::kCalendarAppId,
extension_misc::kGoogleDocAppId,
extension_misc::kGoogleSheetsAppId,
extension_misc::kGoogleSlidesAppId,
extension_misc::kFilesManagerAppId,
extension_misc::kCameraAppId,
extension_misc::kGooglePhotosAppId,
arc::kPlayStoreAppId};
const char* kTabletFormFactorDefaultPinnedApps[] = {
arc::kGmailAppId, extension_misc::kGoogleDocAppId, arc::kYoutubeAppId,
arc::kPlayStoreAppId};
extension_misc::kFilesManagerAppId, arc::kGmailAppId,
extension_misc::kGoogleDocAppId, arc::kYoutubeAppId, arc::kPlayStoreAppId};
const char kDefaultPinnedAppsKey[] = "default";
const char kDefaultPinnedApps7AppsKey[] = "7apps";
......
......@@ -417,6 +417,11 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
base::FilePath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS,
extension_misc::kYoutubeAppId, &error);
// Fake File Manager app.
extension_files_app_ = Extension::Create(
base::FilePath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS,
extension_misc::kFilesManagerAppId, &error);
MaybeStartWebAppProvider();
}
......@@ -788,6 +793,8 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
result += "Doc";
} else if (app == extension_youtube_app_->id()) {
result += "Youtube";
} else if (app == extension_files_app_->id()) {
result += "Files";
} else if (app == extension_platform_app_->id()) {
result += "Platform_App";
} else if (app == arc_support_host_->id()) {
......@@ -962,6 +969,7 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
scoped_refptr<Extension> extension_gmail_app_;
scoped_refptr<Extension> extension_doc_app_;
scoped_refptr<Extension> extension_youtube_app_;
scoped_refptr<Extension> extension_files_app_;
scoped_refptr<Extension> extension_platform_app_;
scoped_refptr<Extension> arc_support_host_;
......@@ -1064,6 +1072,7 @@ class ChromeLauncherControllerExtendedShelfTest
extension_service_->AddExtension(extension_gmail_app_.get());
extension_service_->AddExtension(extension_doc_app_.get());
extension_service_->AddExtension(extension_youtube_app_.get());
extension_service_->AddExtension(extension_files_app_.get());
extension_service_->AddExtension(arc_support_host_.get());
std::string error;
......@@ -1081,7 +1090,6 @@ class ChromeLauncherControllerExtendedShelfTest
{extension_misc::kCalendarAppId, "Calendar"},
{extension_misc::kGoogleSheetsAppId, "Sheets"},
{extension_misc::kGoogleSlidesAppId, "Slides"},
{extension_misc::kFilesManagerAppId, "Files"},
{extension_misc::kCameraAppId, "Camera"},
{extension_misc::kGooglePhotosAppId, "Photos"},
};
......@@ -1343,6 +1351,8 @@ TEST_F(ChromeLauncherControllerTest, DefaultApps) {
EXPECT_EQ("Chrome, Doc, Youtube, App1", GetPinnedAppStatus());
AddExtension(extension_gmail_app_.get());
EXPECT_EQ("Chrome, Gmail, Doc, Youtube, App1", GetPinnedAppStatus());
AddExtension(extension_files_app_.get());
EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, App1", GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerSplitSettingsSyncTest, DefaultApps) {
......@@ -1383,28 +1393,29 @@ TEST_F(ChromeLauncherControllerLacrosTest, LacrosPinnedByDefault) {
EXPECT_EQ("Chrome, Lacros", GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShefDefault) {
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelfDefault) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
kEnableExtendedShelfLayout,
{std::pair<std::string, std::string>("app_count", "0")});
InitLauncherController();
EXPECT_EQ("Chrome, Gmail, Doc, Youtube, Play Store", GetPinnedAppStatus());
EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, Play Store",
GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShef7Apps) {
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelf7Apps) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
kEnableExtendedShelfLayout,
{std::pair<std::string, std::string>("app_count", "7")});
InitLauncherController();
EXPECT_EQ("Chrome, Gmail, Doc, Photos, Files, Youtube, Play Store",
EXPECT_EQ("Chrome, Files, Gmail, Doc, Photos, Youtube, Play Store",
GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShef10Apps) {
TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelf10Apps) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
kEnableExtendedShelfLayout,
......@@ -1412,14 +1423,15 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShef10Apps) {
InitLauncherController();
EXPECT_EQ(
"Chrome, Gmail, Calendar, Doc, Sheets, Slides, Files, Camera, Photos, "
"Chrome, Files, Gmail, Calendar, Doc, Sheets, Slides, Camera, Photos, "
"Play Store",
GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerExtendedShelfTest, UpgradeFromDefault) {
InitLauncherController();
EXPECT_EQ("Chrome, Gmail, Doc, Youtube, Play Store", GetPinnedAppStatus());
EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, Play Store",
GetPinnedAppStatus());
// Upgrade happens only in case default layout is active.
base::test::ScopedFeatureList scoped_feature_list;
......@@ -1431,15 +1443,15 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, UpgradeFromDefault) {
AddExtension(extension1_.get());
EXPECT_EQ(
"Chrome, Gmail, Calendar, Doc, Sheets, Slides, Files, Camera, Photos, "
"Chrome, Files, Gmail, Calendar, Doc, Sheets, Slides, Camera, Photos, "
"Play Store",
GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerExtendedShelfTest, NoDefaultAfterExperemental) {
TEST_F(ChromeLauncherControllerExtendedShelfTest, NoDefaultAfterExperimental) {
const std::string expectations =
"Chrome, Gmail, Calendar, Doc, Sheets, "
"Slides, Files, Camera, Photos, Play Store";
"Chrome, Files, Gmail, Calendar, Doc, Sheets, "
"Slides, Camera, Photos, Play Store";
{
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
......@@ -1466,7 +1478,7 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, NoDefaultAfterExperemental) {
TEST_F(ChromeLauncherControllerExtendedShelfTest, NoUpgradeFromNonDefault) {
InitLauncherController();
launcher_controller_->UnpinAppWithID(extension_misc::kYoutubeAppId);
EXPECT_EQ("Chrome, Gmail, Doc, Play Store", GetPinnedAppStatus());
EXPECT_EQ("Chrome, Files, Gmail, Doc, Play Store", GetPinnedAppStatus());
// Upgrade does not happen due to default pin layout change.
base::test::ScopedFeatureList scoped_feature_list;
......@@ -1477,7 +1489,7 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, NoUpgradeFromNonDefault) {
// Trigger layout update, app_id does not matter.
AddExtension(extension1_.get());
EXPECT_EQ("Chrome, Gmail, Doc, Play Store", GetPinnedAppStatus());
EXPECT_EQ("Chrome, Files, Gmail, Doc, Play Store", GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinCrossPlatformWorkflow) {
......
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