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 "sync/notifier/non_blocking_invalidator.h" | 5 #include "sync/notifier/non_blocking_invalidator.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 const std::string& invalidator_client_id, | 35 const std::string& invalidator_client_id, |
36 const std::string& initial_state, | 36 const std::string& initial_state, |
37 const base::WeakPtr<InvalidationStateTracker>& | 37 const base::WeakPtr<InvalidationStateTracker>& |
38 invalidation_state_tracker) { | 38 invalidation_state_tracker) { |
39 DCHECK(!invalidator_.get()); | 39 DCHECK(!invalidator_.get()); |
40 base::Thread::Options options; | 40 base::Thread::Options options; |
41 options.message_loop_type = base::MessageLoop::TYPE_IO; | 41 options.message_loop_type = base::MessageLoop::TYPE_IO; |
42 io_thread_.StartWithOptions(options); | 42 io_thread_.StartWithOptions(options); |
43 request_context_getter_ = | 43 request_context_getter_ = |
44 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); | 44 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); |
45 notifier::NotifierOptions invalidator_options; | 45 notifier::NotifierOptions notifier_options; |
46 invalidator_options.request_context_getter = request_context_getter_; | 46 notifier_options.request_context_getter = request_context_getter_; |
| 47 NetworkChannelCreator network_channel_creator = |
| 48 NonBlockingInvalidator::MakePushClientChannelCreator(notifier_options); |
47 invalidator_.reset( | 49 invalidator_.reset( |
48 new NonBlockingInvalidator( | 50 new NonBlockingInvalidator( |
49 invalidator_options, | 51 network_channel_creator, |
50 invalidator_client_id, | 52 invalidator_client_id, |
51 UnackedInvalidationsMap(), | 53 UnackedInvalidationsMap(), |
52 initial_state, | 54 initial_state, |
53 MakeWeakHandle(invalidation_state_tracker), | 55 MakeWeakHandle(invalidation_state_tracker), |
54 "fake_client_info")); | 56 "fake_client_info", |
| 57 request_context_getter_)); |
55 } | 58 } |
56 | 59 |
57 Invalidator* GetInvalidator() { | 60 Invalidator* GetInvalidator() { |
58 return invalidator_.get(); | 61 return invalidator_.get(); |
59 } | 62 } |
60 | 63 |
61 void DestroyInvalidator() { | 64 void DestroyInvalidator() { |
62 invalidator_.reset(); | 65 invalidator_.reset(); |
63 request_context_getter_ = NULL; | 66 request_context_getter_ = NULL; |
64 io_thread_.Stop(); | 67 io_thread_.Stop(); |
(...skipping 26 matching lines...) Expand all Loading... |
91 scoped_ptr<NonBlockingInvalidator> invalidator_; | 94 scoped_ptr<NonBlockingInvalidator> invalidator_; |
92 }; | 95 }; |
93 | 96 |
94 INSTANTIATE_TYPED_TEST_CASE_P( | 97 INSTANTIATE_TYPED_TEST_CASE_P( |
95 NonBlockingInvalidatorTest, InvalidatorTest, | 98 NonBlockingInvalidatorTest, InvalidatorTest, |
96 NonBlockingInvalidatorTestDelegate); | 99 NonBlockingInvalidatorTestDelegate); |
97 | 100 |
98 } // namespace | 101 } // namespace |
99 | 102 |
100 } // namespace syncer | 103 } // namespace syncer |
OLD | NEW |