| 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 "dbus/bus.h" | 5 #include "dbus/bus.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 void QuitIfConditionIsSatisified() { | 42 void QuitIfConditionIsSatisified() { |
| 43 if (++actual_quit_calls_ != expected_quit_calls_) | 43 if (++actual_quit_calls_ != expected_quit_calls_) |
| 44 return; | 44 return; |
| 45 run_loop_->Quit(); | 45 run_loop_->Quit(); |
| 46 expected_quit_calls_ = 0; | 46 expected_quit_calls_ = 0; |
| 47 actual_quit_calls_ = 0; | 47 actual_quit_calls_ = 0; |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 scoped_ptr<base::RunLoop> run_loop_; | 51 std::unique_ptr<base::RunLoop> run_loop_; |
| 52 int expected_quit_calls_; | 52 int expected_quit_calls_; |
| 53 int actual_quit_calls_; | 53 int actual_quit_calls_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(RunLoopWithExpectedCount); | 55 DISALLOW_COPY_AND_ASSIGN(RunLoopWithExpectedCount); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Test helper for BusTest.ListenForServiceOwnerChange. | 58 // Test helper for BusTest.ListenForServiceOwnerChange. |
| 59 void OnServiceOwnerChanged(RunLoopWithExpectedCount* run_loop_state, | 59 void OnServiceOwnerChanged(RunLoopWithExpectedCount* run_loop_state, |
| 60 std::string* service_owner, | 60 std::string* service_owner, |
| 61 int* num_of_owner_changes, | 61 int* num_of_owner_changes, |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // Connection name is not empty after connection is established. | 409 // Connection name is not empty after connection is established. |
| 410 EXPECT_TRUE(bus->is_connected()); | 410 EXPECT_TRUE(bus->is_connected()); |
| 411 EXPECT_FALSE(bus->GetConnectionName().empty()); | 411 EXPECT_FALSE(bus->GetConnectionName().empty()); |
| 412 | 412 |
| 413 // Shut down synchronously. | 413 // Shut down synchronously. |
| 414 bus->ShutdownAndBlock(); | 414 bus->ShutdownAndBlock(); |
| 415 EXPECT_TRUE(bus->shutdown_completed()); | 415 EXPECT_TRUE(bus->shutdown_completed()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace dbus | 418 } // namespace dbus |
| OLD | NEW |