| OLD | NEW |
| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "chromeos/dbus/nfc_adapter_client.h" | 7 #include "chromeos/dbus/nfc_adapter_client.h" |
| 8 #include "chromeos/dbus/nfc_client_helpers.h" | 8 #include "chromeos/dbus/nfc_client_helpers.h" |
| 9 #include "chromeos/dbus/nfc_device_client.h" | 9 #include "chromeos/dbus/nfc_device_client.h" |
| 10 #include "chromeos/dbus/nfc_manager_client.h" | 10 #include "chromeos/dbus/nfc_manager_client.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const std::string&)); | 83 const std::string&)); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace | 86 } // namespace |
| 87 | 87 |
| 88 class NfcClientTest : public testing::Test { | 88 class NfcClientTest : public testing::Test { |
| 89 public: | 89 public: |
| 90 NfcClientTest() : response_(NULL) {} | 90 NfcClientTest() : response_(NULL) {} |
| 91 virtual ~NfcClientTest() {} | 91 virtual ~NfcClientTest() {} |
| 92 | 92 |
| 93 virtual void SetUp() OVERRIDE { | 93 virtual void SetUp() override { |
| 94 // Create the mock bus. | 94 // Create the mock bus. |
| 95 dbus::Bus::Options options; | 95 dbus::Bus::Options options; |
| 96 options.bus_type = dbus::Bus::SYSTEM; | 96 options.bus_type = dbus::Bus::SYSTEM; |
| 97 mock_bus_ = new dbus::MockBus(options); | 97 mock_bus_ = new dbus::MockBus(options); |
| 98 | 98 |
| 99 // Create the mock proxies. | 99 // Create the mock proxies. |
| 100 mock_manager_proxy_ = new dbus::MockObjectProxy( | 100 mock_manager_proxy_ = new dbus::MockObjectProxy( |
| 101 mock_bus_.get(), | 101 mock_bus_.get(), |
| 102 kTestServiceName, | 102 kTestServiceName, |
| 103 dbus::ObjectPath(kTestManagerPath)); | 103 dbus::ObjectPath(kTestManagerPath)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 record_client_->Init(mock_bus_.get()); | 215 record_client_->Init(mock_bus_.get()); |
| 216 manager_client_->AddObserver(&mock_manager_observer_); | 216 manager_client_->AddObserver(&mock_manager_observer_); |
| 217 adapter_client_->AddObserver(&mock_adapter_observer_); | 217 adapter_client_->AddObserver(&mock_adapter_observer_); |
| 218 device_client_->AddObserver(&mock_device_observer_); | 218 device_client_->AddObserver(&mock_device_observer_); |
| 219 tag_client_->AddObserver(&mock_tag_observer_); | 219 tag_client_->AddObserver(&mock_tag_observer_); |
| 220 record_client_->AddObserver(&mock_record_observer_); | 220 record_client_->AddObserver(&mock_record_observer_); |
| 221 | 221 |
| 222 message_loop_.RunUntilIdle(); | 222 message_loop_.RunUntilIdle(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 virtual void TearDown() OVERRIDE { | 225 virtual void TearDown() override { |
| 226 tag_client_->RemoveObserver(&mock_tag_observer_); | 226 tag_client_->RemoveObserver(&mock_tag_observer_); |
| 227 device_client_->RemoveObserver(&mock_device_observer_); | 227 device_client_->RemoveObserver(&mock_device_observer_); |
| 228 adapter_client_->RemoveObserver(&mock_adapter_observer_); | 228 adapter_client_->RemoveObserver(&mock_adapter_observer_); |
| 229 manager_client_->RemoveObserver(&mock_manager_observer_); | 229 manager_client_->RemoveObserver(&mock_manager_observer_); |
| 230 mock_bus_->ShutdownAndBlock(); | 230 mock_bus_->ShutdownAndBlock(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void SimulateAdaptersChanged( | 233 void SimulateAdaptersChanged( |
| 234 const ObjectPathVector& adapter_paths) { | 234 const ObjectPathVector& adapter_paths) { |
| 235 NfcManagerClient::Properties* properties = | 235 NfcManagerClient::Properties* properties = |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 EXPECT_CALL(mock_tag_observer_, | 873 EXPECT_CALL(mock_tag_observer_, |
| 874 TagRemoved(dbus::ObjectPath(kTestTagPath1))); | 874 TagRemoved(dbus::ObjectPath(kTestTagPath1))); |
| 875 EXPECT_CALL(mock_record_observer_, | 875 EXPECT_CALL(mock_record_observer_, |
| 876 RecordRemoved(dbus::ObjectPath(kTestRecordPath2))); | 876 RecordRemoved(dbus::ObjectPath(kTestRecordPath2))); |
| 877 EXPECT_CALL(mock_record_observer_, | 877 EXPECT_CALL(mock_record_observer_, |
| 878 RecordRemoved(dbus::ObjectPath(kTestRecordPath3))); | 878 RecordRemoved(dbus::ObjectPath(kTestRecordPath3))); |
| 879 SimulateAdaptersChanged(object_paths); | 879 SimulateAdaptersChanged(object_paths); |
| 880 } | 880 } |
| 881 | 881 |
| 882 } // namespace chromeos | 882 } // namespace chromeos |
| OLD | NEW |