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

Unified Diff: content/browser/bluetooth/bluetooth_device_chooser_controller_unittest.cc

Issue 2245603003: Add signal strength indicator icon to WebBluetooth chooser on non-Mac desktops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 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: content/browser/bluetooth/bluetooth_device_chooser_controller_unittest.cc
diff --git a/content/browser/bluetooth/bluetooth_device_chooser_controller_unittest.cc b/content/browser/bluetooth/bluetooth_device_chooser_controller_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f57d3d8d86fcb86f4f2a461ac47ffd87383be3ab
--- /dev/null
+++ b/content/browser/bluetooth/bluetooth_device_chooser_controller_unittest.cc
@@ -0,0 +1,30 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <limits>
+
+#include "base/macros.h"
+#include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class BluetoothDeviceChooserControllerTest : public testing::Test {
+ public:
Jeffrey Yasskin 2016/08/20 00:03:29 You should omit all of the contents of this class.
juncai 2016/08/20 01:17:02 Done.
+ BluetoothDeviceChooserControllerTest() {}
+ ~BluetoothDeviceChooserControllerTest() override = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChooserControllerTest);
+};
+
+TEST_F(BluetoothDeviceChooserControllerTest, CalculateSignalStrengthLevel) {
+ int low = std::numeric_limits<int8_t>::min();
+ int high = std::numeric_limits<int8_t>::max();
+ for (int rssi = low; rssi <= high; ++rssi) {
Jeffrey Yasskin 2016/08/20 00:03:29 Instead of the exhaustive test, check some concret
juncai 2016/08/20 01:17:02 Done.
+ int level =
+ content::BluetoothDeviceChooserController::CalculateSignalStrengthLevel(
+ static_cast<int8_t>(rssi));
+ EXPECT_LE(0, level);
+ EXPECT_GE(4, level);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698