| Index: chromecast/base/component/component_unittest.cc
|
| diff --git a/chromecast/base/component/component_unittest.cc b/chromecast/base/component/component_unittest.cc
|
| index 96b58e7e3fe8b83b1b8c8d049cb829875c670c73..60348cd08702ba2b316501e53706c8de93b82ef4 100644
|
| --- a/chromecast/base/component/component_unittest.cc
|
| +++ b/chromecast/base/component/component_unittest.cc
|
| @@ -6,7 +6,6 @@
|
|
|
| #include <memory>
|
|
|
| -#include "base/location.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| @@ -182,7 +181,7 @@ TEST_F(ComponentDeathTest, TransitiveCircularDependency) {
|
| TEST_F(ComponentTest, SimpleEnable) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -192,7 +191,7 @@ TEST_F(ComponentTest, TransitiveEnable) {
|
| std::unique_ptr<ComponentB> b(new ComponentB(a->GetRef()));
|
| std::unique_ptr<ComponentC> c(new ComponentC(b->GetRef()));
|
| c->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| EXPECT_TRUE(b->enabled());
|
| EXPECT_TRUE(c->enabled());
|
| @@ -205,7 +204,7 @@ TEST_F(ComponentTest, FailEnable) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->FailEnable();
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -216,7 +215,7 @@ TEST_F(ComponentTest, TransitiveFailEnable) {
|
| std::unique_ptr<ComponentC> c(new ComponentC(b->GetRef()));
|
| a->FailEnable();
|
| c->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| EXPECT_FALSE(b->enabled());
|
| EXPECT_FALSE(c->enabled());
|
| @@ -229,7 +228,7 @@ TEST_F(ComponentTest, DisableWhileEnabling) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Enable();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -238,7 +237,7 @@ TEST_F(ComponentTest, EnableTwice) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Enable();
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -246,13 +245,13 @@ TEST_F(ComponentTest, EnableTwice) {
|
| TEST_F(ComponentTest, DisableTwice) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -261,10 +260,10 @@ TEST_F(ComponentTest, DisableAfterFailedEnable) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->FailEnable();
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -272,7 +271,7 @@ TEST_F(ComponentTest, DisableAfterFailedEnable) {
|
| TEST_F(ComponentTest, DisableAfterNeverEnabled) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -282,10 +281,10 @@ TEST_F(ComponentTest, DisableDependencyWhileEnabling) {
|
| std::unique_ptr<ComponentB> b(new ComponentB(a->GetRef()));
|
| std::unique_ptr<ComponentC> c(new ComponentC(b->GetRef()));
|
| b->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| c->Enable();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| EXPECT_FALSE(b->enabled());
|
| EXPECT_FALSE(c->enabled());
|
| @@ -299,7 +298,7 @@ TEST_F(ComponentTest, EnableDisableEnable) {
|
| a->Enable();
|
| a->Disable();
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -307,12 +306,12 @@ TEST_F(ComponentTest, EnableDisableEnable) {
|
| TEST_F(ComponentTest, DisableEnableDisable) {
|
| std::unique_ptr<ComponentA> a(new ComponentA());
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| a->Disable();
|
| a->Enable();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| a.release()->Destroy();
|
| }
|
| @@ -322,15 +321,15 @@ TEST_F(ComponentTest, TransitiveEnableDisableEnable) {
|
| std::unique_ptr<ComponentB> b(new ComponentB(a->GetRef()));
|
| std::unique_ptr<ComponentC> c(new ComponentC(b->GetRef()));
|
| a->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| c->Enable();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| EXPECT_FALSE(b->enabled());
|
| EXPECT_FALSE(c->enabled());
|
| c->Enable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(a->enabled());
|
| EXPECT_TRUE(b->enabled());
|
| EXPECT_TRUE(c->enabled());
|
| @@ -345,11 +344,11 @@ TEST_F(ComponentTest, WeakRefs) {
|
| EXPECT_FALSE(weak.Try());
|
| a->Enable();
|
| EXPECT_FALSE(weak.Try());
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(weak.Try());
|
| weak.Try()->Test();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(weak.Try());
|
| a.release()->Destroy();
|
| }
|
| @@ -360,17 +359,17 @@ TEST_F(ComponentTest, WeakRefsKeepEnabled) {
|
| EXPECT_FALSE(weak.Try());
|
| a->Enable();
|
| EXPECT_FALSE(weak.Try());
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| {
|
| auto held_ref = weak.Try();
|
| EXPECT_TRUE(held_ref);
|
| held_ref->Test();
|
| a->Disable();
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| // The held ref keeps |a| enabled until it goes out of scope.
|
| EXPECT_TRUE(a->enabled());
|
| }
|
| - message_loop_->RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(a->enabled());
|
| EXPECT_FALSE(weak.Try());
|
| a.release()->Destroy();
|
|
|