Commit e8ffb2f2 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[fileapp] Move media SWA test to FileManagerBrowserTest fixture

Add new test Option for media_swa and use it in enable and load SWA in
test from file_manager_browsertest_base.cc.

Remove the SWAsFilesAppBrowserTest fixture: move its media SWA test to
the FileManagerBrowserTest fixture.

Bug: 1122379
Change-Id: Ifbe75220777d0115a8e81c61ff2bb7fea447dcf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500683Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821057}
parent 1bee3901
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h" #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -78,6 +76,11 @@ struct TestCase { ...@@ -78,6 +76,11 @@ struct TestCase {
return *this; return *this;
} }
TestCase& MediaSwa() {
options.media_swa = true;
return *this;
}
TestCase& DisableNativeSmb() { TestCase& DisableNativeSmb() {
options.native_smb = false; options.native_smb = false;
return *this; return *this;
...@@ -222,26 +225,6 @@ IN_PROC_BROWSER_TEST_P(FilesAppBrowserTest, Test) { ...@@ -222,26 +225,6 @@ IN_PROC_BROWSER_TEST_P(FilesAppBrowserTest, Test) {
StartTest(); StartTest();
} }
// Files app tests that require SWA (System Web Apps).
class SWAsFilesAppBrowserTest : public FilesAppBrowserTest {
public:
SWAsFilesAppBrowserTest() = default;
SWAsFilesAppBrowserTest(const SWAsFilesAppBrowserTest&) = delete;
SWAsFilesAppBrowserTest& operator=(const SWAsFilesAppBrowserTest&) = delete;
void SetUpOnMainThread() override {
web_app::WebAppProvider::Get(profile())
->system_web_app_manager()
.InstallSystemAppsForTesting();
FilesAppBrowserTest::SetUpOnMainThread();
}
};
IN_PROC_BROWSER_TEST_P(SWAsFilesAppBrowserTest, Test) {
StartTest();
}
// A version of the FilesAppBrowserTest that supports spanning browser restart // A version of the FilesAppBrowserTest that supports spanning browser restart
// to allow testing prefs and other things. // to allow testing prefs and other things.
class ExtendedFilesAppBrowserTest : public FilesAppBrowserTest { class ExtendedFilesAppBrowserTest : public FilesAppBrowserTest {
...@@ -342,9 +325,9 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -342,9 +325,9 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
WRAPPED_INSTANTIATE_TEST_SUITE_P( WRAPPED_INSTANTIATE_TEST_SUITE_P(
OpenImageBacklight, /* open_image_backlight.js */ OpenImageBacklight, /* open_image_backlight.js */
SWAsFilesAppBrowserTest, FilesAppBrowserTest,
::testing::Values(TestCase("imageOpenBacklight").InGuestMode(), ::testing::Values(TestCase("imageOpenBacklight").MediaSwa().InGuestMode(),
TestCase("imageOpenBacklight"))); TestCase("imageOpenBacklight").MediaSwa()));
WRAPPED_INSTANTIATE_TEST_SUITE_P( WRAPPED_INSTANTIATE_TEST_SUITE_P(
OpenImageFiles, /* open_image_files.js */ OpenImageFiles, /* open_image_files.js */
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h" #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h"
#include "chrome/browser/ui/views/extensions/extension_dialog.h" #include "chrome/browser/ui/views/extensions/extension_dialog.h"
#include "chrome/browser/ui/views/select_file_dialog_extension.h" #include "chrome/browser/ui/views/select_file_dialog_extension.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/file_manager_private.h" #include "chrome/common/extensions/api/file_manager_private.h"
...@@ -721,6 +723,7 @@ std::ostream& operator<<(std::ostream& out, ...@@ -721,6 +723,7 @@ std::ostream& operator<<(std::ostream& out,
PRINT_IF_NOT_DEFAULT(browser) PRINT_IF_NOT_DEFAULT(browser)
PRINT_IF_NOT_DEFAULT(documents_provider) PRINT_IF_NOT_DEFAULT(documents_provider)
PRINT_IF_NOT_DEFAULT(files_ng) PRINT_IF_NOT_DEFAULT(files_ng)
PRINT_IF_NOT_DEFAULT(media_swa)
PRINT_IF_NOT_DEFAULT(mount_volumes) PRINT_IF_NOT_DEFAULT(mount_volumes)
PRINT_IF_NOT_DEFAULT(native_smb) PRINT_IF_NOT_DEFAULT(native_smb)
PRINT_IF_NOT_DEFAULT(offline) PRINT_IF_NOT_DEFAULT(offline)
...@@ -1852,6 +1855,13 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() { ...@@ -1852,6 +1855,13 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
// extensions now and not before: crbug.com/831074, crbug.com/804413 // extensions now and not before: crbug.com/831074, crbug.com/804413
test::AddDefaultComponentExtensionsOnMainThread(profile()); test::AddDefaultComponentExtensionsOnMainThread(profile());
// Enable System Web Apps if needed.
if (options.media_swa) {
auto& system_web_app_manager =
web_app::WebAppProvider::Get(profile())->system_web_app_manager();
system_web_app_manager.InstallSystemAppsForTesting();
}
// For tablet mode tests, enable the Ash virtual keyboard. // For tablet mode tests, enable the Ash virtual keyboard.
if (options.tablet_mode) { if (options.tablet_mode) {
EnableVirtualKeyboard(); EnableVirtualKeyboard();
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h" #include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/file_manager/devtools_listener.h" #include "chrome/browser/chromeos/file_manager/devtools_listener.h"
...@@ -78,6 +77,9 @@ class FileManagerBrowserTestBase : public content::DevToolsAgentHostObserver, ...@@ -78,6 +77,9 @@ class FileManagerBrowserTestBase : public content::DevToolsAgentHostObserver,
// Whether test needs the files-ng feature. // Whether test needs the files-ng feature.
bool files_ng = true; bool files_ng = true;
// Whether test needs the media-swa apps.
bool media_swa = false;
// Whether test needs a native SMB file system provider. // Whether test needs a native SMB file system provider.
bool native_smb = true; bool native_smb = true;
......
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