| Index: device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| index 6b29dd241c0b53fe1354d14ff21489bc5fd279ef..678fc49409084f652727530e9ee9cfdfa627393c 100644
|
| --- a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| @@ -63,6 +63,9 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| ASSERT_TRUE(adapter_->IsInitialized());
|
| ASSERT_TRUE(adapter_->IsPresent());
|
|
|
| + adapter_ptr_factory_ = new base::WeakPtrFactory<BluetoothAdapterChromeOS>(
|
| + static_cast<BluetoothAdapterChromeOS*>(adapter_.get()));
|
| +
|
| // Turn on the adapter.
|
| adapter_->SetPowered(true, base::Bind(&base::DoNothing),
|
| base::Bind(&base::DoNothing));
|
| @@ -138,6 +141,7 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| protected:
|
| base::MessageLoop message_loop_;
|
|
|
| + base::WeakPtrFactory<BluetoothAdapterChromeOS>* adapter_ptr_factory_;
|
| scoped_refptr<BluetoothAdapter> adapter_;
|
|
|
| unsigned int success_callback_count_;
|
| @@ -151,7 +155,7 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
|
| options.require_authentication.reset(new bool(false));
|
|
|
| profile_ = BluetoothAdapterProfileChromeOS::Register(
|
| - static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options,
|
| + adapter_ptr_factory_->GetWeakPtr(), uuid, options,
|
| base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
|
|
|
| message_loop_.RunUntilIdle();
|
| @@ -185,7 +189,7 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
|
| options.require_authentication.reset(new bool(false));
|
|
|
| profile_ = BluetoothAdapterProfileChromeOS::Register(
|
| - static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options,
|
| + adapter_ptr_factory_->GetWeakPtr(), uuid, options,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
| @@ -224,7 +228,7 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
| options.require_authentication.reset(new bool(false));
|
|
|
| profile_ = BluetoothAdapterProfileChromeOS::Register(
|
| - static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options,
|
| + adapter_ptr_factory_->GetWeakPtr(), uuid, options,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
|
|