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

Add FilesAppBrowserTestBase harness support for zip/unzip testing

Add support enabling zip/unzip in the integration test base class. Any
derived class can request support in test by overriding method:

  GetNeedsZipSupport()

The default implementation returns false. Add ZipCase derived from the
TestCase class, and an overriden method, in the FileManagerBrowserTest
class. Future TODO: write test to exercise zip/unzip support.

Bug: 864256,865197,836412
Change-Id: I3dc5b17023506ef3a2fa57611fff16ee68ead43e
Reviewed-on: https://chromium-review.googlesource.com/1149438Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577814}
parent 349ec49c
...@@ -78,6 +78,7 @@ struct TestCase { ...@@ -78,6 +78,7 @@ struct TestCase {
bool tablet_mode = false; bool tablet_mode = false;
bool enable_drivefs = false; bool enable_drivefs = false;
bool with_browser = false; bool with_browser = false;
bool needs_zip = false;
}; };
// EventCase: FilesAppBrowserTest with trusted JS Events. // EventCase: FilesAppBrowserTest with trusted JS Events.
...@@ -87,6 +88,13 @@ struct EventCase : public TestCase { ...@@ -87,6 +88,13 @@ struct EventCase : public TestCase {
} }
}; };
// ZipCase: FilesAppBrowserTest with zip/unzip support.
struct ZipCase : public TestCase {
explicit ZipCase(const char* name) : TestCase(name) {
needs_zip = true;
}
};
// FilesApp browser test. // FilesApp browser test.
class FilesAppBrowserTest : public FileManagerBrowserTestBase, class FilesAppBrowserTest : public FileManagerBrowserTestBase,
public ::testing::WithParamInterface<TestCase> { public ::testing::WithParamInterface<TestCase> {
...@@ -130,6 +138,10 @@ class FilesAppBrowserTest : public FileManagerBrowserTestBase, ...@@ -130,6 +138,10 @@ class FilesAppBrowserTest : public FileManagerBrowserTestBase,
return GetParam().with_browser; return GetParam().with_browser;
} }
bool GetNeedsZipSupport() const override {
return GetParam().needs_zip;
}
private: private:
DISALLOW_COPY_AND_ASSIGN(FilesAppBrowserTest); DISALLOW_COPY_AND_ASSIGN(FilesAppBrowserTest);
}; };
......
...@@ -924,9 +924,10 @@ void FileManagerBrowserTestBase::SetUpCommandLine( ...@@ -924,9 +924,10 @@ void FileManagerBrowserTestBase::SetUpCommandLine(
command_line->AppendSwitch(switches::kIncognito); command_line->AppendSwitch(switches::kIncognito);
} }
// Block NaCl loading Files.app components crbug.com/788671 if (!IsZipTest()) { // Block NaCl use unless needed crbug.com/788671
command_line->AppendSwitch(chromeos::switches::kDisableZipArchiverUnpacker); command_line->AppendSwitch(chromeos::switches::kDisableZipArchiverUnpacker);
command_line->AppendSwitch(chromeos::switches::kDisableZipArchiverPacker); command_line->AppendSwitch(chromeos::switches::kDisableZipArchiverPacker);
}
std::vector<base::Feature> enabled_features; std::vector<base::Feature> enabled_features;
if (!IsGuestModeTest()) { if (!IsGuestModeTest()) {
...@@ -1044,6 +1045,10 @@ bool FileManagerBrowserTestBase::GetRequiresStartupBrowser() const { ...@@ -1044,6 +1045,10 @@ bool FileManagerBrowserTestBase::GetRequiresStartupBrowser() const {
return false; return false;
} }
bool FileManagerBrowserTestBase::GetNeedsZipSupport() const {
return false;
}
void FileManagerBrowserTestBase::StartTest() { void FileManagerBrowserTestBase::StartTest() {
LOG(INFO) << "FileManagerBrowserTest::StartTest " << GetFullTestCaseName(); LOG(INFO) << "FileManagerBrowserTest::StartTest " << GetFullTestCaseName();
static const base::FilePath test_extension_dir = static const base::FilePath test_extension_dir =
......
...@@ -45,6 +45,7 @@ class FileManagerBrowserTestBase : public extensions::ExtensionApiTest { ...@@ -45,6 +45,7 @@ class FileManagerBrowserTestBase : public extensions::ExtensionApiTest {
virtual const char* GetTestExtensionManifestName() const = 0; virtual const char* GetTestExtensionManifestName() const = 0;
virtual bool GetEnableDriveFs() const; virtual bool GetEnableDriveFs() const;
virtual bool GetRequiresStartupBrowser() const; virtual bool GetRequiresStartupBrowser() const;
virtual bool GetNeedsZipSupport() const;
// Launches the test extension from GetTestExtensionManifestName() and uses // Launches the test extension from GetTestExtensionManifestName() and uses
// it to drive the testing the actual FileManager component extension under // it to drive the testing the actual FileManager component extension under
...@@ -61,6 +62,9 @@ class FileManagerBrowserTestBase : public extensions::ExtensionApiTest { ...@@ -61,6 +62,9 @@ class FileManagerBrowserTestBase : public extensions::ExtensionApiTest {
// Returns true if the test requires DriveFS. // Returns true if the test requires DriveFS.
bool IsDriveFsTest() const { return GetEnableDriveFs(); } bool IsDriveFsTest() const { return GetEnableDriveFs(); }
// Returns true if the test requires zip/unzip support.
bool IsZipTest() const { return GetNeedsZipSupport(); }
// Launches the test extension with manifest |manifest_name|. The extension // Launches the test extension with manifest |manifest_name|. The extension
// manifest_name file should reside in the specified |path| relative to the // manifest_name file should reside in the specified |path| relative to the
// Chromium src directory. // Chromium src directory.
......
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