| 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying | 
| 6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own | 
| 7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. | 
| 8 | 8 | 
| 9 #include <cstddef> | 9 #include <cstddef> | 
| 10 #include <map> | 10 #include <map> | 
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1268   DictionaryValue false_details; | 1268   DictionaryValue false_details; | 
| 1269   false_details.SetBoolean("enabled", false); | 1269   false_details.SetBoolean("enabled", false); | 
| 1270 | 1270 | 
| 1271   EXPECT_CALL(event_handler, | 1271   EXPECT_CALL(event_handler, | 
| 1272               HandleJsEvent("onNotificationStateChange", | 1272               HandleJsEvent("onNotificationStateChange", | 
| 1273                             HasDetailsAsDictionary(true_details))); | 1273                             HasDetailsAsDictionary(true_details))); | 
| 1274   EXPECT_CALL(event_handler, | 1274   EXPECT_CALL(event_handler, | 
| 1275               HandleJsEvent("onNotificationStateChange", | 1275               HandleJsEvent("onNotificationStateChange", | 
| 1276                             HasDetailsAsDictionary(false_details))); | 1276                             HasDetailsAsDictionary(false_details))); | 
| 1277 | 1277 | 
| 1278   sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1278   sync_manager_.SimulateEnableNotificationsForTest(); | 
| 1279   sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1279   sync_manager_.SimulateDisableNotificationsForTest( | 
|  | 1280       sync_notifier::TRANSIENT_NOTIFICATION_ERROR); | 
| 1280 | 1281 | 
| 1281   SetJsEventHandler(event_handler.AsWeakHandle()); | 1282   SetJsEventHandler(event_handler.AsWeakHandle()); | 
| 1282   sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1283   sync_manager_.SimulateEnableNotificationsForTest(); | 
| 1283   sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1284   sync_manager_.SimulateDisableNotificationsForTest( | 
|  | 1285       sync_notifier::TRANSIENT_NOTIFICATION_ERROR); | 
| 1284   SetJsEventHandler(WeakHandle<JsEventHandler>()); | 1286   SetJsEventHandler(WeakHandle<JsEventHandler>()); | 
| 1285 | 1287 | 
| 1286   sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1288   sync_manager_.SimulateEnableNotificationsForTest(); | 
| 1287   sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1289   sync_manager_.SimulateDisableNotificationsForTest( | 
|  | 1290       sync_notifier::TRANSIENT_NOTIFICATION_ERROR); | 
| 1288 | 1291 | 
| 1289   // Should trigger the replies. | 1292   // Should trigger the replies. | 
| 1290   PumpLoop(); | 1293   PumpLoop(); | 
| 1291 } | 1294 } | 
| 1292 | 1295 | 
| 1293 TEST_F(SyncManagerTest, OnIncomingNotification) { | 1296 TEST_F(SyncManagerTest, OnIncomingNotification) { | 
| 1294   StrictMock<MockJsEventHandler> event_handler; | 1297   StrictMock<MockJsEventHandler> event_handler; | 
| 1295 | 1298 | 
| 1296   const syncable::ModelTypeSet empty_model_types; | 1299   const syncable::ModelTypeSet empty_model_types; | 
| 1297   const syncable::ModelTypeSet model_types( | 1300   const syncable::ModelTypeSet model_types( | 
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2590                  base::Unretained(&retry_task_counter))); | 2593                  base::Unretained(&retry_task_counter))); | 
| 2591   EXPECT_EQ(0, ready_task_counter.times_called()); | 2594   EXPECT_EQ(0, ready_task_counter.times_called()); | 
| 2592   EXPECT_EQ(1, retry_task_counter.times_called()); | 2595   EXPECT_EQ(1, retry_task_counter.times_called()); | 
| 2593   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, | 2596   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, | 
| 2594             params.source); | 2597             params.source); | 
| 2595   EXPECT_TRUE(types_to_download.Equals(params.types_to_download)); | 2598   EXPECT_TRUE(types_to_download.Equals(params.types_to_download)); | 
| 2596   EXPECT_EQ(new_routing_info, params.routing_info); | 2599   EXPECT_EQ(new_routing_info, params.routing_info); | 
| 2597 } | 2600 } | 
| 2598 | 2601 | 
| 2599 }  // namespace browser_sync | 2602 }  // namespace browser_sync | 
| OLD | NEW | 
|---|