Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: chrome/browser/invalidation/ticl_invalidation_service_unittest.cc

Issue 179843002: Make invalidations work for Chrome OS Kiosk Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error leading to uninitialized memory access. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/invalidation/ticl_invalidation_service.h" 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
6 6
7 #include "chrome/browser/invalidation/invalidation_service_factory.h" 7 #include "chrome/browser/invalidation/invalidation_service_factory.h"
8 #include "chrome/browser/invalidation/invalidation_service_test_template.h" 8 #include "chrome/browser/invalidation/invalidation_service_test_template.h"
9 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
11 #include "chrome/browser/signin/signin_manager.h"
12 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
11 #include "sync/notifier/fake_invalidation_handler.h" 14 #include "sync/notifier/fake_invalidation_handler.h"
12 #include "sync/notifier/fake_invalidator.h" 15 #include "sync/notifier/fake_invalidator.h"
13 #include "sync/notifier/invalidation_util.h" 16 #include "sync/notifier/invalidation_util.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 18
16 namespace invalidation { 19 namespace invalidation {
17 20
18 class TiclInvalidationServiceTestDelegate { 21 class TiclInvalidationServiceTestDelegate {
19 public: 22 public:
20 TiclInvalidationServiceTestDelegate() { } 23 TiclInvalidationServiceTestDelegate() { }
21 24
22 ~TiclInvalidationServiceTestDelegate() { 25 ~TiclInvalidationServiceTestDelegate() {
23 DestroyInvalidationService(); 26 DestroyInvalidationService();
24 } 27 }
25 28
26 void CreateInvalidationService() { 29 void CreateInvalidationService() {
27 fake_invalidator_ = new syncer::FakeInvalidator(); 30 fake_invalidator_ = new syncer::FakeInvalidator();
28 profile_.reset(new TestingProfile()); 31 profile_.reset(new TestingProfile());
29 token_service_.reset(new FakeProfileOAuth2TokenService); 32 token_service_.reset(new FakeProfileOAuth2TokenService);
30 invalidation_service_.reset( 33 invalidation_service_.reset(new TiclInvalidationService(
31 new TiclInvalidationService(NULL, 34 scoped_ptr<InvalidationAuthProvider>(
32 token_service_.get(), 35 new ProfileInvalidationAuthProvider(
33 profile_.get())); 36 SigninManagerFactory::GetForProfile(profile_.get()),
37 token_service_.get(),
38 NULL)),
39 profile_.get()));
34 invalidation_service_->InitForTest(fake_invalidator_); 40 invalidation_service_->InitForTest(fake_invalidator_);
35 } 41 }
36 42
37 InvalidationService* GetInvalidationService() { 43 InvalidationService* GetInvalidationService() {
38 return invalidation_service_.get(); 44 return invalidation_service_.get();
39 } 45 }
40 46
41 void DestroyInvalidationService() { 47 void DestroyInvalidationService() {
42 invalidation_service_->Shutdown(); 48 invalidation_service_->Shutdown();
43 } 49 }
44 50
45 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) { 51 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) {
46 fake_invalidator_->EmitOnInvalidatorStateChange(state); 52 fake_invalidator_->EmitOnInvalidatorStateChange(state);
47 } 53 }
48 54
49 void TriggerOnIncomingInvalidation( 55 void TriggerOnIncomingInvalidation(
50 const syncer::ObjectIdInvalidationMap& invalidation_map) { 56 const syncer::ObjectIdInvalidationMap& invalidation_map) {
51 fake_invalidator_->EmitOnIncomingInvalidation(invalidation_map); 57 fake_invalidator_->EmitOnIncomingInvalidation(invalidation_map);
52 } 58 }
53 59
54 syncer::FakeInvalidator* fake_invalidator_; // owned by the service. 60 syncer::FakeInvalidator* fake_invalidator_; // owned by the service.
55 scoped_ptr<TiclInvalidationService> invalidation_service_;
56 scoped_ptr<TestingProfile> profile_; 61 scoped_ptr<TestingProfile> profile_;
57 scoped_ptr<FakeProfileOAuth2TokenService> token_service_; 62 scoped_ptr<FakeProfileOAuth2TokenService> token_service_;
63 scoped_ptr<TiclInvalidationService> invalidation_service_;
58 }; 64 };
59 65
60 INSTANTIATE_TYPED_TEST_CASE_P( 66 INSTANTIATE_TYPED_TEST_CASE_P(
61 TiclInvalidationServiceTest, InvalidationServiceTest, 67 TiclInvalidationServiceTest, InvalidationServiceTest,
62 TiclInvalidationServiceTestDelegate); 68 TiclInvalidationServiceTestDelegate);
63 69
64 } // namespace invalidation 70 } // namespace invalidation
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/ticl_invalidation_service.cc ('k') | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698