| 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 DictionaryValue false_details; | 1257 DictionaryValue false_details; |
| 1258 false_details.SetBoolean("enabled", false); | 1258 false_details.SetBoolean("enabled", false); |
| 1259 | 1259 |
| 1260 EXPECT_CALL(event_handler, | 1260 EXPECT_CALL(event_handler, |
| 1261 HandleJsEvent("onNotificationStateChange", | 1261 HandleJsEvent("onNotificationStateChange", |
| 1262 HasDetailsAsDictionary(true_details))); | 1262 HasDetailsAsDictionary(true_details))); |
| 1263 EXPECT_CALL(event_handler, | 1263 EXPECT_CALL(event_handler, |
| 1264 HandleJsEvent("onNotificationStateChange", | 1264 HandleJsEvent("onNotificationStateChange", |
| 1265 HasDetailsAsDictionary(false_details))); | 1265 HasDetailsAsDictionary(false_details))); |
| 1266 | 1266 |
| 1267 sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1267 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1268 sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1268 sync_notifier::NOTIFICATIONS_ON); |
| 1269 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1270 sync_notifier::NOTIFICATIONS_OFF); |
| 1269 | 1271 |
| 1270 SetJsEventHandler(event_handler.AsWeakHandle()); | 1272 SetJsEventHandler(event_handler.AsWeakHandle()); |
| 1271 sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1273 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1272 sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1274 sync_notifier::NOTIFICATIONS_ON); |
| 1275 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1276 sync_notifier::NOTIFICATIONS_OFF); |
| 1273 SetJsEventHandler(WeakHandle<JsEventHandler>()); | 1277 SetJsEventHandler(WeakHandle<JsEventHandler>()); |
| 1274 | 1278 |
| 1275 sync_manager_.TriggerOnNotificationStateChangeForTest(true); | 1279 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1276 sync_manager_.TriggerOnNotificationStateChangeForTest(false); | 1280 sync_notifier::NOTIFICATIONS_ON); |
| 1281 sync_manager_.TriggerOnSyncNotifierStateChangeForTest( |
| 1282 sync_notifier::NOTIFICATIONS_OFF); |
| 1277 | 1283 |
| 1278 // Should trigger the replies. | 1284 // Should trigger the replies. |
| 1279 PumpLoop(); | 1285 PumpLoop(); |
| 1280 } | 1286 } |
| 1281 | 1287 |
| 1282 TEST_F(SyncManagerTest, OnIncomingNotification) { | 1288 TEST_F(SyncManagerTest, OnIncomingNotification) { |
| 1283 StrictMock<MockJsEventHandler> event_handler; | 1289 StrictMock<MockJsEventHandler> event_handler; |
| 1284 | 1290 |
| 1285 const syncable::ModelTypeSet empty_model_types; | 1291 const syncable::ModelTypeSet empty_model_types; |
| 1286 const syncable::ModelTypeSet model_types( | 1292 const syncable::ModelTypeSet model_types( |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 EXPECT_EQ(title, node.GetTitle()); | 2507 EXPECT_EQ(title, node.GetTitle()); |
| 2502 EXPECT_EQ(GURL(url2), node.GetURL()); | 2508 EXPECT_EQ(GURL(url2), node.GetURL()); |
| 2503 const syncable::Entry* node_entry = node.GetEntry(); | 2509 const syncable::Entry* node_entry = node.GetEntry(); |
| 2504 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); | 2510 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); |
| 2505 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); | 2511 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); |
| 2506 EXPECT_TRUE(specifics.has_encrypted()); | 2512 EXPECT_TRUE(specifics.has_encrypted()); |
| 2507 } | 2513 } |
| 2508 } | 2514 } |
| 2509 | 2515 |
| 2510 } // namespace browser_sync | 2516 } // namespace browser_sync |
| OLD | NEW |