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

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

Issue 112963005: Update uses of UTF conversions in courgette/, device/, extensions/, google_apis/, gpu/, ipc/, media… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
« no previous file with comments | « courgette/encoded_program.cc ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" 7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" 8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
9 #include "chromeos/dbus/fake_bluetooth_device_client.h" 9 #include "chromeos/dbus/fake_bluetooth_device_client.h"
10 #include "chromeos/dbus/fake_bluetooth_input_client.h" 10 #include "chromeos/dbus/fake_bluetooth_input_client.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 742
743 TEST_F(BluetoothChromeOSTest, DeviceProperties) { 743 TEST_F(BluetoothChromeOSTest, DeviceProperties) {
744 GetAdapter(); 744 GetAdapter();
745 745
746 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); 746 BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
747 ASSERT_EQ(1U, devices.size()); 747 ASSERT_EQ(1U, devices.size());
748 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, 748 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
749 devices[0]->GetAddress()); 749 devices[0]->GetAddress());
750 750
751 // Verify the other device properties. 751 // Verify the other device properties.
752 EXPECT_EQ(UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), 752 EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
753 devices[0]->GetName()); 753 devices[0]->GetName());
754 EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType()); 754 EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType());
755 EXPECT_TRUE(devices[0]->IsPaired()); 755 EXPECT_TRUE(devices[0]->IsPaired());
756 EXPECT_FALSE(devices[0]->IsConnected()); 756 EXPECT_FALSE(devices[0]->IsConnected());
757 EXPECT_FALSE(devices[0]->IsConnecting()); 757 EXPECT_FALSE(devices[0]->IsConnecting());
758 758
759 // Non HID devices are always connectable. 759 // Non HID devices are always connectable.
760 EXPECT_TRUE(devices[0]->IsConnectable()); 760 EXPECT_TRUE(devices[0]->IsConnectable());
761 761
762 BluetoothDevice::ServiceList uuids = devices[0]->GetServices(); 762 BluetoothDevice::ServiceList uuids = devices[0]->GetServices();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 798 }
799 799
800 TEST_F(BluetoothChromeOSTest, DeviceNameChanged) { 800 TEST_F(BluetoothChromeOSTest, DeviceNameChanged) {
801 // Simulate a change of name of a device. 801 // Simulate a change of name of a device.
802 GetAdapter(); 802 GetAdapter();
803 803
804 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); 804 BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
805 ASSERT_EQ(1U, devices.size()); 805 ASSERT_EQ(1U, devices.size());
806 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, 806 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
807 devices[0]->GetAddress()); 807 devices[0]->GetAddress());
808 ASSERT_EQ(UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), 808 ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
809 devices[0]->GetName()); 809 devices[0]->GetName());
810 810
811 // Install an observer; expect the DeviceChanged method to be called when 811 // Install an observer; expect the DeviceChanged method to be called when
812 // we change the alias of the device. 812 // we change the alias of the device.
813 TestObserver observer(adapter_); 813 TestObserver observer(adapter_);
814 adapter_->AddObserver(&observer); 814 adapter_->AddObserver(&observer);
815 815
816 FakeBluetoothDeviceClient::Properties* properties = 816 FakeBluetoothDeviceClient::Properties* properties =
817 fake_bluetooth_device_client_->GetProperties( 817 fake_bluetooth_device_client_->GetProperties(
818 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); 818 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
819 819
820 static const std::string new_name("New Device Name"); 820 static const std::string new_name("New Device Name");
821 properties->alias.ReplaceValue(new_name); 821 properties->alias.ReplaceValue(new_name);
822 822
823 EXPECT_EQ(1, observer.device_changed_count_); 823 EXPECT_EQ(1, observer.device_changed_count_);
824 EXPECT_EQ(devices[0], observer.last_device_); 824 EXPECT_EQ(devices[0], observer.last_device_);
825 825
826 EXPECT_EQ(UTF8ToUTF16(new_name), devices[0]->GetName()); 826 EXPECT_EQ(base::UTF8ToUTF16(new_name), devices[0]->GetName());
827 } 827 }
828 828
829 TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) { 829 TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
830 // Simulate a change of advertised services of a device. 830 // Simulate a change of advertised services of a device.
831 GetAdapter(); 831 GetAdapter();
832 832
833 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); 833 BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
834 ASSERT_EQ(1U, devices.size()); 834 ASSERT_EQ(1U, devices.size());
835 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, 835 ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
836 devices[0]->GetAddress()); 836 devices[0]->GetAddress());
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 EXPECT_FALSE(device->IsConnected()); 2024 EXPECT_FALSE(device->IsConnected());
2025 EXPECT_FALSE(device->IsConnecting()); 2025 EXPECT_FALSE(device->IsConnecting());
2026 EXPECT_FALSE(device->IsPaired()); 2026 EXPECT_FALSE(device->IsPaired());
2027 2027
2028 // Pairing dialog should be dismissed 2028 // Pairing dialog should be dismissed
2029 EXPECT_EQ(1, pairing_delegate.call_count_); 2029 EXPECT_EQ(1, pairing_delegate.call_count_);
2030 EXPECT_EQ(1, pairing_delegate.dismiss_count_); 2030 EXPECT_EQ(1, pairing_delegate.dismiss_count_);
2031 } 2031 }
2032 2032
2033 } // namespace chromeos 2033 } // namespace chromeos
OLDNEW
« no previous file with comments | « courgette/encoded_program.cc ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698