Commit a392f874 authored by François Degros's avatar François Degros Committed by Commit Bot

Files app: Rename opts to options

BUG=None
TEST=out/release/browser_tests --gtest_filter="*FilesApp*" --gtest_list_tests
TEST=testing/xvfb.py out/release/browser_tests --gtest_filter="*FilesApp*" --test-launcher-jobs=10

Change-Id: Id60e003aa889f6f1886f2c1332e50fb5f6080b65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210041Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771017}
parent bc6df424
......@@ -31,73 +31,73 @@ struct TestCase {
}
TestCase& InGuestMode() {
opts.guest_mode = IN_GUEST_MODE;
options.guest_mode = IN_GUEST_MODE;
return *this;
}
TestCase& InIncognito() {
opts.guest_mode = IN_INCOGNITO;
options.guest_mode = IN_INCOGNITO;
return *this;
}
TestCase& TabletMode() {
opts.tablet_mode = true;
options.tablet_mode = true;
return *this;
}
TestCase& EnableDocumentsProvider() {
opts.arc = true;
opts.documents_provider = true;
options.arc = true;
options.documents_provider = true;
return *this;
}
TestCase& DisableDocumentsProvider() {
opts.documents_provider = false;
options.documents_provider = false;
return *this;
}
TestCase& EnableArc() {
opts.arc = true;
options.arc = true;
return *this;
}
TestCase& Offline() {
opts.offline = true;
options.offline = true;
return *this;
}
TestCase& FilesNg() {
opts.files_ng = true;
options.files_ng = true;
return *this;
}
TestCase& DisableFilesNg() {
opts.files_ng = false;
options.files_ng = false;
return *this;
}
TestCase& DisableNativeSmb() {
opts.native_smb = false;
options.native_smb = false;
return *this;
}
TestCase& EnableSmbfs() {
opts.smbfs = true;
options.smbfs = true;
return *this;
}
TestCase& EnableUnifiedMediaView() {
opts.unified_media_view = true;
options.unified_media_view = true;
return *this;
}
TestCase& DontMountVolumes() {
opts.mount_volumes = false;
options.mount_volumes = false;
return *this;
}
TestCase& DontObserveFileTasks() {
opts.observe_file_tasks = false;
options.observe_file_tasks = false;
return *this;
}
......@@ -108,54 +108,54 @@ struct TestCase {
// active browser in this case, which requires a Browser to be present. See
// https://crbug.com/736930.
TestCase& WithBrowser() {
opts.browser = true;
options.browser = true;
return *this;
}
TestCase& ZipNoNaCl() {
opts.zip_no_nacl = true;
options.zip_no_nacl = true;
return *this;
}
std::string GetFullName() const {
std::string full_name = name;
if (opts.guest_mode == IN_GUEST_MODE)
if (options.guest_mode == IN_GUEST_MODE)
full_name += "_GuestMode";
if (opts.guest_mode == IN_INCOGNITO)
if (options.guest_mode == IN_INCOGNITO)
full_name += "_Incognito";
if (opts.tablet_mode)
if (options.tablet_mode)
full_name += "_TabletMode";
if (!opts.files_ng)
if (!options.files_ng)
full_name += "_DisableFilesNg";
if (!opts.native_smb)
if (!options.native_smb)
full_name += "_DisableNativeSmb";
if (opts.documents_provider)
if (options.documents_provider)
full_name += "_DocumentsProvider";
if (opts.zip_no_nacl)
if (options.zip_no_nacl)
full_name += "_ZipNoNaCl";
return full_name;
}
const char* const name;
FileManagerBrowserTestBase::Options opts;
FileManagerBrowserTestBase::Options options;
};
std::ostream& operator<<(std::ostream& out, const TestCase& test_case) {
return out << test_case.opts;
return out << test_case.options;
}
// FilesAppBrowserTest with zip/unzip support.
TestCase ZipCase(const char* const name) {
TestCase test_case(name);
test_case.opts.zip = true;
test_case.options.zip = true;
return test_case;
}
......@@ -186,7 +186,7 @@ class FilesAppBrowserTest : public FileManagerBrowserTestBase,
return "file_manager_test_manifest.json";
}
Options GetOptions() const override { return GetParam().opts; }
Options GetOptions() const override { return GetParam().options; }
private:
DISALLOW_COPY_AND_ASSIGN(FilesAppBrowserTest);
......
......@@ -687,7 +687,7 @@ FileManagerBrowserTestBase::Options::Options() = default;
FileManagerBrowserTestBase::Options::Options(const Options&) = default;
std::ostream& operator<<(std::ostream& out,
const FileManagerBrowserTestBase::Options& opts) {
const FileManagerBrowserTestBase::Options& options) {
out << "{";
// Don't print separator before first member.
......@@ -697,12 +697,12 @@ std::ostream& operator<<(std::ostream& out,
const FileManagerBrowserTestBase::Options defaults;
// Print guest mode first, followed by boolean members in lexicographic order.
if (opts.guest_mode != defaults.guest_mode)
out << sep() << opts.guest_mode;
if (options.guest_mode != defaults.guest_mode)
out << sep() << options.guest_mode;
#define PRINT_IF_NOT_DEFAULT(N) \
if (opts.N != defaults.N) \
out << sep() << (opts.N ? "" : "!") << #N;
if (options.N != defaults.N) \
out << sep() << (options.N ? "" : "!") << #N;
PRINT_IF_NOT_DEFAULT(arc)
PRINT_IF_NOT_DEFAULT(browser)
......@@ -1488,12 +1488,12 @@ void FileManagerBrowserTestBase::SetUp() {
void FileManagerBrowserTestBase::SetUpCommandLine(
base::CommandLine* command_line) {
const Options opts = GetOptions();
const Options options = GetOptions();
// Use a fake audio stream crbug.com/835626
command_line->AppendSwitch(switches::kDisableAudioOutput);
if (!opts.browser) {
if (!options.browser) {
// Don't sink time into showing an unused browser window.
// InProcessBrowserTest::browser() will be null.
command_line->AppendSwitch(switches::kNoStartupWindow);
......@@ -1510,7 +1510,7 @@ void FileManagerBrowserTestBase::SetUpCommandLine(
set_exit_when_last_browser_closes(false);
}
if (opts.guest_mode == IN_GUEST_MODE) {
if (options.guest_mode == IN_GUEST_MODE) {
command_line->AppendSwitch(chromeos::switches::kGuestSession);
command_line->AppendSwitchNative(chromeos::switches::kLoginUser, "$guest");
command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
......@@ -1518,11 +1518,11 @@ void FileManagerBrowserTestBase::SetUpCommandLine(
set_chromeos_user_ = false;
}
if (opts.guest_mode == IN_INCOGNITO) {
if (options.guest_mode == IN_INCOGNITO) {
command_line->AppendSwitch(switches::kIncognito);
}
if (opts.offline) {
if (options.offline) {
command_line->AppendSwitchASCII(chromeos::switches::kShillStub, "clear=1");
}
......@@ -1536,36 +1536,36 @@ void FileManagerBrowserTestBase::SetUpCommandLine(
std::vector<base::Feature> enabled_features;
std::vector<base::Feature> disabled_features;
if (opts.files_ng) {
if (options.files_ng) {
enabled_features.push_back(chromeos::features::kFilesNG);
} else {
disabled_features.push_back(chromeos::features::kFilesNG);
}
if (opts.arc) {
if (options.arc) {
arc::SetArcAvailableCommandLineForTesting(command_line);
}
// Make sure to run the ARC storage UI toast tests.
enabled_features.push_back(arc::kUsbStorageUIFeature);
if (opts.documents_provider) {
if (options.documents_provider) {
enabled_features.push_back(arc::kEnableDocumentsProviderInFilesAppFeature);
} else {
disabled_features.push_back(arc::kEnableDocumentsProviderInFilesAppFeature);
}
if (opts.unified_media_view) {
if (options.unified_media_view) {
enabled_features.push_back(chromeos::features::kUnifiedMediaView);
} else {
disabled_features.push_back(chromeos::features::kUnifiedMediaView);
}
if (opts.smbfs) {
if (options.smbfs) {
enabled_features.push_back(features::kSmbFs);
}
if (opts.zip_no_nacl) {
if (options.zip_no_nacl) {
enabled_features.push_back(chromeos::features::kFilesZipNoNaCl);
} else {
disabled_features.push_back(chromeos::features::kFilesZipNoNaCl);
......@@ -1608,7 +1608,7 @@ void FileManagerBrowserTestBase::SetUpInProcessBrowserTestFixture() {
}
void FileManagerBrowserTestBase::SetUpOnMainThread() {
const Options opts = GetOptions();
const Options options = GetOptions();
// Must happen after the browser process is created because instantiating
// the factory will instantiate ExtensionSystemFactory which depends on
......@@ -1620,26 +1620,26 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
extensions::ExtensionApiTest::SetUpOnMainThread();
CHECK(profile());
CHECK_EQ(!!browser(), opts.browser);
CHECK_EQ(!!browser(), options.browser);
if (!opts.mount_volumes) {
if (!options.mount_volumes) {
VolumeManager::Get(profile())->RemoveDownloadsDirectoryForTesting();
} else {
CHECK(local_volume_->Mount(profile()));
}
if (opts.guest_mode != IN_GUEST_MODE) {
if (options.guest_mode != IN_GUEST_MODE) {
// Start the embedded test server to serve the mocked CWS widget container.
CHECK(embedded_test_server()->Start());
drive_volume_ = drive_volumes_[profile()->GetOriginalProfile()].get();
if (opts.mount_volumes) {
if (options.mount_volumes) {
test_util::WaitUntilDriveMountPointIsAdded(profile());
}
// Init crostini. Set VM and container running for testing, and register
// CustomMountPointCallback.
crostini_volume_ = std::make_unique<CrostiniTestVolume>();
if (opts.guest_mode != IN_INCOGNITO) {
if (options.guest_mode != IN_INCOGNITO) {
crostini_features_.set_ui_allowed(true);
crostini_features_.set_enabled(true);
crostini_features_.set_root_access_allowed(true);
......@@ -1677,14 +1677,14 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
arc::ArcServiceManager::Get()->arc_bridge_service()->file_system());
ASSERT_TRUE(arc_file_system_instance_->InitCalled());
if (opts.documents_provider) {
if (options.documents_provider) {
// Though we can have multiple DocumentsProvider volumes, only one
// volume is created and mounted for now.
documents_provider_volume_ =
std::make_unique<DocumentsProviderTestVolume>(
arc_file_system_instance_.get(), "com.example.documents",
"root", false /* read_only */);
if (opts.mount_volumes) {
if (options.mount_volumes) {
documents_provider_volume_->Mount(profile());
}
}
......@@ -1692,13 +1692,13 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
// When ARC is not available, "Android Files" will not be mounted.
// We need to mount testing volume here.
android_files_volume_ = std::make_unique<AndroidFilesTestVolume>();
if (opts.mount_volumes) {
if (options.mount_volumes) {
android_files_volume_->Mount(profile());
}
}
if (opts.guest_mode != IN_INCOGNITO) {
if (opts.observe_file_tasks) {
if (options.guest_mode != IN_INCOGNITO) {
if (options.observe_file_tasks) {
file_tasks_observer_ =
std::make_unique<testing::StrictMock<MockFileTasksObserver>>(
profile());
......@@ -1708,7 +1708,7 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
}
}
if (opts.smbfs) {
if (options.smbfs) {
smbfs_volume_ = std::make_unique<SmbfsTestVolume>();
}
......@@ -1717,7 +1717,7 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
content::NetworkConnectionChangeSimulator network_change_simulator;
network_change_simulator.SetConnectionType(
opts.offline ? network::mojom::ConnectionType::CONNECTION_NONE
options.offline ? network::mojom::ConnectionType::CONNECTION_NONE
: network::mojom::ConnectionType::CONNECTION_ETHERNET);
// The test resources are setup: enable and add default ChromeOS component
......@@ -1725,7 +1725,7 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
test::AddDefaultComponentExtensionsOnMainThread(profile());
// For tablet mode tests, enable the Ash virtual keyboard.
if (opts.tablet_mode) {
if (options.tablet_mode) {
EnableVirtualKeyboard();
}
......@@ -1807,14 +1807,15 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
const base::DictionaryValue& value,
std::string* output)
NO_THREAD_SAFETY_ANALYSIS {
const Options opts = GetOptions();
const Options options = GetOptions();
base::ScopedAllowBlockingForTesting allow_blocking;
if (name == "isInGuestMode") {
// Obtain if the test runs in guest or incognito mode.
LOG(INFO) << GetTestCaseName() << " is in " << opts.guest_mode << " mode";
*output = opts.guest_mode == NOT_IN_GUEST_MODE ? "false" : "true";
LOG(INFO) << GetTestCaseName() << " is in " << options.guest_mode
<< " mode";
*output = options.guest_mode == NOT_IN_GUEST_MODE ? "false" : "true";
return;
}
......@@ -1847,7 +1848,7 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
}
if (name == "zipArchiverLoaded") {
if (opts.zip) {
if (options.zip) {
LOG(INFO) << "Preloading zip archiver NaCl module";
auto event = std::make_unique<extensions::Event>(
extensions::events::FOR_TEST,
......@@ -1929,7 +1930,7 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
if (drive_volume_) {
drive_volume_->CreateEntry(*message.entries[i]);
} else {
CHECK_EQ(opts.guest_mode, IN_GUEST_MODE)
CHECK_EQ(options.guest_mode, IN_GUEST_MODE)
<< "Add entry, but no Drive volume";
}
break;
......@@ -2357,7 +2358,7 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
}
if (name == "isSmbEnabled") {
*output = opts.native_smb ? "true" : "false";
*output = options.native_smb ? "true" : "false";
return;
}
......@@ -2456,22 +2457,22 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
drive::DriveIntegrationService*
FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) {
const Options opts = GetOptions();
const Options options = GetOptions();
drive_volumes_[profile->GetOriginalProfile()] =
std::make_unique<DriveFsTestVolume>(profile->GetOriginalProfile());
if (opts.guest_mode != IN_INCOGNITO && opts.mount_volumes &&
if (options.guest_mode != IN_INCOGNITO && options.mount_volumes &&
profile->GetPath().BaseName().value() == "user") {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(base::IgnoreResult(&LocalTestVolume::Mount),
base::Unretained(local_volume_.get()), profile));
}
if (!opts.mount_volumes) {
if (!options.mount_volumes) {
profile->GetPrefs()->SetBoolean(drive::prefs::kDriveFsPinnedMigrated, true);
}
auto* integration_service = drive_volumes_[profile->GetOriginalProfile()]
->CreateDriveIntegrationService(profile);
if (!opts.mount_volumes) {
if (!options.mount_volumes) {
integration_service->SetEnabled(false);
}
return integration_service;
......
......@@ -189,7 +189,7 @@ class FileManagerBrowserTestBase : public extensions::ExtensionApiTest {
std::ostream& operator<<(std::ostream& out, GuestMode mode);
std::ostream& operator<<(std::ostream& out,
const FileManagerBrowserTestBase::Options& opts);
const FileManagerBrowserTestBase::Options& options);
} // namespace file_manager
......
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