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/callback.h" | 5 #include "base/callback.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 tag_records_received_count_(0), | 53 tag_records_received_count_(0), |
54 peer_count_(0), | 54 peer_count_(0), |
55 tag_count_(0), | 55 tag_count_(0), |
56 adapter_(adapter) { | 56 adapter_(adapter) { |
57 } | 57 } |
58 | 58 |
59 virtual ~TestObserver() {} | 59 virtual ~TestObserver() {} |
60 | 60 |
61 // NfcAdapter::Observer override. | 61 // NfcAdapter::Observer override. |
62 virtual void AdapterPresentChanged(NfcAdapter* adapter, | 62 virtual void AdapterPresentChanged(NfcAdapter* adapter, |
63 bool present) OVERRIDE { | 63 bool present) override { |
64 EXPECT_EQ(adapter_.get(), adapter); | 64 EXPECT_EQ(adapter_.get(), adapter); |
65 present_changed_count_++; | 65 present_changed_count_++; |
66 } | 66 } |
67 | 67 |
68 // NfcAdapter::Observer override. | 68 // NfcAdapter::Observer override. |
69 virtual void AdapterPoweredChanged(NfcAdapter* adapter, | 69 virtual void AdapterPoweredChanged(NfcAdapter* adapter, |
70 bool powered) OVERRIDE { | 70 bool powered) override { |
71 EXPECT_EQ(adapter_.get(), adapter); | 71 EXPECT_EQ(adapter_.get(), adapter); |
72 powered_changed_count_++; | 72 powered_changed_count_++; |
73 } | 73 } |
74 | 74 |
75 // NfcAdapter::Observer override. | 75 // NfcAdapter::Observer override. |
76 virtual void AdapterPollingChanged(NfcAdapter* adapter, | 76 virtual void AdapterPollingChanged(NfcAdapter* adapter, |
77 bool powered) OVERRIDE { | 77 bool powered) override { |
78 EXPECT_EQ(adapter_.get(), adapter); | 78 EXPECT_EQ(adapter_.get(), adapter); |
79 polling_changed_count_++; | 79 polling_changed_count_++; |
80 } | 80 } |
81 | 81 |
82 // NfcAdapter::Observer override. | 82 // NfcAdapter::Observer override. |
83 virtual void PeerFound(NfcAdapter* adapter, NfcPeer* peer) OVERRIDE { | 83 virtual void PeerFound(NfcAdapter* adapter, NfcPeer* peer) override { |
84 EXPECT_EQ(adapter_.get(), adapter); | 84 EXPECT_EQ(adapter_.get(), adapter); |
85 peer_count_++; | 85 peer_count_++; |
86 peer_identifier_ = peer->GetIdentifier(); | 86 peer_identifier_ = peer->GetIdentifier(); |
87 } | 87 } |
88 | 88 |
89 // NfcAdapter::Observer override. | 89 // NfcAdapter::Observer override. |
90 virtual void PeerLost(NfcAdapter* adapter, NfcPeer* peer) OVERRIDE { | 90 virtual void PeerLost(NfcAdapter* adapter, NfcPeer* peer) override { |
91 EXPECT_EQ(adapter_.get(), adapter); | 91 EXPECT_EQ(adapter_.get(), adapter); |
92 EXPECT_EQ(peer_identifier_, peer->GetIdentifier()); | 92 EXPECT_EQ(peer_identifier_, peer->GetIdentifier()); |
93 peer_count_--; | 93 peer_count_--; |
94 peer_identifier_.clear(); | 94 peer_identifier_.clear(); |
95 } | 95 } |
96 | 96 |
97 // NfcAdapter::Observer override. | 97 // NfcAdapter::Observer override. |
98 virtual void TagFound(NfcAdapter* adapter, NfcTag* tag) OVERRIDE { | 98 virtual void TagFound(NfcAdapter* adapter, NfcTag* tag) override { |
99 EXPECT_EQ(adapter_.get(), adapter); | 99 EXPECT_EQ(adapter_.get(), adapter); |
100 tag_count_++; | 100 tag_count_++; |
101 tag_identifier_ = tag->GetIdentifier(); | 101 tag_identifier_ = tag->GetIdentifier(); |
102 } | 102 } |
103 | 103 |
104 // NfcAdapter::Observer override. | 104 // NfcAdapter::Observer override. |
105 virtual void TagLost(NfcAdapter* adapter, NfcTag* tag) OVERRIDE { | 105 virtual void TagLost(NfcAdapter* adapter, NfcTag* tag) override { |
106 EXPECT_EQ(adapter_.get(), adapter); | 106 EXPECT_EQ(adapter_.get(), adapter); |
107 EXPECT_EQ(tag_identifier_, tag->GetIdentifier()); | 107 EXPECT_EQ(tag_identifier_, tag->GetIdentifier()); |
108 tag_count_--; | 108 tag_count_--; |
109 tag_identifier_.clear(); | 109 tag_identifier_.clear(); |
110 } | 110 } |
111 | 111 |
112 // NfcPeer::Observer override. | 112 // NfcPeer::Observer override. |
113 virtual void RecordReceived( | 113 virtual void RecordReceived( |
114 NfcPeer* peer, const NfcNdefRecord* record) OVERRIDE { | 114 NfcPeer* peer, const NfcNdefRecord* record) override { |
115 EXPECT_EQ(peer, adapter_->GetPeer(peer_identifier_)); | 115 EXPECT_EQ(peer, adapter_->GetPeer(peer_identifier_)); |
116 EXPECT_EQ(peer_identifier_, peer->GetIdentifier()); | 116 EXPECT_EQ(peer_identifier_, peer->GetIdentifier()); |
117 peer_records_received_count_++; | 117 peer_records_received_count_++; |
118 } | 118 } |
119 | 119 |
120 // NfcNdefTagTechnology::Observer override. | 120 // NfcNdefTagTechnology::Observer override. |
121 virtual void RecordReceived( | 121 virtual void RecordReceived( |
122 NfcTag* tag, const NfcNdefRecord* record) OVERRIDE { | 122 NfcTag* tag, const NfcNdefRecord* record) override { |
123 EXPECT_EQ(tag, adapter_->GetTag(tag_identifier_)); | 123 EXPECT_EQ(tag, adapter_->GetTag(tag_identifier_)); |
124 EXPECT_EQ(tag_identifier_, tag->GetIdentifier()); | 124 EXPECT_EQ(tag_identifier_, tag->GetIdentifier()); |
125 tag_records_received_count_++; | 125 tag_records_received_count_++; |
126 } | 126 } |
127 | 127 |
128 int present_changed_count_; | 128 int present_changed_count_; |
129 int powered_changed_count_; | 129 int powered_changed_count_; |
130 int polling_changed_count_; | 130 int polling_changed_count_; |
131 int peer_records_received_count_; | 131 int peer_records_received_count_; |
132 int tag_records_received_count_; | 132 int tag_records_received_count_; |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 EXPECT_TRUE(title->GetString(NfcNdefRecord::kFieldText, &string_value)); | 854 EXPECT_TRUE(title->GetString(NfcNdefRecord::kFieldText, &string_value)); |
855 EXPECT_EQ(kText, string_value); | 855 EXPECT_EQ(kText, string_value); |
856 EXPECT_TRUE(title->GetString( | 856 EXPECT_TRUE(title->GetString( |
857 NfcNdefRecord::kFieldLanguageCode, &string_value)); | 857 NfcNdefRecord::kFieldLanguageCode, &string_value)); |
858 EXPECT_EQ(kLanguageCode, string_value); | 858 EXPECT_EQ(kLanguageCode, string_value); |
859 EXPECT_TRUE(title->GetString(NfcNdefRecord::kFieldEncoding, &string_value)); | 859 EXPECT_TRUE(title->GetString(NfcNdefRecord::kFieldEncoding, &string_value)); |
860 EXPECT_EQ(kEncoding, string_value); | 860 EXPECT_EQ(kEncoding, string_value); |
861 } | 861 } |
862 | 862 |
863 } // namespace chromeos | 863 } // namespace chromeos |
OLD | NEW |