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 "chrome/browser/sync/glue/bridged_invalidator.h" | 5 #include "chrome/browser/sync/glue/bridged_invalidator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // BridgedInvalidatorTestDelegate has to be visible from the syncer | 32 // BridgedInvalidatorTestDelegate has to be visible from the syncer |
33 // namespace (where InvalidatorTest lives). | 33 // namespace (where InvalidatorTest lives). |
34 class BridgedInvalidatorTestDelegate { | 34 class BridgedInvalidatorTestDelegate { |
35 public: | 35 public: |
36 BridgedInvalidatorTestDelegate() | 36 BridgedInvalidatorTestDelegate() |
37 : ui_thread_(content::BrowserThread::UI, &ui_loop_), | 37 : ui_thread_(content::BrowserThread::UI, &ui_loop_), |
38 bridge_(&mock_profile_, ui_loop_.message_loop_proxy()), | 38 bridge_(&mock_profile_, ui_loop_.message_loop_proxy()), |
39 fake_delegate_(NULL) { | 39 fake_delegate_(NULL) { |
40 // Pump |ui_loop_| to fully initialize |bridge_|. | 40 // Pump |ui_loop_| to fully initialize |bridge_|. |
41 ui_loop_.RunAllPending(); | 41 ui_loop_.RunUntilIdle(); |
42 } | 42 } |
43 | 43 |
44 ~BridgedInvalidatorTestDelegate() { | 44 ~BridgedInvalidatorTestDelegate() { |
45 DestroyInvalidator(); | 45 DestroyInvalidator(); |
46 } | 46 } |
47 | 47 |
48 void CreateInvalidator( | 48 void CreateInvalidator( |
49 const std::string& /* initial_state (unused) */, | 49 const std::string& /* initial_state (unused) */, |
50 const base::WeakPtr<syncer::InvalidationStateTracker>& | 50 const base::WeakPtr<syncer::InvalidationStateTracker>& |
51 /* invalidation_state_tracker (unused) */) { | 51 /* invalidation_state_tracker (unused) */) { |
(...skipping 13 matching lines...) Expand all Loading... |
65 } | 65 } |
66 | 66 |
67 syncer::FakeInvalidator* GetFakeDelegate() { | 67 syncer::FakeInvalidator* GetFakeDelegate() { |
68 return fake_delegate_; | 68 return fake_delegate_; |
69 } | 69 } |
70 | 70 |
71 void DestroyInvalidator() { | 71 void DestroyInvalidator() { |
72 invalidator_.reset(); | 72 invalidator_.reset(); |
73 fake_delegate_ = NULL; | 73 fake_delegate_ = NULL; |
74 bridge_.StopForShutdown(); | 74 bridge_.StopForShutdown(); |
75 ui_loop_.RunAllPending(); | 75 ui_loop_.RunUntilIdle(); |
76 } | 76 } |
77 | 77 |
78 void WaitForInvalidator() { | 78 void WaitForInvalidator() { |
79 // Do nothing. | 79 // Do nothing. |
80 } | 80 } |
81 | 81 |
82 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) { | 82 void TriggerOnInvalidatorStateChange(syncer::InvalidatorState state) { |
83 fake_delegate_->EmitOnInvalidatorStateChange(state); | 83 fake_delegate_->EmitOnInvalidatorStateChange(state); |
84 } | 84 } |
85 | 85 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 namespace syncer { | 183 namespace syncer { |
184 namespace { | 184 namespace { |
185 | 185 |
186 INSTANTIATE_TYPED_TEST_CASE_P( | 186 INSTANTIATE_TYPED_TEST_CASE_P( |
187 BridgedInvalidatorTest, InvalidatorTest, | 187 BridgedInvalidatorTest, InvalidatorTest, |
188 ::browser_sync::BridgedInvalidatorTestDelegate); | 188 ::browser_sync::BridgedInvalidatorTestDelegate); |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 } // namespace syncer | 191 } // namespace syncer |
OLD | NEW |