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

Unified Diff: components/arc/arc_bridge_service_unittest.cc

Issue 2582003002: Refactor ArcBridgeServiceImpl part 1. (Closed)
Patch Set: Fix the latest bug. Created 4 years 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
« no previous file with comments | « components/arc/arc_bridge_service_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service_unittest.cc
diff --git a/components/arc/arc_bridge_service_unittest.cc b/components/arc/arc_bridge_service_unittest.cc
index 14560f44d42e1fb494e5bd6d718df07fd00ffacd..f7eb09d5b050a9f97ecdc028e6bbb0a00e71d566 100644
--- a/components/arc/arc_bridge_service_unittest.cc
+++ b/components/arc/arc_bridge_service_unittest.cc
@@ -155,7 +155,7 @@ TEST_F(ArcBridgeTest, BootFailure) {
// If the instance is stopped, it should be re-started.
TEST_F(ArcBridgeTest, Restart) {
- arc_bridge_service()->DisableReconnectDelayForTesting();
+ arc_bridge_service()->SetRestartDelayForTesting(base::TimeDelta());
EXPECT_TRUE(arc_bridge_service()->stopped());
arc_bridge_service()->RequestStart();
@@ -164,6 +164,8 @@ TEST_F(ArcBridgeTest, Restart) {
// Simulate a connection loss.
ASSERT_TRUE(arc_session());
arc_session()->StopWithReason(StopReason::CRASH);
+ EXPECT_TRUE(arc_bridge_service()->stopped());
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(arc_bridge_service()->ready());
arc_bridge_service()->RequestStop();
@@ -172,7 +174,7 @@ TEST_F(ArcBridgeTest, Restart) {
// Makes sure OnSessionStopped is called on stop.
TEST_F(ArcBridgeTest, OnSessionStopped) {
- arc_bridge_service()->DisableReconnectDelayForTesting();
+ arc_bridge_service()->SetRestartDelayForTesting(base::TimeDelta());
EXPECT_TRUE(arc_bridge_service()->stopped());
arc_bridge_service()->RequestStart();
@@ -182,12 +184,16 @@ TEST_F(ArcBridgeTest, OnSessionStopped) {
ASSERT_TRUE(arc_session());
arc_session()->StopWithReason(StopReason::GENERIC_BOOT_FAILURE);
EXPECT_EQ(StopReason::GENERIC_BOOT_FAILURE, stop_reason());
+ EXPECT_TRUE(arc_bridge_service()->stopped());
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(arc_bridge_service()->ready());
// Simulate crash.
ASSERT_TRUE(arc_session());
arc_session()->StopWithReason(StopReason::CRASH);
EXPECT_EQ(StopReason::CRASH, stop_reason());
+ EXPECT_TRUE(arc_bridge_service()->stopped());
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(arc_bridge_service()->ready());
// Graceful stop.
@@ -197,7 +203,7 @@ TEST_F(ArcBridgeTest, OnSessionStopped) {
}
TEST_F(ArcBridgeTest, Shutdown) {
- arc_bridge_service()->DisableReconnectDelayForTesting();
+ arc_bridge_service()->SetRestartDelayForTesting(base::TimeDelta());
EXPECT_TRUE(arc_bridge_service()->stopped());
arc_bridge_service()->RequestStart();
« no previous file with comments | « components/arc/arc_bridge_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698