| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 6 |
| 7 #include "chrome/browser/invalidation/invalidation_frontend_test_template.h" |
| 8 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "sync/notifier/fake_invalidation_handler.h" |
| 11 #include "sync/notifier/fake_invalidator.h" |
| 12 #include "sync/notifier/invalidation_util.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 |
| 15 namespace invalidation { |
| 16 |
| 17 class TiclInvalidationServiceTestDelegate { |
| 18 public: |
| 19 TiclInvalidationServiceTestDelegate() { } |
| 20 |
| 21 ~TiclInvalidationServiceTestDelegate() { |
| 22 DestroyInvalidationFrontend(); |
| 23 } |
| 24 |
| 25 void CreateInvalidationFrontend() { |
| 26 fake_invalidator_ = new syncer::FakeInvalidator(); |
| 27 profile_.reset(new TestingProfile()); |
| 28 invalidation_service_.reset(new TiclInvalidationService(NULL, |
| 29 NULL, |
| 30 profile_.get(), |
| 31 fake_invalidator_)); |
| 32 } |
| 33 |
| 34 InvalidationFrontend* GetInvalidationFrontend() { |
| 35 return invalidation_service_.get(); |
| 36 } |
| 37 |
| 38 void DestroyInvalidationFrontend() { |
| 39 invalidation_service_->Shutdown(); |
| 40 } |
| 41 |
| 42 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) { |
| 43 fake_invalidator_->EmitOnInvalidatorStateChange(state); |
| 44 } |
| 45 |
| 46 void TriggerOnIncomingInvalidation( |
| 47 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
| 48 fake_invalidator_->EmitOnIncomingInvalidation(invalidation_map); |
| 49 } |
| 50 |
| 51 syncer::FakeInvalidator* fake_invalidator_; // owned by the service. |
| 52 scoped_ptr<TiclInvalidationService> invalidation_service_; |
| 53 scoped_ptr<TestingProfile> profile_; |
| 54 }; |
| 55 |
| 56 INSTANTIATE_TYPED_TEST_CASE_P( |
| 57 TiclInvalidationServiceTest, InvalidationFrontendTest, |
| 58 TiclInvalidationServiceTestDelegate); |
| 59 |
| 60 } // namespace invalidation |
| OLD | NEW |