Chromium Code Reviews| 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); |
| + } |
| +} |