Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: device/bluetooth/bluetooth_adapter_devices_chromeos_unittest.cc

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed RunCallbackOnAdapterReady to GetAdapter. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_device_client.h" 6 #include "chromeos/dbus/mock_bluetooth_device_client.h"
7 #include "chromeos/dbus/mock_bluetooth_manager_client.h" 7 #include "chromeos/dbus/mock_bluetooth_manager_client.h"
8 #include "chromeos/dbus/mock_dbus_thread_manager.h" 8 #include "chromeos/dbus/mock_dbus_thread_manager.h"
9 #include "dbus/object_path.h" 9 #include "dbus/object_path.h"
10 #include "device/bluetooth/bluetooth_adapter.h" 10 #include "device/bluetooth/bluetooth_adapter.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // a callback to obtain the adapter path. 45 // a callback to obtain the adapter path.
46 BluetoothManagerClient::AdapterCallback adapter_callback; 46 BluetoothManagerClient::AdapterCallback adapter_callback;
47 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_)) 47 EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
48 .WillOnce(SaveArg<0>(&adapter_callback)); 48 .WillOnce(SaveArg<0>(&adapter_callback));
49 49
50 EXPECT_CALL(*mock_manager_client_, AddObserver(_)) 50 EXPECT_CALL(*mock_manager_client_, AddObserver(_))
51 .Times(1); 51 .Times(1);
52 EXPECT_CALL(*mock_adapter_client_, AddObserver(_)) 52 EXPECT_CALL(*mock_adapter_client_, AddObserver(_))
53 .Times(1); 53 .Times(1);
54 54
55 BluetoothAdapterFactory::RunCallbackOnAdapterReady( 55 BluetoothAdapterFactory::GetAdapter(
56 base::Bind(&BluetoothAdapterDevicesChromeOsTest::SetAdapter, 56 base::Bind(&BluetoothAdapterDevicesChromeOsTest::SetAdapter,
57 base::Unretained(this))); 57 base::Unretained(this)));
58 ASSERT_TRUE(adapter_ != NULL); 58 ASSERT_TRUE(adapter_ != NULL);
59 59
60 // Call the adapter callback; 60 // Call the adapter callback;
61 // BluetoothAdapterClient::GetProperties will be called once to obtain 61 // BluetoothAdapterClient::GetProperties will be called once to obtain
62 // the property set. 62 // the property set.
63 MockBluetoothAdapterClient::Properties adapter_properties; 63 MockBluetoothAdapterClient::Properties adapter_properties;
64 adapter_properties.address.ReplaceValue(adapter_address_); 64 adapter_properties.address.ReplaceValue(adapter_address_);
65 adapter_properties.powered.ReplaceValue(true); 65 adapter_properties.powered.ReplaceValue(true);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 static_cast<BluetoothAdapterClient::Observer*>(adapter_chromeos) 166 static_cast<BluetoothAdapterClient::Observer*>(adapter_chromeos)
167 ->DeviceRemoved(adapter_path_, device_path); 167 ->DeviceRemoved(adapter_path_, device_path);
168 168
169 // Verify that the device is still visible, just no longer paired. 169 // Verify that the device is still visible, just no longer paired.
170 EXPECT_TRUE(device->IsVisible()); 170 EXPECT_TRUE(device->IsVisible());
171 EXPECT_FALSE(device->IsPaired()); 171 EXPECT_FALSE(device->IsPaired());
172 } 172 }
173 173
174 } // namespace chromeos 174 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698