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

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc

Issue 1464443002: bluetooth: android: Add BluetoothDevice::ConnectErrorCode enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 #include <utility>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.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_api.h"
10 #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"
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, GattConnection) { 1140 IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, GattConnection) {
1141 ResultCatcher catcher; 1141 ResultCatcher catcher;
1142 catcher.RestrictToBrowserContext(browser()->profile()); 1142 catcher.RestrictToBrowserContext(browser()->profile());
1143 1143
1144 EXPECT_CALL(*mock_adapter_, GetDevice(_)) 1144 EXPECT_CALL(*mock_adapter_, GetDevice(_))
1145 .WillRepeatedly(Return(static_cast<BluetoothDevice*>(NULL))); 1145 .WillRepeatedly(Return(static_cast<BluetoothDevice*>(NULL)));
1146 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress0)) 1146 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress0))
1147 .WillRepeatedly(Return(device0_.get())); 1147 .WillRepeatedly(Return(device0_.get()));
1148 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress1)) 1148 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress1))
1149 .WillRepeatedly(Return(device1_.get())); 1149 .WillRepeatedly(Return(device1_.get()));
1150 EXPECT_CALL(*device0_, CreateGattConnection(_, _)) 1150 EXPECT_CALL(*device0_, CreateGattConnection(_, _))
scheib 2016/01/09 23:27:13 If the number of enums changes we need to update t
Kai Jiang 2016/01/10 08:47:16 Make sense. Addressed comment.
1151 .Times(9) 1151 .Times(16)
1152 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_FAILED)) 1152 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_FAILED))
1153 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_INPROGRESS)) 1153 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_INPROGRESS))
1154 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_FAILED)) 1154 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_FAILED))
1155 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_REJECTED)) 1155 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_REJECTED))
1156 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_CANCELED)) 1156 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_CANCELED))
1157 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_TIMEOUT)) 1157 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_TIMEOUT))
1158 .WillOnce( 1158 .WillOnce(
1159 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)) 1159 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE))
1160 .WillOnce(InvokeCallbackArgument<1>(
1161 BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID))
1162 .WillOnce(InvokeCallbackArgument<1>(
1163 BluetoothDevice::ERROR_CONNECTION_CONGESTED))
1164 .WillOnce(InvokeCallbackArgument<1>(
1165 BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION))
1166 .WillOnce(
1167 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_OFFSET_INVALID))
1168 .WillOnce(InvokeCallbackArgument<1>(
1169 BluetoothDevice::ERROR_READ_NOT_PERMITTED))
1170 .WillOnce(InvokeCallbackArgument<1>(
1171 BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED))
1172 .WillOnce(InvokeCallbackArgument<1>(
1173 BluetoothDevice::ERROR_WRITE_NOT_PERMITTED))
1160 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( 1174 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>(
1161 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, 1175 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0,
1162 true /* expect_disconnect */))) 1176 true /* expect_disconnect */)))
1163 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( 1177 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>(
1164 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, 1178 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0,
1165 false /* expect_disconnect */))); 1179 false /* expect_disconnect */)));
1166 EXPECT_CALL(*device1_, CreateGattConnection(_, _)) 1180 EXPECT_CALL(*device1_, CreateGattConnection(_, _))
1167 .Times(1) 1181 .Times(1)
1168 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( 1182 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>(
1169 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress1, 1183 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress1,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 EXPECT_TRUE(listener.WaitUntilSatisfied()); 1359 EXPECT_TRUE(listener.WaitUntilSatisfied());
1346 1360
1347 listener.Reply("go"); 1361 listener.Reply("go");
1348 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 1362 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
1349 1363
1350 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), 1364 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(),
1351 service0_.get()); 1365 service0_.get());
1352 } 1366 }
1353 1367
1354 } // namespace 1368 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698