Commit 5146073d authored by David Bertoni's avatar David Bertoni Committed by Commit Bot

[Extensions] Re-enable a Download API test on Mac.

The DownloadExtensionTest_Download_InvalidURLs was timing out
on Mac and causing a free-after-use issue on Asan builds.
Splitting the test into two parts has fixed the issue with
timeouts. The Asan failure is no longer present.

The tests passed 3000 iterations on the bots without any issues.

Bug: 392288
Change-Id: I90416d1fc9e0a6621f6ea3b3bf737a66cc2bb5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2229321
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: default avatarKelvin Jiang <kelvinjiang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780121}
parent 33ebf710
...@@ -1993,19 +1993,10 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, ...@@ -1993,19 +1993,10 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
download_url.c_str())).c_str()); download_url.c_str())).c_str());
} }
// flaky on mac: crbug.com/392288
#if defined(OS_MACOSX)
#define MAYBE_DownloadExtensionTest_Download_InvalidURLs \
DISABLED_DownloadExtensionTest_Download_InvalidURLs
#else
#define MAYBE_DownloadExtensionTest_Download_InvalidURLs \
DownloadExtensionTest_Download_InvalidURLs
#endif
class DownloadExtensionTestWithFtp : public DownloadExtensionTest { class DownloadExtensionTestWithFtp : public DownloadExtensionTest {
public: public:
DownloadExtensionTestWithFtp() { DownloadExtensionTestWithFtp() {
// DownloadExtensionTest_Download_InvalidURLs requires FTP support. // DownloadExtensionTest_Download_InvalidURLs2 requires FTP support.
// TODO(https://crbug.com/333943): Remove FTP tests and FTP feature flags. // TODO(https://crbug.com/333943): Remove FTP tests and FTP feature flags.
scoped_feature_list_.InitAndEnableFeature(features::kFtpProtocol); scoped_feature_list_.InitAndEnableFeature(features::kFtpProtocol);
} }
...@@ -2016,27 +2007,27 @@ class DownloadExtensionTestWithFtp : public DownloadExtensionTest { ...@@ -2016,27 +2007,27 @@ class DownloadExtensionTestWithFtp : public DownloadExtensionTest {
// Test that downloading invalid URLs immediately returns kInvalidURLError. // Test that downloading invalid URLs immediately returns kInvalidURLError.
IN_PROC_BROWSER_TEST_F(DownloadExtensionTestWithFtp, IN_PROC_BROWSER_TEST_F(DownloadExtensionTestWithFtp,
MAYBE_DownloadExtensionTest_Download_InvalidURLs) { DownloadExtensionTest_Download_InvalidURLs1) {
LoadExtension("downloads_split"); static constexpr const char* kInvalidURLs[] = {
GoOnTheRecord(); "foo bar", "../hello", "/hello", "http://",
"#frag", "foo/bar.html#frag", "google.com/",
static const char* const kInvalidURLs[] = {
"foo bar",
"../hello",
"/hello",
"http://",
"#frag",
"foo/bar.html#frag",
"google.com/",
}; };
for (size_t index = 0; index < base::size(kInvalidURLs); ++index) { for (const char* url : kInvalidURLs) {
EXPECT_STREQ(errors::kInvalidURL, EXPECT_STREQ(errors::kInvalidURL,
RunFunctionAndReturnError(new DownloadsDownloadFunction(), RunFunctionAndReturnError(
base::StringPrintf( new DownloadsDownloadFunction(),
"[{\"url\": \"%s\"}]", kInvalidURLs[index])).c_str()) base::StringPrintf("[{\"url\": \"%s\"}]", url))
<< kInvalidURLs[index]; .c_str())
<< url;
} }
}
// Test various failure modes for downloading invalid URLs.
IN_PROC_BROWSER_TEST_F(DownloadExtensionTestWithFtp,
DownloadExtensionTest_Download_InvalidURLs2) {
LoadExtension("downloads_split");
GoOnTheRecord();
int result_id = -1; int result_id = -1;
std::unique_ptr<base::Value> result(RunFunctionAndReturnResult( std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
......
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