Commit fd3b3910 authored by Quang Minh Tuan Nguyen's avatar Quang Minh Tuan Nguyen Committed by Commit Bot

Convert to RepeatingCallback in download item

I tried to convert it to OnceCallback, but had problem with circular_deque https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8875545102440823552/+/steps/compile__with_patch_/0/logs/raw_io.output_failure_summary_/0

I guess we should go with RepeatingCallback here

Bug: 1007685
Change-Id: I16a77c2f9a19f982249220adad1a9fb2dbbf7507
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2282143Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Quang Minh Tuan Nguyen <nqmtuan@google.com>
Cr-Commit-Position: refs/heads/master@{#785305}
parent f81327e4
......@@ -2259,7 +2259,7 @@ TEST_F(DownloadItemTest, AnnotationWithEmptyURLInIncognito) {
// various permutations of observer calls that will then be applied to a
// DownloadItem in a state as yet undetermined.
using CurriedObservation =
base::Callback<void(base::WeakPtr<DownloadDestinationObserver>)>;
base::RepeatingCallback<void(base::WeakPtr<DownloadDestinationObserver>)>;
// A list of observations that are to be made during some event in the
// DownloadItemImpl control flow. Ordering of the observations is significant.
......@@ -2369,17 +2369,17 @@ std::vector<EventList> DistributeObservationsIntoEvents(
std::vector<EventList> GenerateSuccessfulEventLists() {
std::vector<CurriedObservation> all_observations;
all_observations.push_back(base::Bind(&DestinationUpdateInvoker, 100, 100));
all_observations.push_back(base::Bind(&DestinationUpdateInvoker, 200, 100));
all_observations.push_back(base::Bind(&DestinationCompletedInvoker, 200));
all_observations.push_back(base::BindRepeating(&DestinationUpdateInvoker, 100, 100));
all_observations.push_back(base::BindRepeating(&DestinationUpdateInvoker, 200, 100));
all_observations.push_back(base::BindRepeating(&DestinationCompletedInvoker, 200));
return DistributeObservationsIntoEvents(all_observations.begin(),
all_observations.end(), kEventCount);
}
std::vector<EventList> GenerateFailingEventLists() {
std::vector<CurriedObservation> all_observations;
all_observations.push_back(base::Bind(&DestinationUpdateInvoker, 100, 100));
all_observations.push_back(base::Bind(
all_observations.push_back(base::BindRepeating(&DestinationUpdateInvoker, 100, 100));
all_observations.push_back(base::BindRepeating(
&DestinationErrorInvoker, DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, 100));
return DistributeObservationsIntoEvents(all_observations.begin(),
all_observations.end(), kEventCount);
......
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