OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chromeos/chromeos_switches.h" | 8 #include "chromeos/chromeos_switches.h" |
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 request_passkey_count_(0), | 129 request_passkey_count_(0), |
130 display_pincode_count_(0), | 130 display_pincode_count_(0), |
131 display_passkey_count_(0), | 131 display_passkey_count_(0), |
132 keys_entered_count_(0), | 132 keys_entered_count_(0), |
133 confirm_passkey_count_(0), | 133 confirm_passkey_count_(0), |
134 dismiss_count_(0), | 134 dismiss_count_(0), |
135 last_passkey_(9999999U), | 135 last_passkey_(9999999U), |
136 last_entered_(999U) {} | 136 last_entered_(999U) {} |
137 virtual ~TestPairingDelegate() {} | 137 virtual ~TestPairingDelegate() {} |
138 | 138 |
139 void RequestPinCode(BluetoothDevice* device) OVERRIDE { | 139 virtual void RequestPinCode(BluetoothDevice* device) OVERRIDE { |
140 ++call_count_; | 140 ++call_count_; |
141 ++request_pincode_count_; | 141 ++request_pincode_count_; |
142 QuitMessageLoop(); | 142 QuitMessageLoop(); |
143 } | 143 } |
144 | 144 |
145 void RequestPasskey(BluetoothDevice* device) OVERRIDE { | 145 virtual void RequestPasskey(BluetoothDevice* device) OVERRIDE { |
146 ++call_count_; | 146 ++call_count_; |
147 ++request_passkey_count_; | 147 ++request_passkey_count_; |
148 QuitMessageLoop(); | 148 QuitMessageLoop(); |
149 } | 149 } |
150 | 150 |
151 void DisplayPinCode(BluetoothDevice* device, | 151 virtual void DisplayPinCode(BluetoothDevice* device, |
152 const std::string& pincode) OVERRIDE { | 152 const std::string& pincode) OVERRIDE { |
153 ++call_count_; | 153 ++call_count_; |
154 ++display_pincode_count_; | 154 ++display_pincode_count_; |
155 last_pincode_ = pincode; | 155 last_pincode_ = pincode; |
156 QuitMessageLoop(); | 156 QuitMessageLoop(); |
157 } | 157 } |
158 | 158 |
159 void DisplayPasskey(BluetoothDevice* device, | 159 virtual void DisplayPasskey(BluetoothDevice* device, |
160 uint32 passkey) OVERRIDE { | 160 uint32 passkey) OVERRIDE { |
161 ++call_count_; | 161 ++call_count_; |
162 ++display_passkey_count_; | 162 ++display_passkey_count_; |
163 last_passkey_ = passkey; | 163 last_passkey_ = passkey; |
164 QuitMessageLoop(); | 164 QuitMessageLoop(); |
165 } | 165 } |
166 | 166 |
167 void KeysEntered(BluetoothDevice* device, | 167 virtual void KeysEntered(BluetoothDevice* device, uint32 entered) OVERRIDE { |
168 uint32 entered) OVERRIDE { | |
169 ++call_count_; | 168 ++call_count_; |
170 ++keys_entered_count_; | 169 ++keys_entered_count_; |
171 last_entered_ = entered; | 170 last_entered_ = entered; |
172 QuitMessageLoop(); | 171 QuitMessageLoop(); |
173 } | 172 } |
174 | 173 |
175 void ConfirmPasskey(BluetoothDevice* device, | 174 virtual void ConfirmPasskey(BluetoothDevice* device, |
176 uint32 passkey) OVERRIDE { | 175 uint32 passkey) OVERRIDE { |
177 ++call_count_; | 176 ++call_count_; |
178 ++confirm_passkey_count_; | 177 ++confirm_passkey_count_; |
179 last_passkey_ = passkey; | 178 last_passkey_ = passkey; |
180 QuitMessageLoop(); | 179 QuitMessageLoop(); |
181 } | 180 } |
182 | 181 |
183 void DismissDisplayOrConfirm() OVERRIDE { | 182 virtual void DismissDisplayOrConfirm() OVERRIDE { |
184 ++call_count_; | 183 ++call_count_; |
185 ++dismiss_count_; | 184 ++dismiss_count_; |
186 QuitMessageLoop(); | 185 QuitMessageLoop(); |
187 } | 186 } |
188 | 187 |
189 int call_count_; | 188 int call_count_; |
190 int request_pincode_count_; | 189 int request_pincode_count_; |
191 int request_passkey_count_; | 190 int request_passkey_count_; |
192 int display_pincode_count_; | 191 int display_pincode_count_; |
193 int display_passkey_count_; | 192 int display_passkey_count_; |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 EXPECT_FALSE(device->IsConnected()); | 1982 EXPECT_FALSE(device->IsConnected()); |
1984 EXPECT_FALSE(device->IsConnecting()); | 1983 EXPECT_FALSE(device->IsConnecting()); |
1985 EXPECT_FALSE(device->IsPaired()); | 1984 EXPECT_FALSE(device->IsPaired()); |
1986 | 1985 |
1987 // Pairing dialog should be dismissed | 1986 // Pairing dialog should be dismissed |
1988 EXPECT_EQ(1, pairing_delegate.call_count_); | 1987 EXPECT_EQ(1, pairing_delegate.call_count_); |
1989 EXPECT_EQ(1, pairing_delegate.dismiss_count_); | 1988 EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
1990 } | 1989 } |
1991 | 1990 |
1992 } // namespace chromeos | 1991 } // namespace chromeos |
OLD | NEW |