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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_apitest.cc

Issue 735893002: Add GetConnectionInfo function for BluetoothDevice, replacing the existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile errors on other platforms Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string.h> 5 #include <string.h>
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 EXPECT_CALL(*device1_.get(), GetDeviceType()) 420 EXPECT_CALL(*device1_.get(), GetDeviceType())
421 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER)); 421 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER));
422 EXPECT_CALL(*device1_.get(), GetVendorIDSource()) 422 EXPECT_CALL(*device1_.get(), GetVendorIDSource())
423 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH)); 423 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH));
424 EXPECT_CALL(*device1_.get(), GetVendorID()) 424 EXPECT_CALL(*device1_.get(), GetVendorID())
425 .WillRepeatedly(testing::Return(0x00E0)); 425 .WillRepeatedly(testing::Return(0x00E0));
426 EXPECT_CALL(*device1_.get(), GetProductID()) 426 EXPECT_CALL(*device1_.get(), GetProductID())
427 .WillRepeatedly(testing::Return(0x240A)); 427 .WillRepeatedly(testing::Return(0x240A));
428 EXPECT_CALL(*device1_.get(), GetDeviceID()) 428 EXPECT_CALL(*device1_.get(), GetDeviceID())
429 .WillRepeatedly(testing::Return(0x0400)); 429 .WillRepeatedly(testing::Return(0x0400));
430 EXPECT_CALL(*device1_, GetRSSI()).WillRepeatedly(testing::Return(-42));
431 EXPECT_CALL(*device1_, GetCurrentHostTransmitPower())
432 .WillRepeatedly(testing::Return(-16));
433 EXPECT_CALL(*device1_, GetMaximumHostTransmitPower())
434 .WillRepeatedly(testing::Return(10));
435 430
436 BluetoothDevice::UUIDList uuids; 431 BluetoothDevice::UUIDList uuids;
437 uuids.push_back(BluetoothUUID("1105")); 432 uuids.push_back(BluetoothUUID("1105"));
438 uuids.push_back(BluetoothUUID("1106")); 433 uuids.push_back(BluetoothUUID("1106"));
439 434
440 EXPECT_CALL(*device1_.get(), GetUUIDs()) 435 EXPECT_CALL(*device1_.get(), GetUUIDs())
441 .WillOnce(testing::Return(uuids)); 436 .WillOnce(testing::Return(uuids));
442 437
443 devices.push_back(device1_.get()); 438 devices.push_back(device1_.get());
444 439
445 // Leave the second largely empty so we can check a device without 440 // Leave the second largely empty so we can check a device without
446 // available information. 441 // available information.
447 devices.push_back(device2_.get()); 442 devices.push_back(device2_.get());
448 443
449 EXPECT_CALL(*mock_adapter_, GetDevices()) 444 EXPECT_CALL(*mock_adapter_, GetDevices())
450 .Times(1) 445 .Times(1)
451 .WillRepeatedly(testing::Return(devices)); 446 .WillRepeatedly(testing::Return(devices));
452 447
453 // Load and wait for setup 448 // Load and wait for setup
454 ExtensionTestMessageListener listener("ready", true); 449 ExtensionTestMessageListener listener("ready", true);
455 ASSERT_TRUE( 450 ASSERT_TRUE(
456 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); 451 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info")));
457 EXPECT_TRUE(listener.WaitUntilSatisfied()); 452 EXPECT_TRUE(listener.WaitUntilSatisfied());
458 453
459 listener.Reply("go"); 454 listener.Reply("go");
460 455
461 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 456 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
462 } 457 }
OLDNEW
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_api_utils.cc ('k') | extensions/common/api/bluetooth.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698