| Index: content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc
 | 
| diff --git a/content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc b/content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc
 | 
| index 21ddd44083dede3ef1c1b4087e534d7d3e474c0b..40d56ac47dd72911d41bddfb6678a12263d8300b 100644
 | 
| --- a/content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc
 | 
| +++ b/content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc
 | 
| @@ -13,6 +13,7 @@
 | 
|  #include "device/bluetooth/test/mock_bluetooth_adapter.h"
 | 
|  #include "device/bluetooth/test/mock_bluetooth_device.h"
 | 
|  #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h"
 | 
| +#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
 | 
|  #include "testing/gmock/include/gmock/gmock.h"
 | 
|  #include "testing/gtest/include/gtest/gtest.h"
 | 
|  
 | 
| @@ -38,6 +39,13 @@ const WebBluetoothDeviceId kDeviceId1("111111111111111111111A==");
 | 
|  constexpr char kDeviceAddress1[] = "1";
 | 
|  constexpr char kDeviceName1[] = "Device1";
 | 
|  
 | 
| +blink::mojom::WebBluetoothServerClientAssociatedPtr
 | 
| +CreateWebBluetoothServerClientAssociatedPtr() {
 | 
| +  blink::mojom::WebBluetoothServerClientAssociatedPtr client;
 | 
| +  mojo::GetIsolatedProxy(&client);
 | 
| +  return client;
 | 
| +}
 | 
| +
 | 
|  }  // namespace
 | 
|  
 | 
|  class FrameConnectedBluetoothDevicesTest
 | 
| @@ -122,23 +130,28 @@ class FrameConnectedBluetoothDevicesTest
 | 
|  };
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Insert_Once) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Insert_Twice) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Insert_TwoDevices) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -146,8 +159,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest, Insert_TwoDevices) {
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Insert_TwoMaps) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -156,7 +171,8 @@ TEST_F(FrameConnectedBluetoothDevicesTest, Insert_TwoMaps) {
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionId_OneDevice_AddOnce_RemoveOnce) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -169,7 +185,8 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionId_OneDevice_AddOnce_RemoveTwice) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -183,8 +200,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionId_OneDevice_AddTwice_RemoveOnce) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -197,8 +216,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionId_OneDevice_AddTwice_RemoveTwice) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -211,8 +232,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionId_TwoDevices) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -230,8 +253,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionId_TwoDevices) {
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionId_TwoMaps) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -250,7 +275,8 @@ TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionId_TwoMaps) {
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionAddress_OneDevice_AddOnce_RemoveOnce) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -264,7 +290,8 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionAddress_OneDevice_AddOnce_RemoveTwice) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -279,8 +306,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionAddress_OneDevice_AddTwice_RemoveOnce) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -294,8 +323,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|         CloseConnectionAddress_OneDevice_AddTwice_RemoveTwice) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -309,8 +340,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionAddress_TwoDevices) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -331,8 +364,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionAddress_TwoDevices) {
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionAddress_TwoMaps) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|    EXPECT_TRUE(map0_->IsConnectedToDeviceWithId(kDeviceId0));
 | 
| @@ -353,8 +388,10 @@ TEST_F(FrameConnectedBluetoothDevicesTest, CloseConnectionAddress_TwoMaps) {
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Destruction_MultipleDevices) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|  
 | 
| @@ -364,11 +401,15 @@ TEST_F(FrameConnectedBluetoothDevicesTest, Destruction_MultipleDevices) {
 | 
|  }
 | 
|  
 | 
|  TEST_F(FrameConnectedBluetoothDevicesTest, Destruction_MultipleMaps) {
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client1 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client1));
 | 
| +  auto client2 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client2));
 | 
|  
 | 
| -  map1_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| -  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1));
 | 
| +  auto client3 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map1_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client3));
 | 
| +  auto client4 = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map1_->Insert(kDeviceId1, GetConnection(kDeviceAddress1), std::move(client4));
 | 
|  
 | 
|    EXPECT_TRUE(contents()->IsConnectedToBluetoothDevice());
 | 
|  
 | 
| @@ -387,7 +428,8 @@ TEST_F(FrameConnectedBluetoothDevicesTest,
 | 
|    // Tests that we don't crash when FrameConnectedBluetoothDevices contains
 | 
|    // at least one device, and it is destroyed while WebContentsImpl is being
 | 
|    // destroyed.
 | 
| -  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0));
 | 
| +  auto client = CreateWebBluetoothServerClientAssociatedPtr();
 | 
| +  map0_->Insert(kDeviceId0, GetConnection(kDeviceAddress0), std::move(client));
 | 
|    DeleteContents();
 | 
|  }
 | 
|  
 | 
| 
 |