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 "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_test_message_listener.h" | 13 #include "chrome/browser/extensions/extension_test_message_listener.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/common/chrome_switches.h" | |
16 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
17 #include "device/bluetooth/bluetooth_adapter.h" | 16 #include "device/bluetooth/bluetooth_adapter.h" |
18 #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h" | 17 #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h" |
19 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 18 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
20 #include "device/bluetooth/test/mock_bluetooth_device.h" | 19 #include "device/bluetooth/test/mock_bluetooth_device.h" |
21 #include "device/bluetooth/test/mock_bluetooth_profile.h" | 20 #include "device/bluetooth/test/mock_bluetooth_profile.h" |
22 #include "device/bluetooth/test/mock_bluetooth_socket.h" | 21 #include "device/bluetooth/test/mock_bluetooth_socket.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
24 | 23 |
25 using device::BluetoothAdapter; | 24 using device::BluetoothAdapter; |
(...skipping 10 matching lines...) Expand all Loading... |
36 | 35 |
37 namespace { | 36 namespace { |
38 | 37 |
39 static const char* kAdapterAddress = "A1:A2:A3:A4:A5:A6"; | 38 static const char* kAdapterAddress = "A1:A2:A3:A4:A5:A6"; |
40 static const char* kName = "whatsinaname"; | 39 static const char* kName = "whatsinaname"; |
41 | 40 |
42 class BluetoothApiTest : public ExtensionApiTest { | 41 class BluetoothApiTest : public ExtensionApiTest { |
43 public: | 42 public: |
44 BluetoothApiTest() : empty_extension_(utils::CreateEmptyExtension()) {} | 43 BluetoothApiTest() : empty_extension_(utils::CreateEmptyExtension()) {} |
45 | 44 |
46 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
47 ExtensionApiTest::SetUpCommandLine(command_line); | |
48 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | |
49 } | |
50 | |
51 virtual void SetUpOnMainThread() OVERRIDE { | 45 virtual void SetUpOnMainThread() OVERRIDE { |
52 SetUpMockAdapter(); | 46 SetUpMockAdapter(); |
53 profile1_.reset(new testing::NiceMock<MockBluetoothProfile>()); | 47 profile1_.reset(new testing::NiceMock<MockBluetoothProfile>()); |
54 profile2_.reset(new testing::NiceMock<MockBluetoothProfile>()); | 48 profile2_.reset(new testing::NiceMock<MockBluetoothProfile>()); |
55 } | 49 } |
56 | 50 |
57 virtual void CleanUpOnMainThread() OVERRIDE { | 51 virtual void CleanUpOnMainThread() OVERRIDE { |
58 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); | 52 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); |
59 } | 53 } |
60 | 54 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 // Load and wait for setup | 570 // Load and wait for setup |
577 ExtensionTestMessageListener listener("ready", true); | 571 ExtensionTestMessageListener listener("ready", true); |
578 ASSERT_TRUE(LoadExtension( | 572 ASSERT_TRUE(LoadExtension( |
579 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); | 573 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); |
580 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 574 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
581 | 575 |
582 listener.Reply("go"); | 576 listener.Reply("go"); |
583 | 577 |
584 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 578 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
585 } | 579 } |
OLD | NEW |