Chromium Code Reviews| Index: chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc |
| diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc |
| index 6f5c7193a27e2e71ae107813a1149cbbe0ab0f07..a6d2dfd3e344f66f33e04d20474a17b7b41f6757 100644 |
| --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc |
| +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc |
| @@ -88,6 +88,8 @@ TEST_F(BluetoothChooserControllerTest, AddDevice) { |
| EXPECT_EQ(base::ASCIIToUTF16("a"), |
| bluetooth_chooser_controller_.GetOption(0)); |
| EXPECT_EQ(-1, bluetooth_chooser_controller_.GetSignalStrengthLevel(0)); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsConnected(0)); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsPaired(0)); |
| testing::Mock::VerifyAndClearExpectations(&mock_bluetooth_chooser_view_); |
| EXPECT_CALL(mock_bluetooth_chooser_view_, OnOptionAdded(1)).Times(1); |
| @@ -99,6 +101,8 @@ TEST_F(BluetoothChooserControllerTest, AddDevice) { |
| EXPECT_EQ(base::ASCIIToUTF16("b"), |
| bluetooth_chooser_controller_.GetOption(1)); |
| EXPECT_EQ(0, bluetooth_chooser_controller_.GetSignalStrengthLevel(1)); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsConnected(1)); |
|
Jeffrey Yasskin
2016/09/21 00:39:25
Only the first two EXPECT_TRUE(bluetooth_chooser_c
juncai
2016/09/21 17:43:15
Done.
|
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsPaired(1)); |
| testing::Mock::VerifyAndClearExpectations(&mock_bluetooth_chooser_view_); |
| EXPECT_CALL(mock_bluetooth_chooser_view_, OnOptionAdded(2)).Times(1); |
| @@ -110,6 +114,8 @@ TEST_F(BluetoothChooserControllerTest, AddDevice) { |
| EXPECT_EQ(base::ASCIIToUTF16("c"), |
| bluetooth_chooser_controller_.GetOption(2)); |
| EXPECT_EQ(1, bluetooth_chooser_controller_.GetSignalStrengthLevel(2)); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsConnected(2)); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsPaired(2)); |
| } |
| TEST_F(BluetoothChooserControllerTest, RemoveDevice) { |
| @@ -243,6 +249,36 @@ TEST_F(BluetoothChooserControllerTest, UpdateDeviceSignalStrengthLevel) { |
| EXPECT_EQ(1, bluetooth_chooser_controller_.GetSignalStrengthLevel(0)); |
| } |
| +TEST_F(BluetoothChooserControllerTest, UpdateConnectedStatus) { |
| + bluetooth_chooser_controller_.AddOrUpdateDevice( |
| + "id_a", false /* should_update_name */, base::ASCIIToUTF16("a"), |
| + false /* is_gatt_connected */, false /* is_paired */, |
| + 1 /* signal_strength_level */); |
| + EXPECT_FALSE(bluetooth_chooser_controller_.IsConnected(0)); |
| + |
| + EXPECT_CALL(mock_bluetooth_chooser_view_, OnOptionUpdated(0)).Times(1); |
| + bluetooth_chooser_controller_.AddOrUpdateDevice( |
| + "id_a", false /* should_update_name */, base::ASCIIToUTF16("a"), |
| + true /* is_gatt_connected */, false /* is_paired */, |
| + -1 /* signal_strength_level */); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsConnected(0)); |
| +} |
| + |
| +TEST_F(BluetoothChooserControllerTest, UpdatePairedStatus) { |
| + bluetooth_chooser_controller_.AddOrUpdateDevice( |
| + "id_a", false /* should_update_name */, base::ASCIIToUTF16("a"), |
| + true /* is_gatt_connected */, false /* is_paired */, |
| + -1 /* signal_strength_level */); |
| + EXPECT_FALSE(bluetooth_chooser_controller_.IsPaired(0)); |
| + |
| + EXPECT_CALL(mock_bluetooth_chooser_view_, OnOptionUpdated(0)).Times(1); |
| + bluetooth_chooser_controller_.AddOrUpdateDevice( |
| + "id_a", false /* should_update_name */, base::ASCIIToUTF16("a"), |
| + true /* is_gatt_connected */, true /* is_paired */, |
| + -1 /* signal_strength_level */); |
| + EXPECT_TRUE(bluetooth_chooser_controller_.IsPaired(0)); |
| +} |
| + |
| TEST_F(BluetoothChooserControllerWithDevicesAddedTest, |
| InitialNoOptionsTextAndStatusText) { |
| EXPECT_EQ(l10n_util::GetStringUTF16( |