Commit 3f007ba7 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove test-only callback from BackgroundFetchDelegateImpl

It can be replaced with TestUkmRecorder::SetOnAddEntryCallback

Bug: 1057770
Change-Id: If49262570bfbfeb90b5d090c42ece84b804c1c5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216800Reviewed-by: default avatarMugdha Lakhani <nator@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774724}
parent e34cd041
......@@ -427,9 +427,6 @@ void BackgroundFetchDelegateImpl::DidGetBackgroundSourceId(
ukm::builders::BackgroundFetchDeletingRegistration(*source_id)
.SetUserInitiatedAbort(user_initiated_abort)
.Record(ukm::UkmRecorder::Get());
if (ukm_event_recorded_for_testing_)
std::move(ukm_event_recorded_for_testing_).Run();
}
void BackgroundFetchDelegateImpl::MarkJobComplete(
......
......@@ -131,10 +131,6 @@ class BackgroundFetchDelegateImpl
void GetUploadData(const std::string& download_guid,
download::GetUploadDataCallback callback);
void set_ukm_event_recorded_for_testing(base::OnceClosure closure) {
ukm_event_recorded_for_testing_ = std::move(closure);
}
base::WeakPtr<BackgroundFetchDelegateImpl> GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
......@@ -289,9 +285,6 @@ class BackgroundFetchDelegateImpl
// Set of Observers to be notified of any changes to the shown notifications.
std::set<Observer*> observers_;
// Testing-only closure to inform tests when a UKM event has been recorded.
base::OnceClosure ukm_event_recorded_for_testing_;
base::WeakPtrFactory<BackgroundFetchDelegateImpl> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDelegateImpl);
......
......@@ -46,12 +46,6 @@ class BackgroundFetchDelegateImplTest : public testing::Test {
history::SOURCE_BROWSED);
}
void WaitForUkmEvent() {
base::RunLoop run_loop;
delegate_->set_ukm_event_recorded_for_testing(run_loop.QuitClosure());
run_loop.Run();
}
protected:
// This is used to specify the main thread type of the tests as the UI
// thread.
......@@ -72,9 +66,13 @@ TEST_F(BackgroundFetchDelegateImplTest, RecordUkmEvent) {
EXPECT_EQ(entries.size(), 0u);
}
base::RunLoop run_loop;
recorder_->SetOnAddEntryCallback(
ukm::builders::BackgroundFetchDeletingRegistration::kEntryName,
run_loop.QuitClosure());
delegate_->RecordBackgroundFetchDeletingRegistrationUkmEvent(
origin, /* user_initiated_abort= */ true);
WaitForUkmEvent();
run_loop.Run();
{
std::vector<const ukm::mojom::UkmEntry*> entries =
......
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