| 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> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | |
| 12 #include "chrome/browser/extensions/extension_system_factory.h" | |
| 13 #include "chrome/browser/extensions/test_extension_system.h" | 11 #include "chrome/browser/extensions/test_extension_system.h" |
| 14 #include "chrome/common/extensions/api/bluetooth.h" | |
| 15 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 16 #include "content/public/test/test_browser_thread.h" | 13 #include "content/public/test/test_browser_thread.h" |
| 17 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 18 #include "device/bluetooth/bluetooth_uuid.h" | 15 #include "device/bluetooth/bluetooth_uuid.h" |
| 19 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 16 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 20 #include "device/bluetooth/test/mock_bluetooth_device.h" | 17 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 18 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 21 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
| 22 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 21 #include "extensions/common/api/bluetooth.h" |
| 23 #include "extensions/common/extension_builder.h" | 22 #include "extensions/common/extension_builder.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| 29 const char kTestExtensionId[] = "test extension id"; | 28 const char kTestExtensionId[] = "test extension id"; |
| 30 const device::BluetoothUUID kAudioProfileUuid("1234"); | 29 const device::BluetoothUUID kAudioProfileUuid("1234"); |
| 31 const device::BluetoothUUID kHealthProfileUuid("4321"); | 30 const device::BluetoothUUID kHealthProfileUuid("4321"); |
| 32 | 31 |
| 33 } // namespace | 32 } // namespace |
| 34 | 33 |
| 35 namespace extensions { | 34 namespace extensions { |
| 36 | 35 |
| 37 namespace bluetooth = api::bluetooth; | 36 namespace bluetooth = core_api::bluetooth; |
| 38 | 37 |
| 39 class BluetoothEventRouterTest : public testing::Test { | 38 class BluetoothEventRouterTest : public testing::Test { |
| 40 public: | 39 public: |
| 41 BluetoothEventRouterTest() | 40 BluetoothEventRouterTest() |
| 42 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 41 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 43 mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()), | 42 mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()), |
| 44 test_profile_(new TestingProfile()), | 43 test_profile_(new TestingProfile()), |
| 45 router_(new BluetoothEventRouter(test_profile_.get())) { | 44 router_(new BluetoothEventRouter(test_profile_.get())) { |
| 46 router_->SetAdapterForTest(mock_adapter_); | 45 router_->SetAdapterForTest(mock_adapter_); |
| 47 } | 46 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 .SetID(kTestExtensionId) | 92 .SetID(kTestExtensionId) |
| 94 .Build(); | 93 .Build(); |
| 95 | 94 |
| 96 ExtensionRegistry::Get(test_profile_.get()) | 95 ExtensionRegistry::Get(test_profile_.get()) |
| 97 ->TriggerOnUnloaded(extension, UnloadedExtensionInfo::REASON_DISABLE); | 96 ->TriggerOnUnloaded(extension, UnloadedExtensionInfo::REASON_DISABLE); |
| 98 | 97 |
| 99 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); | 98 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); |
| 100 } | 99 } |
| 101 | 100 |
| 102 } // namespace extensions | 101 } // namespace extensions |
| OLD | NEW |