| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/impl/non_blocking_invalidator.h" | 5 #include "components/invalidation/impl/non_blocking_invalidator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 Invalidator* GetInvalidator() { | 58 Invalidator* GetInvalidator() { |
| 59 return invalidator_.get(); | 59 return invalidator_.get(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void DestroyInvalidator() { | 62 void DestroyInvalidator() { |
| 63 invalidator_.reset(); | 63 invalidator_.reset(); |
| 64 request_context_getter_ = NULL; | 64 request_context_getter_ = NULL; |
| 65 io_thread_.Stop(); | 65 io_thread_.Stop(); |
| 66 message_loop_.RunUntilIdle(); | 66 base::RunLoop().RunUntilIdle(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void WaitForInvalidator() { | 69 void WaitForInvalidator() { |
| 70 base::RunLoop run_loop; | 70 base::RunLoop run_loop; |
| 71 ASSERT_TRUE(io_thread_.task_runner()->PostTaskAndReply( | 71 ASSERT_TRUE(io_thread_.task_runner()->PostTaskAndReply( |
| 72 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure())); | 72 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure())); |
| 73 run_loop.Run(); | 73 run_loop.Run(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void TriggerOnInvalidatorStateChange(InvalidatorState state) { | 76 void TriggerOnInvalidatorStateChange(InvalidatorState state) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 base::Thread io_thread_; | 87 base::Thread io_thread_; |
| 88 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 88 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 89 std::unique_ptr<NonBlockingInvalidator> invalidator_; | 89 std::unique_ptr<NonBlockingInvalidator> invalidator_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 INSTANTIATE_TYPED_TEST_CASE_P( | 92 INSTANTIATE_TYPED_TEST_CASE_P( |
| 93 NonBlockingInvalidatorTest, InvalidatorTest, | 93 NonBlockingInvalidatorTest, InvalidatorTest, |
| 94 NonBlockingInvalidatorTestDelegate); | 94 NonBlockingInvalidatorTestDelegate); |
| 95 | 95 |
| 96 } // namespace syncer | 96 } // namespace syncer |
| OLD | NEW |