Index: chrome/browser/history/android/sqlite_cursor_unittest.cc |
diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc |
index 082653ac916cd09f8e4a66b049953371a49655d9..4d1a26085b18cd882c0c278b322b526aa6a062e7 100644 |
--- a/chrome/browser/history/android/sqlite_cursor_unittest.cc |
+++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc |
@@ -11,6 +11,7 @@ |
#include "base/android/jni_array.h" |
#include "base/android/jni_string.h" |
#include "base/macros.h" |
+#include "base/run_loop.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/task/cancelable_task_tracker.h" |
#include "base/time/time.h" |
@@ -80,16 +81,28 @@ class SQLiteCursorTest : public testing::Test, |
} |
// Override SQLiteCursor::TestObserver. |
- void OnPostMoveToTask() override { base::MessageLoop::current()->Run(); } |
+ void OnPostMoveToTask() override { |
+ ASSERT_FALSE(run_loop_); |
+ run_loop_ = base::MakeUnique<base::RunLoop>(); |
+ run_loop_->Run(); |
+ run_loop_ = nullptr; |
+ } |
void OnGetMoveToResult() override { |
- base::MessageLoop::current()->QuitWhenIdle(); |
+ ASSERT_TRUE(run_loop_); |
+ run_loop_->QuitWhenIdle(); |
} |
- void OnPostGetFaviconTask() override { base::MessageLoop::current()->Run(); } |
+ void OnPostGetFaviconTask() override { |
+ ASSERT_FALSE(run_loop_); |
+ run_loop_ = base::MakeUnique<base::RunLoop>(); |
+ run_loop_->Run(); |
+ run_loop_ = nullptr; |
+ } |
void OnGetFaviconResult() override { |
- base::MessageLoop::current()->QuitWhenIdle(); |
+ ASSERT_TRUE(run_loop_); |
+ run_loop_->QuitWhenIdle(); |
} |
protected: |
@@ -101,6 +114,7 @@ class SQLiteCursorTest : public testing::Test, |
base::CancelableTaskTracker cancelable_tracker_; |
TestingProfile* testing_profile_; |
history::HistoryService* hs_; |
+ std::unique_ptr<base::RunLoop> run_loop_; |
private: |
DISALLOW_COPY_AND_ASSIGN(SQLiteCursorTest); |
@@ -165,7 +179,7 @@ TEST_F(SQLiteCursorTest, Run) { |
Bind(&CallbackHelper::OnInserted, callback.get()), |
&cancelable_tracker_); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(callback->success()); |
std::vector<HistoryAndBookmarkRow::ColumnID> projections; |
@@ -182,7 +196,7 @@ TEST_F(SQLiteCursorTest, Run) { |
std::string(), |
Bind(&CallbackHelper::OnQueryResult, callback.get()), |
&cancelable_tracker_); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
ASSERT_TRUE(callback->success()); |
AndroidStatement* statement = callback->statement(); |