Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: chrome/browser/download/download_path_reservation_tracker_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_path_reservation_tracker_unittest.cc
diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc
index 4f7272138d631a9f8d859211585e6fedd5b68514..b89230a5cc3395dcf8cc95de253aa4dc5a0f938f 100644
--- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc
+++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc
@@ -11,6 +11,7 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/observer_list.h"
+#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/test_file_util.h"
#include "build/build_config.h"
@@ -86,7 +87,7 @@ void DownloadPathReservationTrackerTest::SetUp() {
}
void DownloadPathReservationTrackerTest::TearDown() {
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
MockDownloadItem* DownloadPathReservationTrackerTest::CreateDownloadItem(
@@ -132,7 +133,7 @@ void DownloadPathReservationTrackerTest::CallGetReservedPath(
base::Bind(&DownloadPathReservationTrackerTest::TestReservedPathCallback,
weak_ptr_factory.GetWeakPtr(), return_path, return_verified,
&did_run_callback));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(did_run_callback);
}
@@ -187,7 +188,7 @@ TEST_F(DownloadPathReservationTrackerTest, BasicReservation) {
// Destroying the item should release the reservation.
SetDownloadItemState(item.get(), DownloadItem::COMPLETE);
item.reset();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
@@ -216,7 +217,7 @@ TEST_F(DownloadPathReservationTrackerTest, InterruptedDownload) {
// Once the download is interrupted, the path should become available again.
SetDownloadItemState(item.get(), DownloadItem::INTERRUPTED);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
@@ -248,7 +249,7 @@ TEST_F(DownloadPathReservationTrackerTest, CompleteDownload) {
// The path wouldn't be available since it is occupied on disk by the
// completed download.
SetDownloadItemState(item.get(), DownloadItem::COMPLETE);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
@@ -290,7 +291,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) {
SetDownloadItemState(item.get(), DownloadItem::COMPLETE);
item.reset();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
EXPECT_FALSE(IsPathInUse(reserved_path));
}
@@ -339,7 +340,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) {
EXPECT_EQ(uniquified_path.value(), reserved_path2.value());
SetDownloadItemState(item2.get(), DownloadItem::COMPLETE);
}
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
EXPECT_FALSE(IsPathInUse(uniquified_path));
@@ -360,7 +361,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) {
EXPECT_EQ(uniquified_path.value(), reserved_path2.value());
SetDownloadItemState(item2.get(), DownloadItem::COMPLETE);
}
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Now acquire an overwriting reservation. We should end up with the same
// non-uniquified path for both reservations.
@@ -585,7 +586,7 @@ TEST_F(DownloadPathReservationTrackerTest, UpdatesToTargetPath) {
// this state, we shouldn't lose the reservation.
ASSERT_EQ(base::FilePath::StringType(), item->GetTargetFilePath().value());
item->NotifyObserversDownloadUpdated();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
// If the target path changes, we should update the reservation to match.
@@ -595,14 +596,14 @@ TEST_F(DownloadPathReservationTrackerTest, UpdatesToTargetPath) {
EXPECT_CALL(*item, GetTargetFilePath())
.WillRepeatedly(ReturnRef(new_target_path));
item->NotifyObserversDownloadUpdated();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
EXPECT_TRUE(IsPathInUse(new_target_path));
// Destroying the item should release the reservation.
SetDownloadItemState(item.get(), DownloadItem::COMPLETE);
item.reset();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(IsPathInUse(new_target_path));
}

Powered by Google App Engine
This is Rietveld 408576698