Index: ui/app_list/pagination_model_unittest.cc |
diff --git a/ui/app_list/pagination_model_unittest.cc b/ui/app_list/pagination_model_unittest.cc |
index 873e434440f440bb6c7925d411f74853399572ad..fd5bcb2e1a57545fb7d993530a490c509ccd39b4 100644 |
--- a/ui/app_list/pagination_model_unittest.cc |
+++ b/ui/app_list/pagination_model_unittest.cc |
@@ -9,6 +9,7 @@ |
#include "base/compiler_specific.h" |
#include "base/macros.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
#include "base/strings/string_number_conversions.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/app_list/pagination_model_observer.h" |
@@ -171,7 +172,7 @@ TEST_F(PaginationModelTest, SelectPageAnimated) { |
// One transition. |
SetStartPageAndExpects(kStartPage, 1, 0, 0); |
pagination_.SelectPage(1, true /* animate */); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.transition_start_count()); |
EXPECT_EQ(1, observer_.transition_end_count()); |
EXPECT_EQ(1, observer_.selection_count()); |
@@ -181,7 +182,7 @@ TEST_F(PaginationModelTest, SelectPageAnimated) { |
SetStartPageAndExpects(kStartPage, 2, 0, 0); |
pagination_.SelectPage(1, true /* animate */); |
pagination_.SelectPage(3, true /* animate */); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(2, observer_.transition_start_count()); |
EXPECT_EQ(2, observer_.transition_end_count()); |
EXPECT_EQ(2, observer_.selection_count()); |
@@ -191,7 +192,7 @@ TEST_F(PaginationModelTest, SelectPageAnimated) { |
SetStartPageAndExpects(kStartPage, 1, 0, 0); |
pagination_.SelectPage(1, true /* animate */); |
pagination_.SelectPage(1, true /* animate */); // Ignored. |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.transition_start_count()); |
EXPECT_EQ(1, observer_.transition_end_count()); |
EXPECT_EQ(1, observer_.selection_count()); |
@@ -203,7 +204,7 @@ TEST_F(PaginationModelTest, SelectPageAnimated) { |
pagination_.SelectPage(3, true /* animate */); // Ignored |
pagination_.SelectPage(4, true /* animate */); // Ignored |
pagination_.SelectPage(2, true /* animate */); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(2, observer_.transition_start_count()); |
EXPECT_EQ(2, observer_.transition_end_count()); |
EXPECT_EQ(2, observer_.selection_count()); |
@@ -218,7 +219,7 @@ TEST_F(PaginationModelTest, SelectPageAnimated) { |
pagination_.SelectPage(2, true /* animate */); // Ignored |
pagination_.SelectPage(kStartPage, true /* animate */); |
pagination_.SelectPage(3, true /* animate */); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("3"), observer_.selected_pages()); |
} |
@@ -231,7 +232,7 @@ TEST_F(PaginationModelTest, SimpleScroll) { |
pagination_.UpdateScroll(-0.1); |
EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); |
pagination_.EndScroll(false); // Finish transition |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
// Scroll to the previous page (positive delta) and finish it. |
@@ -240,7 +241,7 @@ TEST_F(PaginationModelTest, SimpleScroll) { |
pagination_.UpdateScroll(0.1); |
EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); |
pagination_.EndScroll(false); // Finish transition |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
// Scroll to the next page (negative delta) and cancel it. |
@@ -249,7 +250,7 @@ TEST_F(PaginationModelTest, SimpleScroll) { |
pagination_.UpdateScroll(-0.1); |
EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); |
pagination_.EndScroll(true); // Cancel transition |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, observer_.selection_count()); |
// Scroll to the previous page (position delta) and cancel it. |
@@ -258,7 +259,7 @@ TEST_F(PaginationModelTest, SimpleScroll) { |
pagination_.UpdateScroll(0.1); |
EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); |
pagination_.EndScroll(true); // Cancel transition |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, observer_.selection_count()); |
} |
@@ -274,7 +275,7 @@ TEST_F(PaginationModelTest, ScrollWithTransition) { |
EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); |
EXPECT_EQ(0.6, pagination_.transition().progress); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
// Scroll to the next page (negative delta) with a transition in a different |
@@ -296,7 +297,7 @@ TEST_F(PaginationModelTest, ScrollWithTransition) { |
EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); |
EXPECT_EQ(0.6, pagination_.transition().progress); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
// Scroll to the previous page (positive delta) with a transition in a |
@@ -326,7 +327,7 @@ TEST_F(PaginationModelTest, LongScroll) { |
pagination_.UpdateScroll(-0.5); |
EXPECT_EQ(kStartPage + 2, pagination_.transition().target_page); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(2, observer_.selection_count()); |
// Scroll to the next page (negative delta) with a transition in a different |
@@ -341,7 +342,7 @@ TEST_F(PaginationModelTest, LongScroll) { |
pagination_.UpdateScroll(-0.5); // This starts a new transition. |
EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
// Similar cases as above but in the opposite direction. |
@@ -358,7 +359,7 @@ TEST_F(PaginationModelTest, LongScroll) { |
pagination_.UpdateScroll(0.5); |
EXPECT_EQ(kStartPage - 2, pagination_.transition().target_page); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(2, observer_.selection_count()); |
// Scroll to the previous page (positive delta) with a transition in a |
@@ -373,7 +374,7 @@ TEST_F(PaginationModelTest, LongScroll) { |
pagination_.UpdateScroll(0.5); // This starts a new transition. |
EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); |
pagination_.EndScroll(false); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, observer_.selection_count()); |
} |