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

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

Issue 246603008: Expose device RSSI and Tx power via the chrome.bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forward-declare more APIs introduced in Lion Created 6 years, 7 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 | Annotate | Revision Log
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/api/bluetooth/bluetooth_api.h" 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" 10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 EXPECT_CALL(*device1_.get(), GetDeviceType()) 648 EXPECT_CALL(*device1_.get(), GetDeviceType())
649 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER)); 649 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER));
650 EXPECT_CALL(*device1_.get(), GetVendorIDSource()) 650 EXPECT_CALL(*device1_.get(), GetVendorIDSource())
651 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH)); 651 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH));
652 EXPECT_CALL(*device1_.get(), GetVendorID()) 652 EXPECT_CALL(*device1_.get(), GetVendorID())
653 .WillRepeatedly(testing::Return(0x00E0)); 653 .WillRepeatedly(testing::Return(0x00E0));
654 EXPECT_CALL(*device1_.get(), GetProductID()) 654 EXPECT_CALL(*device1_.get(), GetProductID())
655 .WillRepeatedly(testing::Return(0x240A)); 655 .WillRepeatedly(testing::Return(0x240A));
656 EXPECT_CALL(*device1_.get(), GetDeviceID()) 656 EXPECT_CALL(*device1_.get(), GetDeviceID())
657 .WillRepeatedly(testing::Return(0x0400)); 657 .WillRepeatedly(testing::Return(0x0400));
658 EXPECT_CALL(*device1_, GetRSSI()).WillRepeatedly(testing::Return(-42));
659 EXPECT_CALL(*device1_, GetCurrentHostTransmitPower())
660 .WillRepeatedly(testing::Return(-16));
661 EXPECT_CALL(*device1_, GetMaximumHostTransmitPower())
662 .WillRepeatedly(testing::Return(10));
658 663
659 BluetoothDevice::UUIDList uuids; 664 BluetoothDevice::UUIDList uuids;
660 uuids.push_back(BluetoothUUID("1105")); 665 uuids.push_back(BluetoothUUID("1105"));
661 uuids.push_back(BluetoothUUID("1106")); 666 uuids.push_back(BluetoothUUID("1106"));
662 667
663 EXPECT_CALL(*device1_.get(), GetUUIDs()) 668 EXPECT_CALL(*device1_.get(), GetUUIDs())
664 .WillOnce(testing::Return(uuids)); 669 .WillOnce(testing::Return(uuids));
665 670
666 devices.push_back(device1_.get()); 671 devices.push_back(device1_.get());
667 672
668 // Leave the second largely empty so we can check a device without 673 // Leave the second largely empty so we can check a device without
669 // available information. 674 // available information.
670 devices.push_back(device2_.get()); 675 devices.push_back(device2_.get());
671 676
672 EXPECT_CALL(*mock_adapter_, GetDevices()) 677 EXPECT_CALL(*mock_adapter_, GetDevices())
673 .Times(1) 678 .Times(1)
674 .WillRepeatedly(testing::Return(devices)); 679 .WillRepeatedly(testing::Return(devices));
675 680
676 // Load and wait for setup 681 // Load and wait for setup
677 ExtensionTestMessageListener listener("ready", true); 682 ExtensionTestMessageListener listener("ready", true);
678 ASSERT_TRUE( 683 ASSERT_TRUE(
679 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); 684 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info")));
680 EXPECT_TRUE(listener.WaitUntilSatisfied()); 685 EXPECT_TRUE(listener.WaitUntilSatisfied());
681 686
682 listener.Reply("go"); 687 listener.Reply("go");
683 688
684 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 689 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
685 } 690 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc ('k') | chrome/common/extensions/api/bluetooth.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698