Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / invalidation / ticl_invalidation_service_unittest.cc
blob64379ece0c2367f196cd4e054b7711692a305131
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.
5 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
7 #include "chrome/browser/invalidation/invalidation_service_factory.h"
8 #include "chrome/browser/invalidation/invalidation_service_test_template.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
10 #include "chrome/test/base/testing_profile.h"
11 #include "sync/notifier/fake_invalidation_handler.h"
12 #include "sync/notifier/fake_invalidator.h"
13 #include "sync/notifier/invalidation_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace invalidation {
18 class TiclInvalidationServiceTestDelegate {
19 public:
20 TiclInvalidationServiceTestDelegate() { }
22 ~TiclInvalidationServiceTestDelegate() {
23 DestroyInvalidationService();
26 void CreateInvalidationService() {
27 fake_invalidator_ = new syncer::FakeInvalidator();
28 profile_.reset(new TestingProfile());
29 token_service_.reset(new FakeProfileOAuth2TokenService);
30 invalidation_service_.reset(
31 new TiclInvalidationService(NULL,
32 token_service_.get(),
33 profile_.get()));
34 invalidation_service_->InitForTest(fake_invalidator_);
37 InvalidationService* GetInvalidationService() {
38 return invalidation_service_.get();
41 void DestroyInvalidationService() {
42 invalidation_service_->Shutdown();
45 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) {
46 fake_invalidator_->EmitOnInvalidatorStateChange(state);
49 void TriggerOnIncomingInvalidation(
50 const syncer::ObjectIdInvalidationMap& invalidation_map) {
51 fake_invalidator_->EmitOnIncomingInvalidation(invalidation_map);
54 syncer::FakeInvalidator* fake_invalidator_; // owned by the service.
55 scoped_ptr<TiclInvalidationService> invalidation_service_;
56 scoped_ptr<TestingProfile> profile_;
57 scoped_ptr<FakeProfileOAuth2TokenService> token_service_;
60 INSTANTIATE_TYPED_TEST_CASE_P(
61 TiclInvalidationServiceTest, InvalidationServiceTest,
62 TiclInvalidationServiceTestDelegate);
64 } // namespace invalidation