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

Unified Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller_unittest.cc

Issue 2351083003: Update BluetoothChooserControllerTest to test IsConnected() and IsPaired() (Closed)
Patch Set: address comments Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..98f1134f0fc41a5daadaea92f29ebd4e0feb7a52 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);
@@ -243,6 +245,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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698