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

Side by Side Diff: chrome/browser/invalidation/invalidation_service_test_template.h

Issue 221963003: Reduce dependency of TiclInvalidationService on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass scoped_refptr as const reference. Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 // This class defines tests that implementations of InvalidationService should 5 // This class defines tests that implementations of InvalidationService should
6 // pass in order to be conformant. Here's how you use it to test your 6 // pass in order to be conformant. Here's how you use it to test your
7 // implementation. 7 // implementation.
8 // 8 //
9 // Say your class is called MyInvalidationService. Then you need to define a 9 // Say your class is called MyInvalidationService. Then you need to define a
10 // class called MyInvalidationServiceTestDelegate in 10 // class called MyInvalidationServiceTestDelegate in
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // MyInvalidatorTestDelegate); 67 // MyInvalidatorTestDelegate);
68 // 68 //
69 // Easy! 69 // Easy!
70 70
71 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ 71 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_
72 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ 72 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_
73 73
74 #include "base/basictypes.h" 74 #include "base/basictypes.h"
75 #include "base/compiler_specific.h" 75 #include "base/compiler_specific.h"
76 #include "chrome/browser/invalidation/invalidation_service.h" 76 #include "chrome/browser/invalidation/invalidation_service.h"
77 #include "content/public/test/test_browser_thread_bundle.h"
77 #include "google/cacheinvalidation/include/types.h" 78 #include "google/cacheinvalidation/include/types.h"
78 #include "google/cacheinvalidation/types.pb.h" 79 #include "google/cacheinvalidation/types.pb.h"
79 #include "sync/internal_api/public/base/ack_handle.h" 80 #include "sync/internal_api/public/base/ack_handle.h"
80 #include "sync/internal_api/public/base/invalidation.h" 81 #include "sync/internal_api/public/base/invalidation.h"
81 #include "sync/internal_api/public/base/object_id_invalidation_map_test_util.h" 82 #include "sync/internal_api/public/base/object_id_invalidation_map_test_util.h"
82 #include "sync/notifier/fake_invalidation_handler.h" 83 #include "sync/notifier/fake_invalidation_handler.h"
83 #include "sync/notifier/object_id_invalidation_map.h" 84 #include "sync/notifier/object_id_invalidation_map.h"
84 #include "testing/gtest/include/gtest/gtest.h" 85 #include "testing/gtest/include/gtest/gtest.h"
85 86
86 template <typename InvalidatorTestDelegate> 87 template <typename InvalidatorTestDelegate>
87 class InvalidationServiceTest : public testing::Test { 88 class InvalidationServiceTest : public testing::Test {
88 protected: 89 protected:
89 InvalidationServiceTest() 90 InvalidationServiceTest()
90 : id1(ipc::invalidation::ObjectSource::CHROME_SYNC, "BOOKMARK"), 91 : id1(ipc::invalidation::ObjectSource::CHROME_SYNC, "BOOKMARK"),
91 id2(ipc::invalidation::ObjectSource::CHROME_SYNC, "PREFERENCE"), 92 id2(ipc::invalidation::ObjectSource::CHROME_SYNC, "PREFERENCE"),
92 id3(ipc::invalidation::ObjectSource::CHROME_SYNC, "AUTOFILL"), 93 id3(ipc::invalidation::ObjectSource::CHROME_SYNC, "AUTOFILL"),
93 id4(ipc::invalidation::ObjectSource::CHROME_PUSH_MESSAGING, 94 id4(ipc::invalidation::ObjectSource::CHROME_PUSH_MESSAGING,
94 "PUSH_MESSAGE") { 95 "PUSH_MESSAGE") {
95 } 96 }
96 97
97 invalidation::InvalidationService* 98 invalidation::InvalidationService*
98 CreateAndInitializeInvalidationService() { 99 CreateAndInitializeInvalidationService() {
99 this->delegate_.CreateInvalidationService(); 100 this->delegate_.CreateInvalidationService();
100 return this->delegate_.GetInvalidationService(); 101 return this->delegate_.GetInvalidationService();
101 } 102 }
102 103
104 content::TestBrowserThreadBundle thread_bundle_;
dcheng 2014/04/11 19:54:00 How come we need to create test browser threads no
bartfab (slow) 2014/04/14 09:20:08 See reply in the other file.
103 InvalidatorTestDelegate delegate_; 105 InvalidatorTestDelegate delegate_;
104 106
105 const invalidation::ObjectId id1; 107 const invalidation::ObjectId id1;
106 const invalidation::ObjectId id2; 108 const invalidation::ObjectId id2;
107 const invalidation::ObjectId id3; 109 const invalidation::ObjectId id3;
108 const invalidation::ObjectId id4; 110 const invalidation::ObjectId id4;
109 }; 111 };
110 112
111 TYPED_TEST_CASE_P(InvalidationServiceTest); 113 TYPED_TEST_CASE_P(InvalidationServiceTest);
112 114
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 handler.GetLastRetrievedState()); 381 handler.GetLastRetrievedState());
380 382
381 invalidator->UnregisterInvalidationHandler(&handler); 383 invalidator->UnregisterInvalidationHandler(&handler);
382 } 384 }
383 385
384 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest, 386 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest,
385 Basic, MultipleHandlers, EmptySetUnregisters, 387 Basic, MultipleHandlers, EmptySetUnregisters,
386 GetInvalidatorStateAlwaysCurrent); 388 GetInvalidatorStateAlwaysCurrent);
387 389
388 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ 390 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698