OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 .WillOnce(QuitLoopNowAction()); | 1079 .WillOnce(QuitLoopNowAction()); |
1080 StartSyncScheduler(SyncScheduler::NORMAL_MODE); | 1080 StartSyncScheduler(SyncScheduler::NORMAL_MODE); |
1081 MessageLoop::current()->RunAllPending(); | 1081 MessageLoop::current()->RunAllPending(); |
1082 | 1082 |
1083 scheduler()->ScheduleNudge( | 1083 scheduler()->ScheduleNudge( |
1084 zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); | 1084 zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); |
1085 // Should save the nudge for until after the server is reachable. | 1085 // Should save the nudge for until after the server is reachable. |
1086 MessageLoop::current()->RunAllPending(); | 1086 MessageLoop::current()->RunAllPending(); |
1087 | 1087 |
1088 connection()->SetServerReachable(); | 1088 connection()->SetServerReachable(); |
1089 scheduler()->OnConnectionStatusChange(); | 1089 scheduler()->OnServerConnectionErrorFixed(); |
1090 MessageLoop::current()->RunAllPending(); | 1090 MessageLoop::current()->RunAllPending(); |
1091 } | 1091 } |
1092 | 1092 |
1093 TEST_F(SyncSchedulerTest, SetsPreviousRoutingInfo) { | 1093 TEST_F(SyncSchedulerTest, SetsPreviousRoutingInfo) { |
1094 ModelSafeRoutingInfo info; | 1094 ModelSafeRoutingInfo info; |
1095 EXPECT_TRUE(info == context()->previous_session_routing_info()); | 1095 EXPECT_TRUE(info == context()->previous_session_routing_info()); |
1096 ModelSafeRoutingInfo expected; | 1096 ModelSafeRoutingInfo expected; |
1097 context()->registrar()->GetModelSafeRoutingInfo(&expected); | 1097 context()->registrar()->GetModelSafeRoutingInfo(&expected); |
1098 ASSERT_FALSE(expected.empty()); | 1098 ASSERT_FALSE(expected.empty()); |
1099 EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(1); | 1099 EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(1); |
1100 | 1100 |
1101 StartSyncScheduler(SyncScheduler::NORMAL_MODE); | 1101 StartSyncScheduler(SyncScheduler::NORMAL_MODE); |
1102 RunLoop(); | 1102 RunLoop(); |
1103 | 1103 |
1104 scheduler()->ScheduleNudge( | 1104 scheduler()->ScheduleNudge( |
1105 zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); | 1105 zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); |
1106 PumpLoop(); | 1106 PumpLoop(); |
1107 // Pump again to run job. | 1107 // Pump again to run job. |
1108 PumpLoop(); | 1108 PumpLoop(); |
1109 | 1109 |
1110 StopSyncScheduler(); | 1110 StopSyncScheduler(); |
1111 | 1111 |
1112 EXPECT_TRUE(expected == context()->previous_session_routing_info()); | 1112 EXPECT_TRUE(expected == context()->previous_session_routing_info()); |
1113 } | 1113 } |
1114 | 1114 |
1115 } // namespace browser_sync | 1115 } // namespace browser_sync |
OLD | NEW |