| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "google/cacheinvalidation/include/invalidation-client.h" | 8 #include "google/cacheinvalidation/include/invalidation-client.h" |
| 9 #include "google/cacheinvalidation/include/types.h" | 9 #include "google/cacheinvalidation/include/types.h" |
| 10 #include "google/cacheinvalidation/v2/types.pb.h" | 10 #include "google/cacheinvalidation/v2/types.pb.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 : fake_push_client_(new notifier::FakePushClient()), | 72 : fake_push_client_(new notifier::FakePushClient()), |
| 73 client_(scoped_ptr<notifier::PushClient>(fake_push_client_)), | 73 client_(scoped_ptr<notifier::PushClient>(fake_push_client_)), |
| 74 kBookmarksId_(kChromeSyncSourceId, "BOOKMARK"), | 74 kBookmarksId_(kChromeSyncSourceId, "BOOKMARK"), |
| 75 kPreferencesId_(kChromeSyncSourceId, "PREFERENCE"), | 75 kPreferencesId_(kChromeSyncSourceId, "PREFERENCE"), |
| 76 kExtensionsId_(kChromeSyncSourceId, "EXTENSION"), | 76 kExtensionsId_(kChromeSyncSourceId, "EXTENSION"), |
| 77 kAppsId_(kChromeSyncSourceId, "APP") {} | 77 kAppsId_(kChromeSyncSourceId, "APP") {} |
| 78 | 78 |
| 79 virtual void SetUp() { | 79 virtual void SetUp() { |
| 80 client_.Start(kClientId, kClientInfo, kState, | 80 client_.Start(kClientId, kClientInfo, kState, |
| 81 InvalidationVersionMap(), | 81 InvalidationVersionMap(), |
| 82 syncer::MakeWeakHandle( | 82 MakeWeakHandle(mock_invalidation_state_tracker_.AsWeakPtr()), |
| 83 mock_invalidation_state_tracker_.AsWeakPtr()), | |
| 84 &mock_listener_); | 83 &mock_listener_); |
| 85 } | 84 } |
| 86 | 85 |
| 87 virtual void TearDown() { | 86 virtual void TearDown() { |
| 88 // client_.Stop() stops the invalidation scheduler, which deletes any | 87 // client_.Stop() stops the invalidation scheduler, which deletes any |
| 89 // pending tasks without running them. Some tasks "run and delete" another | 88 // pending tasks without running them. Some tasks "run and delete" another |
| 90 // task, so they must be run in order to avoid leaking the inner task. | 89 // task, so they must be run in order to avoid leaking the inner task. |
| 91 // client_.Stop() does not schedule any tasks, so it's both necessary and | 90 // client_.Stop() does not schedule any tasks, so it's both necessary and |
| 92 // sufficient to drain the task queue before calling it. | 91 // sufficient to drain the task queue before calling it. |
| 93 message_loop_.RunAllPending(); | 92 message_loop_.RunAllPending(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 invalidation::ErrorContext())); | 356 invalidation::ErrorContext())); |
| 358 fake_push_client_->DisableNotifications( | 357 fake_push_client_->DisableNotifications( |
| 359 notifier::TRANSIENT_NOTIFICATION_ERROR); | 358 notifier::TRANSIENT_NOTIFICATION_ERROR); |
| 360 fake_push_client_->DisableNotifications( | 359 fake_push_client_->DisableNotifications( |
| 361 notifier::NOTIFICATION_CREDENTIALS_REJECTED); | 360 notifier::NOTIFICATION_CREDENTIALS_REJECTED); |
| 362 fake_push_client_->EnableNotifications(); | 361 fake_push_client_->EnableNotifications(); |
| 363 client_.Ready(NULL); | 362 client_.Ready(NULL); |
| 364 } | 363 } |
| 365 | 364 |
| 366 } // namespace syncer | 365 } // namespace syncer |
| OLD | NEW |