OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/bluetooth/frame_connected_bluetooth_devices.h" | 5 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" | 9 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" |
10 #include "content/test/test_render_view_host.h" | 10 #include "content/test/test_render_view_host.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void TearDown() override { | 87 void TearDown() override { |
88 map1_ = nullptr; | 88 map1_ = nullptr; |
89 service1_ = nullptr; | 89 service1_ = nullptr; |
90 map0_ = nullptr; | 90 map0_ = nullptr; |
91 service0_ = nullptr; | 91 service0_ = nullptr; |
92 RenderViewHostImplTestHarness::TearDown(); | 92 RenderViewHostImplTestHarness::TearDown(); |
93 } | 93 } |
94 | 94 |
95 std::unique_ptr<NiceMockBluetoothGattConnection> GetConnection( | 95 std::unique_ptr<NiceMockBluetoothGattConnection> GetConnection( |
96 const std::string& address) { | 96 const std::string& address) { |
97 return base::WrapUnique( | 97 return base::MakeUnique<NiceMockBluetoothGattConnection>(adapter_.get(), |
98 new NiceMockBluetoothGattConnection(adapter_.get(), address)); | 98 address); |
99 } | 99 } |
100 | 100 |
101 void ResetService0() { | 101 void ResetService0() { |
102 service0_->ClearState(); | 102 service0_->ClearState(); |
103 map0_ = nullptr; | 103 map0_ = nullptr; |
104 } | 104 } |
105 | 105 |
106 void ResetService1() { | 106 void ResetService1() { |
107 service1_->ClearState(); | 107 service1_->ClearState(); |
108 map1_ = nullptr; | 108 map1_ = nullptr; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 TEST_F(FrameConnectedBluetoothDevicesTest, | 385 TEST_F(FrameConnectedBluetoothDevicesTest, |
386 DestroyedByWebContentsImplDestruction) { | 386 DestroyedByWebContentsImplDestruction) { |
387 // Tests that we don't crash when FrameConnectedBluetoothDevices contains | 387 // Tests that we don't crash when FrameConnectedBluetoothDevices contains |
388 // at least one device, and it is destroyed while WebContentsImpl is being | 388 // at least one device, and it is destroyed while WebContentsImpl is being |
389 // destroyed. | 389 // destroyed. |
390 map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0)); | 390 map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0)); |
391 DeleteContents(); | 391 DeleteContents(); |
392 } | 392 } |
393 | 393 |
394 } // namespace content | 394 } // namespace content |
OLD | NEW |