| 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 "chromeos/dbus/mock_bluetooth_adapter_client.h" | 5 #include "chromeos/dbus/mock_bluetooth_adapter_client.h" |
| 6 #include "chromeos/dbus/mock_bluetooth_manager_client.h" | 6 #include "chromeos/dbus/mock_bluetooth_manager_client.h" |
| 7 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 7 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
| 8 #include "dbus/object_path.h" | 8 #include "dbus/object_path.h" |
| 9 #include "device/bluetooth/bluetooth_adapter.h" | 9 #include "device/bluetooth/bluetooth_adapter.h" |
| 10 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 10 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterNotPresent) { | 70 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterNotPresent) { |
| 71 // Create the default adapter instance; | 71 // Create the default adapter instance; |
| 72 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 72 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 73 // a callback to obtain the adapter path. | 73 // a callback to obtain the adapter path. |
| 74 BluetoothManagerClient::AdapterCallback adapter_callback; | 74 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 75 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 75 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 76 .WillOnce(SaveArg<0>(&adapter_callback)); | 76 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 77 | 77 |
| 78 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 78 BluetoothAdapterFactory::GetAdapter( |
| 79 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 79 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 80 base::Unretained(this))); | 80 base::Unretained(this))); |
| 81 ASSERT_TRUE(adapter_ != NULL); | 81 ASSERT_TRUE(adapter_ != NULL); |
| 82 | 82 |
| 83 // Call the adapter callback; make out it failed. | 83 // Call the adapter callback; make out it failed. |
| 84 // BluetoothAdapter::Observer::AdapterPresentChanged must not be called. | 84 // BluetoothAdapter::Observer::AdapterPresentChanged must not be called. |
| 85 MockBluetoothAdapter::Observer adapter_observer; | 85 MockBluetoothAdapter::Observer adapter_observer; |
| 86 adapter_->AddObserver(&adapter_observer); | 86 adapter_->AddObserver(&adapter_observer); |
| 87 | 87 |
| 88 EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter_.get(), _)) | 88 EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter_.get(), _)) |
| 89 .Times(0); | 89 .Times(0); |
| 90 | 90 |
| 91 adapter_callback.Run(dbus::ObjectPath(""), false); | 91 adapter_callback.Run(dbus::ObjectPath(""), false); |
| 92 | 92 |
| 93 // Adapter should not be present. | 93 // Adapter should not be present. |
| 94 EXPECT_FALSE(adapter_->IsPresent()); | 94 EXPECT_FALSE(adapter_->IsPresent()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterWithAddress) { | 97 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterWithAddress) { |
| 98 const dbus::ObjectPath adapter_path("/fake/hci0"); | 98 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 99 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 99 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 100 | 100 |
| 101 // Create the default adapter instance; | 101 // Create the default adapter instance; |
| 102 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 102 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 103 // a callback to obtain the adapter path. | 103 // a callback to obtain the adapter path. |
| 104 BluetoothManagerClient::AdapterCallback adapter_callback; | 104 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 105 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 105 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 106 .WillOnce(SaveArg<0>(&adapter_callback)); | 106 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 107 | 107 |
| 108 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 108 BluetoothAdapterFactory::GetAdapter( |
| 109 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 109 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 110 base::Unretained(this))); | 110 base::Unretained(this))); |
| 111 | 111 |
| 112 // Call the adapter callback; | 112 // Call the adapter callback; |
| 113 // BluetoothAdapterClient::GetProperties will be called once to obtain | 113 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 114 // the property set. | 114 // the property set. |
| 115 MockBluetoothAdapterClient::Properties adapter_properties; | 115 MockBluetoothAdapterClient::Properties adapter_properties; |
| 116 adapter_properties.address.ReplaceValue(adapter_address); | 116 adapter_properties.address.ReplaceValue(adapter_address); |
| 117 | 117 |
| 118 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 118 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 137 const dbus::ObjectPath adapter_path("/fake/hci0"); | 137 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 138 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 138 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 139 | 139 |
| 140 // Create the default adapter instance; | 140 // Create the default adapter instance; |
| 141 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 141 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 142 // a callback to obtain the adapter path. | 142 // a callback to obtain the adapter path. |
| 143 BluetoothManagerClient::AdapterCallback adapter_callback; | 143 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 144 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 144 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 145 .WillOnce(SaveArg<0>(&adapter_callback)); | 145 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 146 | 146 |
| 147 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 147 BluetoothAdapterFactory::GetAdapter( |
| 148 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 148 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 149 base::Unretained(this))); | 149 base::Unretained(this))); |
| 150 | 150 |
| 151 // Call the adapter callback; | 151 // Call the adapter callback; |
| 152 // BluetoothAdapterClient::GetProperties will be called once to obtain | 152 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 153 // the property set. | 153 // the property set. |
| 154 MockBluetoothAdapterClient::Properties adapter_properties; | 154 MockBluetoothAdapterClient::Properties adapter_properties; |
| 155 | 155 |
| 156 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 156 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| 157 .WillRepeatedly(Return(&adapter_properties)); | 157 .WillRepeatedly(Return(&adapter_properties)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const dbus::ObjectPath adapter_path("/fake/hci0"); | 192 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 193 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 193 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 194 | 194 |
| 195 // Create the default adapter instance; | 195 // Create the default adapter instance; |
| 196 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 196 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 197 // a callback to obtain the adapter path. | 197 // a callback to obtain the adapter path. |
| 198 BluetoothManagerClient::AdapterCallback adapter_callback; | 198 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 199 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 199 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 200 .WillOnce(SaveArg<0>(&adapter_callback)); | 200 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 201 | 201 |
| 202 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 202 BluetoothAdapterFactory::GetAdapter( |
| 203 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 203 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 204 base::Unretained(this))); | 204 base::Unretained(this))); |
| 205 | 205 |
| 206 // Call the adapter callback; make out it failed. | 206 // Call the adapter callback; make out it failed. |
| 207 adapter_callback.Run(dbus::ObjectPath(""), false); | 207 adapter_callback.Run(dbus::ObjectPath(""), false); |
| 208 | 208 |
| 209 // Tell the adapter the default adapter changed; | 209 // Tell the adapter the default adapter changed; |
| 210 // BluetoothAdapterClient::GetProperties will be called once to obtain | 210 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 211 // the property set. | 211 // the property set. |
| 212 MockBluetoothAdapterClient::Properties adapter_properties; | 212 MockBluetoothAdapterClient::Properties adapter_properties; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 239 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 239 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 240 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; | 240 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; |
| 241 | 241 |
| 242 // Create the default adapter instance; | 242 // Create the default adapter instance; |
| 243 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 243 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 244 // a callback to obtain the adapter path. | 244 // a callback to obtain the adapter path. |
| 245 BluetoothManagerClient::AdapterCallback adapter_callback; | 245 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 246 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 246 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 247 .WillOnce(SaveArg<0>(&adapter_callback)); | 247 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 248 | 248 |
| 249 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 249 BluetoothAdapterFactory::GetAdapter( |
| 250 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 250 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 251 base::Unretained(this))); | 251 base::Unretained(this))); |
| 252 | 252 |
| 253 // Call the adapter callback; | 253 // Call the adapter callback; |
| 254 // BluetoothAdapterClient::GetProperties will be called once to obtain | 254 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 255 // the property set. | 255 // the property set. |
| 256 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 256 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 257 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 257 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 258 | 258 |
| 259 EXPECT_CALL(*mock_adapter_client_, GetProperties(initial_adapter_path)) | 259 EXPECT_CALL(*mock_adapter_client_, GetProperties(initial_adapter_path)) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 const dbus::ObjectPath adapter_path("/fake/hci0"); | 297 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 298 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 298 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 299 | 299 |
| 300 // Create the default adapter instance; | 300 // Create the default adapter instance; |
| 301 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 301 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 302 // a callback to obtain the adapter path. | 302 // a callback to obtain the adapter path. |
| 303 BluetoothManagerClient::AdapterCallback adapter_callback; | 303 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 304 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 304 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 305 .WillOnce(SaveArg<0>(&adapter_callback)); | 305 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 306 | 306 |
| 307 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 307 BluetoothAdapterFactory::GetAdapter( |
| 308 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 308 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 309 base::Unretained(this))); | 309 base::Unretained(this))); |
| 310 | 310 |
| 311 // Call the adapter callback; make out it failed. | 311 // Call the adapter callback; make out it failed. |
| 312 adapter_callback.Run(dbus::ObjectPath(""), false); | 312 adapter_callback.Run(dbus::ObjectPath(""), false); |
| 313 | 313 |
| 314 // Tell the adapter the default adapter changed; | 314 // Tell the adapter the default adapter changed; |
| 315 // BluetoothAdapterClient::GetProperties will be called once to obtain | 315 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 316 // the property set. | 316 // the property set. |
| 317 MockBluetoothAdapterClient::Properties adapter_properties; | 317 MockBluetoothAdapterClient::Properties adapter_properties; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 357 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 358 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; | 358 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; |
| 359 | 359 |
| 360 // Create the default adapter instance; | 360 // Create the default adapter instance; |
| 361 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 361 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 362 // a callback to obtain the adapter path. | 362 // a callback to obtain the adapter path. |
| 363 BluetoothManagerClient::AdapterCallback adapter_callback; | 363 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 364 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 364 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 365 .WillOnce(SaveArg<0>(&adapter_callback)); | 365 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 366 | 366 |
| 367 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 367 BluetoothAdapterFactory::GetAdapter( |
| 368 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 368 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 369 base::Unretained(this))); | 369 base::Unretained(this))); |
| 370 | 370 |
| 371 // Call the adapter callback; | 371 // Call the adapter callback; |
| 372 // BluetoothAdapterClient::GetProperties will be called once to obtain | 372 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 373 // the property set. | 373 // the property set. |
| 374 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 374 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 375 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 375 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 376 | 376 |
| 377 EXPECT_CALL(*mock_adapter_client_, GetProperties(initial_adapter_path)) | 377 EXPECT_CALL(*mock_adapter_client_, GetProperties(initial_adapter_path)) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 const dbus::ObjectPath adapter_path("/fake/hci0"); | 424 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 425 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 425 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 426 | 426 |
| 427 // Create the default adapter instance; | 427 // Create the default adapter instance; |
| 428 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 428 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 429 // a callback to obtain the adapter path. | 429 // a callback to obtain the adapter path. |
| 430 BluetoothManagerClient::AdapterCallback adapter_callback; | 430 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 431 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 431 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 432 .WillOnce(SaveArg<0>(&adapter_callback)); | 432 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 433 | 433 |
| 434 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 434 BluetoothAdapterFactory::GetAdapter( |
| 435 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 435 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 436 base::Unretained(this))); | 436 base::Unretained(this))); |
| 437 | 437 |
| 438 // Call the adapter callback; | 438 // Call the adapter callback; |
| 439 // BluetoothAdapterClient::GetProperties will be called once to obtain | 439 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 440 // the property set. | 440 // the property set. |
| 441 MockBluetoothAdapterClient::Properties adapter_properties; | 441 MockBluetoothAdapterClient::Properties adapter_properties; |
| 442 adapter_properties.address.ReplaceValue(adapter_address); | 442 adapter_properties.address.ReplaceValue(adapter_address); |
| 443 | 443 |
| 444 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 444 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 468 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterWithoutAddressRemoved) { | 468 TEST_F(BluetoothAdapterChromeOsTest, DefaultAdapterWithoutAddressRemoved) { |
| 469 const dbus::ObjectPath adapter_path("/fake/hci0"); | 469 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 470 | 470 |
| 471 // Create the default adapter instance; | 471 // Create the default adapter instance; |
| 472 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 472 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 473 // a callback to obtain the adapter path. | 473 // a callback to obtain the adapter path. |
| 474 BluetoothManagerClient::AdapterCallback adapter_callback; | 474 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 475 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 475 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 476 .WillOnce(SaveArg<0>(&adapter_callback)); | 476 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 477 | 477 |
| 478 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 478 BluetoothAdapterFactory::GetAdapter( |
| 479 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 479 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 480 base::Unretained(this))); | 480 base::Unretained(this))); |
| 481 | 481 |
| 482 // Call the adapter callback; | 482 // Call the adapter callback; |
| 483 // BluetoothAdapterClient::GetProperties will be called once to obtain | 483 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 484 // the property set. | 484 // the property set. |
| 485 MockBluetoothAdapterClient::Properties adapter_properties; | 485 MockBluetoothAdapterClient::Properties adapter_properties; |
| 486 | 486 |
| 487 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 487 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| 488 .WillRepeatedly(Return(&adapter_properties)); | 488 .WillRepeatedly(Return(&adapter_properties)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 513 const dbus::ObjectPath adapter_path("/fake/hci0"); | 513 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 514 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 514 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 515 | 515 |
| 516 // Create the default adapter instance; | 516 // Create the default adapter instance; |
| 517 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 517 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 518 // a callback to obtain the adapter path. | 518 // a callback to obtain the adapter path. |
| 519 BluetoothManagerClient::AdapterCallback adapter_callback; | 519 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 520 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 520 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 521 .WillOnce(SaveArg<0>(&adapter_callback)); | 521 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 522 | 522 |
| 523 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 523 BluetoothAdapterFactory::GetAdapter( |
| 524 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 524 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 525 base::Unretained(this))); | 525 base::Unretained(this))); |
| 526 | 526 |
| 527 // Call the adapter callback; | 527 // Call the adapter callback; |
| 528 // BluetoothAdapterClient::GetProperties will be called once to obtain | 528 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 529 // the property set. | 529 // the property set. |
| 530 MockBluetoothAdapterClient::Properties adapter_properties; | 530 MockBluetoothAdapterClient::Properties adapter_properties; |
| 531 adapter_properties.address.ReplaceValue(adapter_address); | 531 adapter_properties.address.ReplaceValue(adapter_address); |
| 532 adapter_properties.powered.ReplaceValue(false); | 532 adapter_properties.powered.ReplaceValue(false); |
| 533 | 533 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 545 const dbus::ObjectPath adapter_path("/fake/hci0"); | 545 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 546 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 546 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 547 | 547 |
| 548 // Create the default adapter instance; | 548 // Create the default adapter instance; |
| 549 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 549 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 550 // a callback to obtain the adapter path. | 550 // a callback to obtain the adapter path. |
| 551 BluetoothManagerClient::AdapterCallback adapter_callback; | 551 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 552 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 552 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 553 .WillOnce(SaveArg<0>(&adapter_callback)); | 553 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 554 | 554 |
| 555 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 555 BluetoothAdapterFactory::GetAdapter( |
| 556 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 556 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 557 base::Unretained(this))); | 557 base::Unretained(this))); |
| 558 | 558 |
| 559 // Call the adapter callback; | 559 // Call the adapter callback; |
| 560 // BluetoothAdapterClient::GetProperties will be called once to obtain | 560 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 561 // the property set. | 561 // the property set. |
| 562 MockBluetoothAdapterClient::Properties adapter_properties; | 562 MockBluetoothAdapterClient::Properties adapter_properties; |
| 563 adapter_properties.address.ReplaceValue(adapter_address); | 563 adapter_properties.address.ReplaceValue(adapter_address); |
| 564 adapter_properties.powered.ReplaceValue(true); | 564 adapter_properties.powered.ReplaceValue(true); |
| 565 | 565 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 587 const dbus::ObjectPath adapter_path("/fake/hci0"); | 587 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 588 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 588 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 589 | 589 |
| 590 // Create the default adapter instance; | 590 // Create the default adapter instance; |
| 591 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 591 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 592 // a callback to obtain the adapter path. | 592 // a callback to obtain the adapter path. |
| 593 BluetoothManagerClient::AdapterCallback adapter_callback; | 593 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 594 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 594 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 595 .WillOnce(SaveArg<0>(&adapter_callback)); | 595 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 596 | 596 |
| 597 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 597 BluetoothAdapterFactory::GetAdapter( |
| 598 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 598 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 599 base::Unretained(this))); | 599 base::Unretained(this))); |
| 600 | 600 |
| 601 // Call the adapter callback; | 601 // Call the adapter callback; |
| 602 // BluetoothAdapterClient::GetProperties will be called once to obtain | 602 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 603 // the property set but BluetoothAdapter::Observer::AdapterPoweredChanged | 603 // the property set but BluetoothAdapter::Observer::AdapterPoweredChanged |
| 604 // should not yet be called. | 604 // should not yet be called. |
| 605 MockBluetoothAdapterClient::Properties adapter_properties; | 605 MockBluetoothAdapterClient::Properties adapter_properties; |
| 606 adapter_properties.powered.ReplaceValue(true); | 606 adapter_properties.powered.ReplaceValue(true); |
| 607 | 607 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 const dbus::ObjectPath adapter_path("/fake/hci0"); | 645 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 646 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 646 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 647 | 647 |
| 648 // Create the default adapter instance; | 648 // Create the default adapter instance; |
| 649 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 649 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 650 // a callback to obtain the adapter path. | 650 // a callback to obtain the adapter path. |
| 651 BluetoothManagerClient::AdapterCallback adapter_callback; | 651 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 652 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 652 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 653 .WillOnce(SaveArg<0>(&adapter_callback)); | 653 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 654 | 654 |
| 655 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 655 BluetoothAdapterFactory::GetAdapter( |
| 656 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 656 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 657 base::Unretained(this))); | 657 base::Unretained(this))); |
| 658 | 658 |
| 659 // Call the adapter callback; | 659 // Call the adapter callback; |
| 660 // BluetoothAdapterClient::GetProperties will be called once to obtain | 660 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 661 // the property set. | 661 // the property set. |
| 662 MockBluetoothAdapterClient::Properties adapter_properties; | 662 MockBluetoothAdapterClient::Properties adapter_properties; |
| 663 adapter_properties.address.ReplaceValue(adapter_address); | 663 adapter_properties.address.ReplaceValue(adapter_address); |
| 664 adapter_properties.powered.ReplaceValue(false); | 664 adapter_properties.powered.ReplaceValue(false); |
| 665 | 665 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 696 const dbus::ObjectPath adapter_path("/fake/hci0"); | 696 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 697 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 697 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 698 | 698 |
| 699 // Create the default adapter instance; | 699 // Create the default adapter instance; |
| 700 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 700 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 701 // a callback to obtain the adapter path. | 701 // a callback to obtain the adapter path. |
| 702 BluetoothManagerClient::AdapterCallback adapter_callback; | 702 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 703 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 703 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 704 .WillOnce(SaveArg<0>(&adapter_callback)); | 704 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 705 | 705 |
| 706 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 706 BluetoothAdapterFactory::GetAdapter( |
| 707 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 707 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 708 base::Unretained(this))); | 708 base::Unretained(this))); |
| 709 | 709 |
| 710 // Call the adapter callback; | 710 // Call the adapter callback; |
| 711 // BluetoothAdapterClient::GetProperties will be called once to obtain | 711 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 712 // the property set. | 712 // the property set. |
| 713 MockBluetoothAdapterClient::Properties adapter_properties; | 713 MockBluetoothAdapterClient::Properties adapter_properties; |
| 714 adapter_properties.address.ReplaceValue(adapter_address); | 714 adapter_properties.address.ReplaceValue(adapter_address); |
| 715 adapter_properties.powered.ReplaceValue(true); | 715 adapter_properties.powered.ReplaceValue(true); |
| 716 | 716 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 746 const dbus::ObjectPath adapter_path("/fake/hci0"); | 746 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 747 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 747 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 748 | 748 |
| 749 // Create the default adapter instance; | 749 // Create the default adapter instance; |
| 750 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 750 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 751 // a callback to obtain the adapter path. | 751 // a callback to obtain the adapter path. |
| 752 BluetoothManagerClient::AdapterCallback adapter_callback; | 752 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 753 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 753 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 754 .WillOnce(SaveArg<0>(&adapter_callback)); | 754 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 755 | 755 |
| 756 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 756 BluetoothAdapterFactory::GetAdapter( |
| 757 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 757 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 758 base::Unretained(this))); | 758 base::Unretained(this))); |
| 759 | 759 |
| 760 // Call the adapter callback; | 760 // Call the adapter callback; |
| 761 // BluetoothAdapterClient::GetProperties will be called once to obtain | 761 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 762 // the property set but BluetoothAdapter::Observer::AdapterPoweredChanged | 762 // the property set but BluetoothAdapter::Observer::AdapterPoweredChanged |
| 763 // should not yet be called. | 763 // should not yet be called. |
| 764 MockBluetoothAdapterClient::Properties adapter_properties; | 764 MockBluetoothAdapterClient::Properties adapter_properties; |
| 765 | 765 |
| 766 MockBluetoothAdapter::Observer adapter_observer; | 766 MockBluetoothAdapter::Observer adapter_observer; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 818 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 819 const std::string new_adapter_address = "00:C0:11:CO:FE:FE"; | 819 const std::string new_adapter_address = "00:C0:11:CO:FE:FE"; |
| 820 | 820 |
| 821 // Create the default adapter instance; | 821 // Create the default adapter instance; |
| 822 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 822 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 823 // a callback to obtain the adapter path. | 823 // a callback to obtain the adapter path. |
| 824 BluetoothManagerClient::AdapterCallback adapter_callback; | 824 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 825 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 825 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 826 .WillOnce(SaveArg<0>(&adapter_callback)); | 826 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 827 | 827 |
| 828 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 828 BluetoothAdapterFactory::GetAdapter( |
| 829 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 829 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 830 base::Unretained(this))); | 830 base::Unretained(this))); |
| 831 | 831 |
| 832 // Call the adapter callback; | 832 // Call the adapter callback; |
| 833 // BluetoothAdapterClient::GetProperties will be called once to obtain | 833 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 834 // the property set. | 834 // the property set. |
| 835 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 835 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 836 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 836 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 837 initial_adapter_properties.powered.ReplaceValue(true); | 837 initial_adapter_properties.powered.ReplaceValue(true); |
| 838 | 838 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 883 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 884 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; | 884 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; |
| 885 | 885 |
| 886 // Create the default adapter instance; | 886 // Create the default adapter instance; |
| 887 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 887 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 888 // a callback to obtain the adapter path. | 888 // a callback to obtain the adapter path. |
| 889 BluetoothManagerClient::AdapterCallback adapter_callback; | 889 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 890 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 890 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 891 .WillOnce(SaveArg<0>(&adapter_callback)); | 891 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 892 | 892 |
| 893 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 893 BluetoothAdapterFactory::GetAdapter( |
| 894 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 894 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 895 base::Unretained(this))); | 895 base::Unretained(this))); |
| 896 | 896 |
| 897 // Call the adapter callback; | 897 // Call the adapter callback; |
| 898 // BluetoothAdapterClient::GetProperties will be called once to obtain | 898 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 899 // the property set. | 899 // the property set. |
| 900 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 900 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 901 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 901 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 902 initial_adapter_properties.powered.ReplaceValue(true); | 902 initial_adapter_properties.powered.ReplaceValue(true); |
| 903 | 903 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 const dbus::ObjectPath adapter_path("/fake/hci0"); | 955 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 956 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 956 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 957 | 957 |
| 958 // Create the default adapter instance; | 958 // Create the default adapter instance; |
| 959 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 959 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 960 // a callback to obtain the adapter path. | 960 // a callback to obtain the adapter path. |
| 961 BluetoothManagerClient::AdapterCallback adapter_callback; | 961 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 962 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 962 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 963 .WillOnce(SaveArg<0>(&adapter_callback)); | 963 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 964 | 964 |
| 965 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 965 BluetoothAdapterFactory::GetAdapter( |
| 966 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 966 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 967 base::Unretained(this))); | 967 base::Unretained(this))); |
| 968 | 968 |
| 969 // Call the adapter callback; | 969 // Call the adapter callback; |
| 970 // BluetoothAdapterClient::GetProperties will be called once to obtain | 970 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 971 // the property set. | 971 // the property set. |
| 972 MockBluetoothAdapterClient::Properties adapter_properties; | 972 MockBluetoothAdapterClient::Properties adapter_properties; |
| 973 adapter_properties.address.ReplaceValue(adapter_address); | 973 adapter_properties.address.ReplaceValue(adapter_address); |
| 974 adapter_properties.powered.ReplaceValue(true); | 974 adapter_properties.powered.ReplaceValue(true); |
| 975 | 975 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1002 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1002 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1003 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1003 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1004 | 1004 |
| 1005 // Create the default adapter instance; | 1005 // Create the default adapter instance; |
| 1006 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1006 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1007 // a callback to obtain the adapter path. | 1007 // a callback to obtain the adapter path. |
| 1008 BluetoothManagerClient::AdapterCallback adapter_callback; | 1008 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1009 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1009 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1010 .WillOnce(SaveArg<0>(&adapter_callback)); | 1010 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1011 | 1011 |
| 1012 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1012 BluetoothAdapterFactory::GetAdapter( |
| 1013 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1013 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1014 base::Unretained(this))); | 1014 base::Unretained(this))); |
| 1015 | 1015 |
| 1016 // Call the adapter callback; | 1016 // Call the adapter callback; |
| 1017 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1017 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1018 // the property set. | 1018 // the property set. |
| 1019 MockBluetoothAdapterClient::Properties adapter_properties; | 1019 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1020 | 1020 |
| 1021 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 1021 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| 1022 .WillRepeatedly(Return(&adapter_properties)); | 1022 .WillRepeatedly(Return(&adapter_properties)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1051 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1051 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1052 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1052 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1053 | 1053 |
| 1054 // Create the default adapter instance; | 1054 // Create the default adapter instance; |
| 1055 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1055 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1056 // a callback to obtain the adapter path. | 1056 // a callback to obtain the adapter path. |
| 1057 BluetoothManagerClient::AdapterCallback adapter_callback; | 1057 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1058 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1058 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1059 .WillOnce(SaveArg<0>(&adapter_callback)); | 1059 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1060 | 1060 |
| 1061 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1061 BluetoothAdapterFactory::GetAdapter( |
| 1062 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1062 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1063 base::Unretained(this))); | 1063 base::Unretained(this))); |
| 1064 | 1064 |
| 1065 // Call the adapter callback; | 1065 // Call the adapter callback; |
| 1066 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1066 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1067 // the property set. | 1067 // the property set. |
| 1068 MockBluetoothAdapterClient::Properties adapter_properties; | 1068 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1069 | 1069 |
| 1070 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) | 1070 EXPECT_CALL(*mock_adapter_client_, GetProperties(adapter_path)) |
| 1071 .WillRepeatedly(Return(&adapter_properties)); | 1071 .WillRepeatedly(Return(&adapter_properties)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1101 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1101 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1102 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1102 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1103 | 1103 |
| 1104 // Create the default adapter instance; | 1104 // Create the default adapter instance; |
| 1105 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1105 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1106 // a callback to obtain the adapter path. | 1106 // a callback to obtain the adapter path. |
| 1107 BluetoothManagerClient::AdapterCallback adapter_callback; | 1107 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1108 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1108 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1109 .WillOnce(SaveArg<0>(&adapter_callback)); | 1109 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1110 | 1110 |
| 1111 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1111 BluetoothAdapterFactory::GetAdapter( |
| 1112 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1112 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1113 base::Unretained(this))); | 1113 base::Unretained(this))); |
| 1114 | 1114 |
| 1115 // Call the adapter callback; | 1115 // Call the adapter callback; |
| 1116 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1116 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1117 // the property set. | 1117 // the property set. |
| 1118 MockBluetoothAdapterClient::Properties adapter_properties; | 1118 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1119 adapter_properties.address.ReplaceValue(adapter_address); | 1119 adapter_properties.address.ReplaceValue(adapter_address); |
| 1120 adapter_properties.discovering.ReplaceValue(false); | 1120 adapter_properties.discovering.ReplaceValue(false); |
| 1121 | 1121 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1133 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1133 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1134 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1134 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1135 | 1135 |
| 1136 // Create the default adapter instance; | 1136 // Create the default adapter instance; |
| 1137 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1137 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1138 // a callback to obtain the adapter path. | 1138 // a callback to obtain the adapter path. |
| 1139 BluetoothManagerClient::AdapterCallback adapter_callback; | 1139 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1140 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1140 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1141 .WillOnce(SaveArg<0>(&adapter_callback)); | 1141 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1142 | 1142 |
| 1143 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1143 BluetoothAdapterFactory::GetAdapter( |
| 1144 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1144 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1145 base::Unretained(this))); | 1145 base::Unretained(this))); |
| 1146 | 1146 |
| 1147 // Call the adapter callback; | 1147 // Call the adapter callback; |
| 1148 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1148 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1149 // the property set. | 1149 // the property set. |
| 1150 MockBluetoothAdapterClient::Properties adapter_properties; | 1150 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1151 adapter_properties.address.ReplaceValue(adapter_address); | 1151 adapter_properties.address.ReplaceValue(adapter_address); |
| 1152 adapter_properties.discovering.ReplaceValue(true); | 1152 adapter_properties.discovering.ReplaceValue(true); |
| 1153 | 1153 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1175 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1175 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1176 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1176 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1177 | 1177 |
| 1178 // Create the default adapter instance; | 1178 // Create the default adapter instance; |
| 1179 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1179 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1180 // a callback to obtain the adapter path. | 1180 // a callback to obtain the adapter path. |
| 1181 BluetoothManagerClient::AdapterCallback adapter_callback; | 1181 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1182 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1182 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1183 .WillOnce(SaveArg<0>(&adapter_callback)); | 1183 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1184 | 1184 |
| 1185 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1185 BluetoothAdapterFactory::GetAdapter( |
| 1186 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1186 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1187 base::Unretained(this))); | 1187 base::Unretained(this))); |
| 1188 | 1188 |
| 1189 // Call the adapter callback; | 1189 // Call the adapter callback; |
| 1190 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1190 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1191 // the property set but BluetoothAdapter::Observer::AdapterDiscoveringChanged | 1191 // the property set but BluetoothAdapter::Observer::AdapterDiscoveringChanged |
| 1192 // should not yet be called. | 1192 // should not yet be called. |
| 1193 MockBluetoothAdapterClient::Properties adapter_properties; | 1193 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1194 adapter_properties.discovering.ReplaceValue(true); | 1194 adapter_properties.discovering.ReplaceValue(true); |
| 1195 | 1195 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1233 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1234 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1234 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1235 | 1235 |
| 1236 // Create the default adapter instance; | 1236 // Create the default adapter instance; |
| 1237 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1237 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1238 // a callback to obtain the adapter path. | 1238 // a callback to obtain the adapter path. |
| 1239 BluetoothManagerClient::AdapterCallback adapter_callback; | 1239 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1240 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1240 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1241 .WillOnce(SaveArg<0>(&adapter_callback)); | 1241 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1242 | 1242 |
| 1243 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1243 BluetoothAdapterFactory::GetAdapter( |
| 1244 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1244 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1245 base::Unretained(this))); | 1245 base::Unretained(this))); |
| 1246 | 1246 |
| 1247 // Call the adapter callback; | 1247 // Call the adapter callback; |
| 1248 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1248 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1249 // the property set. | 1249 // the property set. |
| 1250 MockBluetoothAdapterClient::Properties adapter_properties; | 1250 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1251 adapter_properties.address.ReplaceValue(adapter_address); | 1251 adapter_properties.address.ReplaceValue(adapter_address); |
| 1252 adapter_properties.discovering.ReplaceValue(false); | 1252 adapter_properties.discovering.ReplaceValue(false); |
| 1253 | 1253 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1285 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1286 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1286 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1287 | 1287 |
| 1288 // Create the default adapter instance; | 1288 // Create the default adapter instance; |
| 1289 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1289 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1290 // a callback to obtain the adapter path. | 1290 // a callback to obtain the adapter path. |
| 1291 BluetoothManagerClient::AdapterCallback adapter_callback; | 1291 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1292 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1292 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1293 .WillOnce(SaveArg<0>(&adapter_callback)); | 1293 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1294 | 1294 |
| 1295 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1295 BluetoothAdapterFactory::GetAdapter( |
| 1296 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1296 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1297 base::Unretained(this))); | 1297 base::Unretained(this))); |
| 1298 | 1298 |
| 1299 // Call the adapter callback; | 1299 // Call the adapter callback; |
| 1300 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1300 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1301 // the property set. | 1301 // the property set. |
| 1302 MockBluetoothAdapterClient::Properties adapter_properties; | 1302 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1303 adapter_properties.address.ReplaceValue(adapter_address); | 1303 adapter_properties.address.ReplaceValue(adapter_address); |
| 1304 adapter_properties.discovering.ReplaceValue(true); | 1304 adapter_properties.discovering.ReplaceValue(true); |
| 1305 | 1305 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1336 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1336 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1337 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1337 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1338 | 1338 |
| 1339 // Create the default adapter instance; | 1339 // Create the default adapter instance; |
| 1340 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1340 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1341 // a callback to obtain the adapter path. | 1341 // a callback to obtain the adapter path. |
| 1342 BluetoothManagerClient::AdapterCallback adapter_callback; | 1342 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1343 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1343 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1344 .WillOnce(SaveArg<0>(&adapter_callback)); | 1344 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1345 | 1345 |
| 1346 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1346 BluetoothAdapterFactory::GetAdapter( |
| 1347 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1347 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1348 base::Unretained(this))); | 1348 base::Unretained(this))); |
| 1349 | 1349 |
| 1350 // Call the adapter callback; | 1350 // Call the adapter callback; |
| 1351 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1351 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1352 // the property set but BluetoothAdapter::Observer::AdapterDiscoveringChanged | 1352 // the property set but BluetoothAdapter::Observer::AdapterDiscoveringChanged |
| 1353 // should not yet be called. | 1353 // should not yet be called. |
| 1354 MockBluetoothAdapterClient::Properties adapter_properties; | 1354 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1355 | 1355 |
| 1356 MockBluetoothAdapter::Observer adapter_observer; | 1356 MockBluetoothAdapter::Observer adapter_observer; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 1408 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1409 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; | 1409 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; |
| 1410 | 1410 |
| 1411 // Create the default adapter instance; | 1411 // Create the default adapter instance; |
| 1412 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1412 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1413 // a callback to obtain the adapter path. | 1413 // a callback to obtain the adapter path. |
| 1414 BluetoothManagerClient::AdapterCallback adapter_callback; | 1414 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1415 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1415 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1416 .WillOnce(SaveArg<0>(&adapter_callback)); | 1416 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1417 | 1417 |
| 1418 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1418 BluetoothAdapterFactory::GetAdapter( |
| 1419 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1419 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1420 base::Unretained(this))); | 1420 base::Unretained(this))); |
| 1421 | 1421 |
| 1422 // Call the adapter callback; | 1422 // Call the adapter callback; |
| 1423 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1423 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1424 // the property set. | 1424 // the property set. |
| 1425 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 1425 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 1426 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 1426 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 1427 initial_adapter_properties.discovering.ReplaceValue(true); | 1427 initial_adapter_properties.discovering.ReplaceValue(true); |
| 1428 | 1428 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; | 1474 const std::string initial_adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1475 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; | 1475 const std::string new_adapter_address = "BA:C0:11:CO:FE:FE"; |
| 1476 | 1476 |
| 1477 // Create the default adapter instance; | 1477 // Create the default adapter instance; |
| 1478 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1478 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1479 // a callback to obtain the adapter path. | 1479 // a callback to obtain the adapter path. |
| 1480 BluetoothManagerClient::AdapterCallback adapter_callback; | 1480 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1481 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1481 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1482 .WillOnce(SaveArg<0>(&adapter_callback)); | 1482 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1483 | 1483 |
| 1484 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1484 BluetoothAdapterFactory::GetAdapter( |
| 1485 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1485 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1486 base::Unretained(this))); | 1486 base::Unretained(this))); |
| 1487 | 1487 |
| 1488 // Call the adapter callback; | 1488 // Call the adapter callback; |
| 1489 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1489 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1490 // the property set. | 1490 // the property set. |
| 1491 MockBluetoothAdapterClient::Properties initial_adapter_properties; | 1491 MockBluetoothAdapterClient::Properties initial_adapter_properties; |
| 1492 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); | 1492 initial_adapter_properties.address.ReplaceValue(initial_adapter_address); |
| 1493 initial_adapter_properties.discovering.ReplaceValue(true); | 1493 initial_adapter_properties.discovering.ReplaceValue(true); |
| 1494 | 1494 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 const dbus::ObjectPath adapter_path("/fake/hci0"); | 1548 const dbus::ObjectPath adapter_path("/fake/hci0"); |
| 1549 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; | 1549 const std::string adapter_address = "CA:FE:4A:C0:FE:FE"; |
| 1550 | 1550 |
| 1551 // Create the default adapter instance; | 1551 // Create the default adapter instance; |
| 1552 // BluetoothManagerClient::DefaultAdapter will be called once, passing | 1552 // BluetoothManagerClient::DefaultAdapter will be called once, passing |
| 1553 // a callback to obtain the adapter path. | 1553 // a callback to obtain the adapter path. |
| 1554 BluetoothManagerClient::AdapterCallback adapter_callback; | 1554 BluetoothManagerClient::AdapterCallback adapter_callback; |
| 1555 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) | 1555 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) |
| 1556 .WillOnce(SaveArg<0>(&adapter_callback)); | 1556 .WillOnce(SaveArg<0>(&adapter_callback)); |
| 1557 | 1557 |
| 1558 BluetoothAdapterFactory::RunCallbackOnAdapterReady( | 1558 BluetoothAdapterFactory::GetAdapter( |
| 1559 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, | 1559 base::Bind(&BluetoothAdapterChromeOsTest::SetAdapter, |
| 1560 base::Unretained(this))); | 1560 base::Unretained(this))); |
| 1561 | 1561 |
| 1562 // Call the adapter callback; | 1562 // Call the adapter callback; |
| 1563 // BluetoothAdapterClient::GetProperties will be called once to obtain | 1563 // BluetoothAdapterClient::GetProperties will be called once to obtain |
| 1564 // the property set. | 1564 // the property set. |
| 1565 MockBluetoothAdapterClient::Properties adapter_properties; | 1565 MockBluetoothAdapterClient::Properties adapter_properties; |
| 1566 adapter_properties.address.ReplaceValue(adapter_address); | 1566 adapter_properties.address.ReplaceValue(adapter_address); |
| 1567 adapter_properties.discovering.ReplaceValue(true); | 1567 adapter_properties.discovering.ReplaceValue(true); |
| 1568 | 1568 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1586 static_cast<BluetoothAdapterChromeOs*>(adapter_.get()); | 1586 static_cast<BluetoothAdapterChromeOs*>(adapter_.get()); |
| 1587 | 1587 |
| 1588 static_cast<BluetoothManagerClient::Observer*>(adapter_chromeos) | 1588 static_cast<BluetoothManagerClient::Observer*>(adapter_chromeos) |
| 1589 ->AdapterRemoved(adapter_path); | 1589 ->AdapterRemoved(adapter_path); |
| 1590 | 1590 |
| 1591 // Adapter should have the new property value. | 1591 // Adapter should have the new property value. |
| 1592 EXPECT_FALSE(adapter_->IsDiscovering()); | 1592 EXPECT_FALSE(adapter_->IsDiscovering()); |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 } // namespace chromeos | 1595 } // namespace chromeos |
| OLD | NEW |