| 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 "extensions/browser/api/bluetooth/bluetooth_event_router.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 13 #include "content/public/test/test_browser_context.h" | 14 #include "content/public/test/test_browser_context.h" |
| 14 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 15 #include "device/bluetooth/bluetooth_common.h" | 16 #include "device/bluetooth/bluetooth_common.h" |
| 16 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
| 17 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 18 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 19 #include "extensions/browser/extensions_test.h" | 20 #include "extensions/browser/extensions_test.h" |
| 20 #include "extensions/common/api/bluetooth.h" | 21 #include "extensions/common/api/bluetooth.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 } | 34 } |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 namespace extensions { | 37 namespace extensions { |
| 37 | 38 |
| 38 namespace bluetooth = api::bluetooth; | 39 namespace bluetooth = api::bluetooth; |
| 39 | 40 |
| 40 class BluetoothEventRouterTest : public ExtensionsTest { | 41 class BluetoothEventRouterTest : public ExtensionsTest { |
| 41 public: | 42 public: |
| 42 BluetoothEventRouterTest() | 43 BluetoothEventRouterTest() |
| 43 : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()), | 44 : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()) { |
| 44 router_(new BluetoothEventRouter(browser_context())) { | 45 } |
| 46 |
| 47 void SetUp() override { |
| 48 ExtensionsTest::SetUp(); |
| 49 router_ = base::MakeUnique<BluetoothEventRouter>(browser_context()); |
| 45 router_->SetAdapterForTest(mock_adapter_); | 50 router_->SetAdapterForTest(mock_adapter_); |
| 46 } | 51 } |
| 47 | 52 |
| 48 void TearDown() override { | 53 void TearDown() override { |
| 49 // It's important to destroy the router before the browser context keyed | 54 // It's important to destroy the router before the browser context keyed |
| 50 // services so it removes itself as an ExtensionRegistry observer. | 55 // services so it removes itself as an ExtensionRegistry observer. |
| 51 router_.reset(NULL); | 56 router_.reset(NULL); |
| 52 ExtensionsTest::TearDown(); | 57 ExtensionsTest::TearDown(); |
| 53 } | 58 } |
| 54 | 59 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 testing::_, testing::_)).Times(1); | 117 testing::_, testing::_)).Times(1); |
| 113 | 118 |
| 114 router_->StartDiscoverySession(mock_adapter_, kTestExtensionId, | 119 router_->StartDiscoverySession(mock_adapter_, kTestExtensionId, |
| 115 base::Bind(&base::DoNothing), | 120 base::Bind(&base::DoNothing), |
| 116 base::Bind(&base::DoNothing)); | 121 base::Bind(&base::DoNothing)); |
| 117 | 122 |
| 118 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); | 123 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); |
| 119 } | 124 } |
| 120 | 125 |
| 121 } // namespace extensions | 126 } // namespace extensions |
| OLD | NEW |