| Index: chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| index 2d91e7e9b554ada62f30c3609bf50defac1680af..73ddd9a5f9a1a53eb7a22c27da466e86cba12c8b 100644
|
| --- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
|
| #include "chrome/browser/chromeos/bluetooth/test/mock_bluetooth_adapter.h"
|
| #include "chrome/browser/chromeos/bluetooth/test/mock_bluetooth_device.h"
|
| #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h"
|
| @@ -18,13 +19,6 @@ using extensions::Extension;
|
| namespace utils = extension_function_test_utils;
|
| namespace api = extensions::api;
|
|
|
| -namespace chromeos {
|
| -
|
| -class BluetoothAdapater;
|
| -
|
| -} // namespace chromeos
|
| -
|
| -
|
| namespace {
|
|
|
| class BluetoothApiTest : public PlatformAppApiTest {
|
| @@ -143,3 +137,33 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevicesWithServiceUUID) {
|
| ASSERT_TRUE(device->GetString("name", &name));
|
| EXPECT_EQ("d2", name);
|
| }
|
| +
|
| +IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Discovery) {
|
| + testing::NiceMock<chromeos::MockBluetoothDevice> device1(
|
| + mock_adapter_, "d1", "11:12:13:14:15:16");
|
| + testing::NiceMock<chromeos::MockBluetoothDevice> device2(
|
| + mock_adapter_, "d2", "21:22:23:24:25:26");
|
| + chromeos::BluetoothAdapter::DeviceList devices;
|
| + devices.push_back(&device1);
|
| + devices.push_back(&device2);
|
| +
|
| + scoped_refptr<api::BluetoothStartDiscoveryFunction> start_function;
|
| + start_function = setupFunction(new api::BluetoothStartDiscoveryFunction);
|
| + std::string error(
|
| + utils::RunFunctionAndReturnError(start_function, "[]", browser()));
|
| + ASSERT_TRUE(!error.empty());
|
| +
|
| + mock_adapter_->SetDiscoveringDevicesForTesting(devices);
|
| + start_function = setupFunction(new api::BluetoothStartDiscoveryFunction);
|
| + scoped_ptr<base::Value> result(
|
| + utils::RunFunctionAndReturnResult(start_function, "[]", browser()));
|
| +
|
| + // TODO(bryeung): test the events as well (crbug.com/132616)
|
| +
|
| + scoped_refptr<api::BluetoothStopDiscoveryFunction> stop_function;
|
| + stop_function = setupFunction(new api::BluetoothStopDiscoveryFunction);
|
| + result.reset(
|
| + utils::RunFunctionAndReturnResult(stop_function, "[]", browser()));
|
| +
|
| + // TODO(bryeung): test that no events are sent now (crbug.com/132616)
|
| +}
|
|
|