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

Unified Diff: chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus_unittest.cc

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing styles and tess. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus_unittest.cc
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_adapter_unittest.cc b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus_unittest.cc
similarity index 88%
rename from chrome/browser/chromeos/bluetooth/bluetooth_adapter_unittest.cc
rename to chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus_unittest.cc
index 8b3f1b4e2361ab3ac292da97687209103ad25227..5f23991ec38dd6cffcbd2bfa4460dbf5c0857169 100644
--- a/chrome/browser/chromeos/bluetooth/bluetooth_adapter_unittest.cc
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus_unittest.cc
@@ -5,6 +5,7 @@
#include <iostream>
#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h"
#include "chrome/browser/chromeos/bluetooth/test/mock_bluetooth_adapter.h"
#include "chromeos/dbus/mock_bluetooth_adapter_client.h"
#include "chromeos/dbus/mock_bluetooth_manager_client.h"
@@ -50,7 +51,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterNotPresent) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback; make out it failed.
// BluetoothAdapter::Observer::AdapterPresentChanged must not be called.
@@ -77,7 +79,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterWithAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -114,7 +117,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterWithoutAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -144,7 +148,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterWithoutAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), true))
.Times(1);
- static_cast<BluetoothAdapterClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothAdapterClient::Observer*>(adapter_dbus)
->AdapterPropertyChanged(adapter_path,
adapter_properties.address.name());
keybuk 2012/09/13 23:57:30 Why does this now need to be double-cast?
youngki 2012/09/17 21:53:02 Because BluetoothAdapterClient::Observer is implem
@@ -164,7 +171,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterBecomesPresentWithAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback; make out it failed.
adapter_callback.Run(dbus::ObjectPath(""), false);
@@ -185,7 +193,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterBecomesPresentWithAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), true))
.Times(1);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->DefaultAdapterChanged(adapter_path);
// Adapter should be present with the new address.
@@ -206,7 +217,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterReplacedWithAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -239,7 +251,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterReplacedWithAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), true))
.Times(1);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->DefaultAdapterChanged(new_adapter_path);
// Adapter should be present with the new address.
@@ -258,7 +273,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterBecomesPresentWithoutAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback; make out it failed.
adapter_callback.Run(dbus::ObjectPath(""), false);
@@ -278,7 +294,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterBecomesPresentWithoutAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), _))
.Times(0);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->DefaultAdapterChanged(adapter_path);
// Adapter should not be present yet.
@@ -291,7 +310,7 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterBecomesPresentWithoutAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), true))
.Times(1);
- static_cast<BluetoothAdapterClient::Observer*>(adapter.get())
+ static_cast<BluetoothAdapterClient::Observer*>(adapter_dbus)
->AdapterPropertyChanged(adapter_path,
adapter_properties.address.name());
@@ -313,7 +332,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterReplacedWithoutAddress) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -342,7 +362,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterReplacedWithoutAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), false))
.Times(1);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->DefaultAdapterChanged(new_adapter_path);
// Adapter should be now marked not present.
@@ -355,7 +378,7 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterReplacedWithoutAddress) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), true))
.Times(1);
- static_cast<BluetoothAdapterClient::Observer*>(adapter.get())
+ static_cast<BluetoothAdapterClient::Observer*>(adapter_dbus)
->AdapterPropertyChanged(new_adapter_path,
new_adapter_properties.address.name());
@@ -375,7 +398,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterRemoved) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -397,7 +421,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterRemoved) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), false))
.Times(1);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->AdapterRemoved(adapter_path);
// Adapter should be no longer present.
@@ -414,7 +441,8 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterWithoutAddressRemoved) {
EXPECT_CALL(*mock_manager_client_, DefaultAdapter(_))
.WillOnce(SaveArg<0>(&adapter_callback));
- scoped_refptr<BluetoothAdapter> adapter = BluetoothAdapter::DefaultAdapter();
+ scoped_refptr<BluetoothAdapter> adapter =
+ BluetoothAdapterDBus::DefaultAdapter();
// Call the adapter callback;
// BluetoothAdapterClient::GetProperties will be called once to obtain
@@ -435,7 +463,10 @@ TEST_F(BluetoothAdapterTest, DefaultAdapterWithoutAddressRemoved) {
EXPECT_CALL(adapter_observer, AdapterPresentChanged(adapter.get(), _))
.Times(0);
- static_cast<BluetoothManagerClient::Observer*>(adapter.get())
+ BluetoothAdapterDBus* adapter_dbus =
+ static_cast<BluetoothAdapterDBus*>(adapter.get());
+
+ static_cast<BluetoothManagerClient::Observer*>(adapter_dbus)
->AdapterRemoved(adapter_path);
// Adapter should be still no longer present.

Powered by Google App Engine
This is Rietveld 408576698