diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc index 20d59cb..fe3a9ff 100644 --- a/base/files/file_posix.cc +++ b/base/files/file_posix.cc
@@ -424,6 +424,8 @@ UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Posix", saved_errno); #endif + // This function should only be called for errors. + DCHECK_NE(0, saved_errno); return FILE_ERROR_FAILED; } }
diff --git a/base/files/file_win.cc b/base/files/file_win.cc index 3f5547d..fc437158 100644 --- a/base/files/file_win.cc +++ b/base/files/file_win.cc
@@ -312,6 +312,8 @@ default: UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows", last_error); + // This function should only be called for errors. + DCHECK_NE(static_cast<DWORD>(ERROR_SUCCESS), last_error); return FILE_ERROR_FAILED; } }
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index e239a92..e45ac55 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -357,8 +357,7 @@ explicit HistoryObserver(Profile* profile) : profile_(profile), waiting_(false), - seen_stored_(false), - minimum_received_bytes_(kNoMinimumReceivedBytes) { + seen_stored_(false) { DownloadCoreServiceFactory::GetForBrowserContext(profile_) ->GetDownloadHistory() ->AddObserver(this); @@ -371,10 +370,6 @@ service->GetDownloadHistory()->RemoveObserver(this); } - void set_minimum_received_bytes(int64_t minimum_received_bytes) { - minimum_received_bytes_ = minimum_received_bytes; - } - void SetFilterCallback(const FilterCallback& callback) { callback_ = callback; } @@ -384,11 +379,6 @@ if (!callback_.is_null() && (!callback_.Run(info))) return; - if (minimum_received_bytes_ != kNoMinimumReceivedBytes && - info.received_bytes < minimum_received_bytes_) { - return; - } - seen_stored_ = true; if (waiting_) base::RunLoop::QuitCurrentWhenIdleDeprecated(); @@ -409,11 +399,9 @@ } private: - static const int64_t kNoMinimumReceivedBytes = -1; Profile* profile_; bool waiting_; bool seen_stored_; - int64_t minimum_received_bytes_; FilterCallback callback_; DISALLOW_COPY_AND_ASSIGN(HistoryObserver); @@ -1855,7 +1843,13 @@ return std::move(response); } -IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { +#if defined(OS_WIN) +// https://crbug.com/788160 +#define MAYBE_DownloadHistoryCheck DISABLED_DownloadHistoryCheck +#else +#define MAYBE_DownloadHistoryCheck DownloadHistoryCheck +#endif +IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadHistoryCheck) { // Rediret to the actual download URL. embedded_test_server()->RegisterRequestHandler( base::Bind(&ServerRedirectRequestHandler)); @@ -1890,8 +1884,6 @@ base::Time start(base::Time::Now()); HistoryObserver observer(browser()->profile()); observer.SetFilterCallback(base::Bind(&HasDataAndName)); - observer.set_minimum_received_bytes( - content::SlowDownloadHttpResponse::kFirstDownloadSize); ui_test_utils::NavigateToURL(browser(), redirect_url); observer.WaitForStored();