| OLD | NEW |
| 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" | |
| 10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | |
| 11 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 12 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 15 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "device/bluetooth/bluetooth_adapter.h" | 15 #include "device/bluetooth/bluetooth_adapter.h" |
| 18 #include "device/bluetooth/bluetooth_uuid.h" | 16 #include "device/bluetooth/bluetooth_uuid.h" |
| 19 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 17 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 20 #include "device/bluetooth/test/mock_bluetooth_device.h" | 18 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 21 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" | 19 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
| 20 #include "extensions/browser/api/bluetooth/bluetooth_api.h" |
| 21 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 23 | 23 |
| 24 using device::BluetoothAdapter; | 24 using device::BluetoothAdapter; |
| 25 using device::BluetoothDevice; | 25 using device::BluetoothDevice; |
| 26 using device::BluetoothDiscoverySession; | 26 using device::BluetoothDiscoverySession; |
| 27 using device::BluetoothUUID; | 27 using device::BluetoothUUID; |
| 28 using device::MockBluetoothAdapter; | 28 using device::MockBluetoothAdapter; |
| 29 using device::MockBluetoothDevice; | 29 using device::MockBluetoothDevice; |
| 30 using device::MockBluetoothDiscoverySession; | 30 using device::MockBluetoothDiscoverySession; |
| 31 using extensions::Extension; | 31 using extensions::Extension; |
| 32 | 32 |
| 33 namespace utils = extension_function_test_utils; | 33 namespace utils = extension_function_test_utils; |
| 34 namespace api = extensions::api; | 34 namespace api = extensions::core_api; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 static const char* kAdapterAddress = "A1:A2:A3:A4:A5:A6"; | 38 static const char* kAdapterAddress = "A1:A2:A3:A4:A5:A6"; |
| 39 static const char* kName = "whatsinaname"; | 39 static const char* kName = "whatsinaname"; |
| 40 | 40 |
| 41 class BluetoothApiTest : public ExtensionApiTest { | 41 class BluetoothApiTest : public ExtensionApiTest { |
| 42 public: | 42 public: |
| 43 BluetoothApiTest() {} | 43 BluetoothApiTest() {} |
| 44 | 44 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Load and wait for setup | 450 // Load and wait for setup |
| 451 ExtensionTestMessageListener listener("ready", true); | 451 ExtensionTestMessageListener listener("ready", true); |
| 452 ASSERT_TRUE( | 452 ASSERT_TRUE( |
| 453 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); | 453 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); |
| 454 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 454 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 455 | 455 |
| 456 listener.Reply("go"); | 456 listener.Reply("go"); |
| 457 | 457 |
| 458 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 458 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 459 } | 459 } |
| OLD | NEW |