OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> |
6 | 7 |
7 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" | 9 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" |
9 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_event_router.h" | 10 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_event_router.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
12 #include "device/bluetooth/test/mock_bluetooth_device.h" | 13 #include "device/bluetooth/test/mock_bluetooth_device.h" |
13 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" | 14 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
14 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" | 15 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" |
15 #include "device/bluetooth/test/mock_bluetooth_gatt_descriptor.h" | 16 #include "device/bluetooth/test/mock_bluetooth_gatt_descriptor.h" |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 ExtensionTestMessageListener listener(true); | 1224 ExtensionTestMessageListener listener(true); |
1224 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( | 1225 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( |
1225 "bluetooth_low_energy/connect_in_progress"))); | 1226 "bluetooth_low_energy/connect_in_progress"))); |
1226 | 1227 |
1227 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 1228 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
1228 ASSERT_EQ("After 2nd connect fails due to 1st connect being in progress.", | 1229 ASSERT_EQ("After 2nd connect fails due to 1st connect being in progress.", |
1229 listener.message()) | 1230 listener.message()) |
1230 << listener.message(); | 1231 << listener.message(); |
1231 listener.Reset(); | 1232 listener.Reset(); |
1232 | 1233 |
1233 connect_callback.Run(conn_ptr.Pass()); | 1234 connect_callback.Run(std::move(conn_ptr)); |
1234 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 1235 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
1235 ASSERT_EQ("After 2nd call to disconnect.", listener.message()) | 1236 ASSERT_EQ("After 2nd call to disconnect.", listener.message()) |
1236 << listener.message(); | 1237 << listener.message(); |
1237 | 1238 |
1238 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1239 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
1239 } | 1240 } |
1240 | 1241 |
1241 IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, StartStopNotifications) { | 1242 IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, StartStopNotifications) { |
1242 ResultCatcher catcher; | 1243 ResultCatcher catcher; |
1243 catcher.RestrictToBrowserContext(browser()->profile()); | 1244 catcher.RestrictToBrowserContext(browser()->profile()); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 1345 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
1345 | 1346 |
1346 listener.Reply("go"); | 1347 listener.Reply("go"); |
1347 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1348 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
1348 | 1349 |
1349 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), | 1350 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), |
1350 service0_.get()); | 1351 service0_.get()); |
1351 } | 1352 } |
1352 | 1353 |
1353 } // namespace | 1354 } // namespace |
OLD | NEW |