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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_CALL(*mock_adapter0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); | 413 EXPECT_CALL(*mock_adapter0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); |
414 adapter_client_->StartPollLoop( | 414 adapter_client_->StartPollLoop( |
415 dbus::ObjectPath(kTestAdapterPath0), | 415 dbus::ObjectPath(kTestAdapterPath0), |
416 nfc_adapter::kModeInitiator, | 416 nfc_adapter::kModeInitiator, |
417 base::Bind(&NfcClientTest::SuccessCallback, base::Unretained(this)), | 417 base::Bind(&NfcClientTest::SuccessCallback, base::Unretained(this)), |
418 base::Bind(&NfcClientTest::ErrorCallback, base::Unretained(this))); | 418 base::Bind(&NfcClientTest::ErrorCallback, base::Unretained(this))); |
419 Mock::VerifyAndClearExpectations(&mock_adapter0_proxy_); | 419 Mock::VerifyAndClearExpectations(&mock_adapter0_proxy_); |
420 EXPECT_CALL(*this, | 420 EXPECT_CALL(*this, |
421 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); | 421 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); |
422 EXPECT_CALL(*mock_adapter1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) | 422 EXPECT_CALL(*mock_adapter1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) |
423 .Times(0); | 423 .Times(1); |
424 adapter_client_->StartPollLoop( | 424 adapter_client_->StartPollLoop( |
425 dbus::ObjectPath(kTestAdapterPath1), | 425 dbus::ObjectPath(kTestAdapterPath1), |
426 nfc_adapter::kModeInitiator, | 426 nfc_adapter::kModeInitiator, |
427 base::Bind(&NfcClientTest::SuccessCallback, base::Unretained(this)), | 427 base::Bind(&NfcClientTest::SuccessCallback, base::Unretained(this)), |
428 base::Bind(&NfcClientTest::ErrorCallback, base::Unretained(this))); | 428 base::Bind(&NfcClientTest::ErrorCallback, base::Unretained(this))); |
429 Mock::VerifyAndClearExpectations(this); | 429 Mock::VerifyAndClearExpectations(this); |
430 Mock::VerifyAndClearExpectations(&mock_adapter1_proxy_); | 430 Mock::VerifyAndClearExpectations(&mock_adapter1_proxy_); |
431 | 431 |
432 // Add adapter 1. | 432 // Add adapter 1. |
433 adapter_paths.push_back(dbus::ObjectPath(kTestAdapterPath1)); | 433 adapter_paths.push_back(dbus::ObjectPath(kTestAdapterPath1)); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 EXPECT_CALL(*mock_tag0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); | 540 EXPECT_CALL(*mock_tag0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); |
541 tag_client_->Write(dbus::ObjectPath(kTestTagPath0), write_data, | 541 tag_client_->Write(dbus::ObjectPath(kTestTagPath0), write_data, |
542 base::Bind(&NfcClientTest::SuccessCallback, | 542 base::Bind(&NfcClientTest::SuccessCallback, |
543 base::Unretained(this)), | 543 base::Unretained(this)), |
544 base::Bind(&NfcClientTest::ErrorCallback, | 544 base::Bind(&NfcClientTest::ErrorCallback, |
545 base::Unretained(this))); | 545 base::Unretained(this))); |
546 Mock::VerifyAndClearExpectations(&mock_tag0_proxy_); | 546 Mock::VerifyAndClearExpectations(&mock_tag0_proxy_); |
547 EXPECT_CALL(*this, | 547 EXPECT_CALL(*this, |
548 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); | 548 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); |
549 EXPECT_CALL(*mock_tag1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) | 549 EXPECT_CALL(*mock_tag1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) |
550 .Times(0); | 550 .Times(1); |
551 tag_client_->Write(dbus::ObjectPath(kTestTagPath1), write_data, | 551 tag_client_->Write(dbus::ObjectPath(kTestTagPath1), write_data, |
552 base::Bind(&NfcClientTest::SuccessCallback, | 552 base::Bind(&NfcClientTest::SuccessCallback, |
553 base::Unretained(this)), | 553 base::Unretained(this)), |
554 base::Bind(&NfcClientTest::ErrorCallback, | 554 base::Bind(&NfcClientTest::ErrorCallback, |
555 base::Unretained(this))); | 555 base::Unretained(this))); |
556 Mock::VerifyAndClearExpectations(this); | 556 Mock::VerifyAndClearExpectations(this); |
557 Mock::VerifyAndClearExpectations(&mock_tag1_proxy_); | 557 Mock::VerifyAndClearExpectations(&mock_tag1_proxy_); |
558 | 558 |
559 // Add tag 1. | 559 // Add tag 1. |
560 tag_paths.push_back(dbus::ObjectPath(kTestTagPath1)); | 560 tag_paths.push_back(dbus::ObjectPath(kTestTagPath1)); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 EXPECT_CALL(*mock_device0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); | 668 EXPECT_CALL(*mock_device0_proxy_, CallMethodWithErrorCallback(_, _, _, _)); |
669 device_client_->Push(dbus::ObjectPath(kTestDevicePath0), write_data, | 669 device_client_->Push(dbus::ObjectPath(kTestDevicePath0), write_data, |
670 base::Bind(&NfcClientTest::SuccessCallback, | 670 base::Bind(&NfcClientTest::SuccessCallback, |
671 base::Unretained(this)), | 671 base::Unretained(this)), |
672 base::Bind(&NfcClientTest::ErrorCallback, | 672 base::Bind(&NfcClientTest::ErrorCallback, |
673 base::Unretained(this))); | 673 base::Unretained(this))); |
674 Mock::VerifyAndClearExpectations(&mock_device0_proxy_); | 674 Mock::VerifyAndClearExpectations(&mock_device0_proxy_); |
675 EXPECT_CALL(*this, | 675 EXPECT_CALL(*this, |
676 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); | 676 ErrorCallback(nfc_client_helpers::kUnknownObjectError, _)); |
677 EXPECT_CALL(*mock_device1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) | 677 EXPECT_CALL(*mock_device1_proxy_, CallMethodWithErrorCallback(_, _, _, _)) |
678 .Times(0); | 678 .Times(1); |
679 device_client_->Push(dbus::ObjectPath(kTestDevicePath1), write_data, | 679 device_client_->Push(dbus::ObjectPath(kTestDevicePath1), write_data, |
680 base::Bind(&NfcClientTest::SuccessCallback, | 680 base::Bind(&NfcClientTest::SuccessCallback, |
681 base::Unretained(this)), | 681 base::Unretained(this)), |
682 base::Bind(&NfcClientTest::ErrorCallback, | 682 base::Bind(&NfcClientTest::ErrorCallback, |
683 base::Unretained(this))); | 683 base::Unretained(this))); |
684 Mock::VerifyAndClearExpectations(this); | 684 Mock::VerifyAndClearExpectations(this); |
685 Mock::VerifyAndClearExpectations(&mock_device1_proxy_); | 685 Mock::VerifyAndClearExpectations(&mock_device1_proxy_); |
686 | 686 |
687 // Add device 1. | 687 // Add device 1. |
688 device_paths.push_back(dbus::ObjectPath(kTestDevicePath1)); | 688 device_paths.push_back(dbus::ObjectPath(kTestDevicePath1)); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 EXPECT_CALL(mock_tag_observer_, | 876 EXPECT_CALL(mock_tag_observer_, |
877 TagRemoved(dbus::ObjectPath(kTestTagPath1))); | 877 TagRemoved(dbus::ObjectPath(kTestTagPath1))); |
878 EXPECT_CALL(mock_record_observer_, | 878 EXPECT_CALL(mock_record_observer_, |
879 RecordRemoved(dbus::ObjectPath(kTestRecordPath2))); | 879 RecordRemoved(dbus::ObjectPath(kTestRecordPath2))); |
880 EXPECT_CALL(mock_record_observer_, | 880 EXPECT_CALL(mock_record_observer_, |
881 RecordRemoved(dbus::ObjectPath(kTestRecordPath3))); | 881 RecordRemoved(dbus::ObjectPath(kTestRecordPath3))); |
882 SimulateAdaptersChanged(object_paths); | 882 SimulateAdaptersChanged(object_paths); |
883 } | 883 } |
884 | 884 |
885 } // namespace chromeos | 885 } // namespace chromeos |
OLD | NEW |