[display][ssd1306] Move ssd1306-test from Banjo to FIDL for I2C

Move ssd1306-test to FIDL so that fake-i2c can drop support for Banjo.

Bug: 98515
Multiply: ssd1306-test: 500
Change-Id: I486d69da8f685d9d174bc35785b7c275a68bbc0b
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/694445
Reviewed-by: Suraj Malhotra <surajmalhotra@google.com>
Commit-Queue: Braden Kell <bradenkell@google.com>
diff --git a/src/graphics/display/drivers/ssd1306/BUILD.gn b/src/graphics/display/drivers/ssd1306/BUILD.gn
index e701483..db3824b 100644
--- a/src/graphics/display/drivers/ssd1306/BUILD.gn
+++ b/src/graphics/display/drivers/ssd1306/BUILD.gn
@@ -24,7 +24,6 @@
   deps = [
     ":ssd1306-bind",
     "//sdk/banjo/fuchsia.hardware.dotmatrixdisplay:fuchsia.hardware.dotmatrixdisplay_banjo_cpp",
-    "//sdk/banjo/fuchsia.hardware.i2c:fuchsia.hardware.i2c_banjo_cpp",
     "//sdk/fidl/fuchsia.hardware.dotmatrixdisplay:fuchsia.hardware.dotmatrixdisplay_llcpp",
     "//src/devices/i2c/lib/device-protocol-i2c",
     "//src/devices/i2c/lib/device-protocol-i2c-channel",
@@ -62,7 +61,6 @@
   deps = [
     ":ssd1306-bind",
     "//sdk/banjo/fuchsia.hardware.dotmatrixdisplay:fuchsia.hardware.dotmatrixdisplay_banjo_cpp",
-    "//sdk/banjo/fuchsia.hardware.i2c:fuchsia.hardware.i2c_banjo_cpp",
     "//sdk/fidl/fuchsia.hardware.dotmatrixdisplay:fuchsia.hardware.dotmatrixdisplay_llcpp",
     "//src/devices/i2c/lib/device-protocol-i2c",
     "//src/devices/i2c/lib/device-protocol-i2c-channel",
@@ -71,6 +69,8 @@
     "//src/devices/testing/mock-ddk",
     "//src/lib/ddk",
     "//src/lib/ddktl",
+    "//zircon/system/ulib/async-loop:async-loop-cpp",
+    "//zircon/system/ulib/async-loop:async-loop-default",
     "//zircon/system/ulib/sync",
     "//zircon/system/ulib/zircon-internal",
     "//zircon/system/ulib/zxtest",
diff --git a/src/graphics/display/drivers/ssd1306/test.cc b/src/graphics/display/drivers/ssd1306/test.cc
index a14262b..05e57a6 100644
--- a/src/graphics/display/drivers/ssd1306/test.cc
+++ b/src/graphics/display/drivers/ssd1306/test.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <lib/async-loop/cpp/loop.h>
+#include <lib/async-loop/default.h>
 #include <lib/fake-i2c/fake-i2c.h>
 
 #include <zxtest/zxtest.h>
@@ -24,7 +26,16 @@
 
 TEST(Ssd1306Test, LifetimeTest) {
   FakeI2cParent parent;
-  ddk::I2cChannel i2c_channel = ddk::I2cChannel(parent.GetProto());
+  async::Loop loop(&kAsyncLoopConfigNeverAttachToThread);
+
+  auto endpoints = fidl::CreateEndpoints<fuchsia_hardware_i2c::Device>();
+  EXPECT_TRUE(endpoints.is_ok());
+
+  fidl::BindServer(loop.dispatcher(), std::move(endpoints->server), &parent);
+  EXPECT_OK(loop.StartThread());
+
+  ddk::I2cChannel i2c_channel = ddk::I2cChannel(std::move(endpoints->client));
+
   auto fake_parent = MockDevice::FakeRootParent();
   auto device = new Ssd1306(fake_parent.get());