[mock_ddk] Convert ssd1306 driver tests to mock_ddk

This is part of a set of changes to discontinue use of the fake_ddk.
New drivers are instead recommended to use the mock_ddk or depend on
//src/devices/testing/no_ddk to get the necessary functions linked in.

Testing: This is a change to test code.
Change-Id: I911daf8a9fa65b0adf99272db017c8a84a18a325
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/552027
Reviewed-by: Suraj Malhotra <surajmalhotra@google.com>
Commit-Queue: Garratt Gallagher <garratt@google.com>
diff --git a/src/graphics/display/drivers/ssd1306/BUILD.gn b/src/graphics/display/drivers/ssd1306/BUILD.gn
index 838e32c..0d6da13 100644
--- a/src/graphics/display/drivers/ssd1306/BUILD.gn
+++ b/src/graphics/display/drivers/ssd1306/BUILD.gn
@@ -68,7 +68,7 @@
     "//src/devices/i2c/lib/device-protocol-i2c-channel",
     "//src/devices/i2c/testing/fake-i2c",
     "//src/devices/lib/driver",
-    "//src/devices/testing/fake_ddk",
+    "//src/devices/testing/mock-ddk",
     "//src/lib/ddk",
     "//src/lib/ddktl",
     "//zircon/public/lib/sync",
diff --git a/src/graphics/display/drivers/ssd1306/test.cc b/src/graphics/display/drivers/ssd1306/test.cc
index c237f2e..3bd7dbf 100644
--- a/src/graphics/display/drivers/ssd1306/test.cc
+++ b/src/graphics/display/drivers/ssd1306/test.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include <lib/fake-i2c/fake-i2c.h>
-#include <lib/fake_ddk/fake_ddk.h>
 
 #include <zxtest/zxtest.h>
 
+#include "src/devices/testing/mock-ddk/mock-device.h"
 #include "src/graphics/display/drivers/ssd1306/ssd1306.h"
 
 namespace ssd1306 {
@@ -22,25 +22,18 @@
   }
 };
 
-class Ssd1306Test : public zxtest::Test {
-  void SetUp() override {}
-
-  void TearDown() override {}
-
- protected:
-  fake_ddk::Bind ddk_;
-};
-
-TEST_F(Ssd1306Test, LifetimeTest) {
+TEST(Ssd1306Test, LifetimeTest) {
   FakeI2cParent parent;
   ddk::I2cChannel i2c_channel = ddk::I2cChannel(parent.GetProto());
-  auto device = new Ssd1306(fake_ddk::kFakeParent);
+  auto fake_parent = MockDevice::FakeRootParent();
+  auto device = new Ssd1306(fake_parent.get());
 
   ASSERT_OK(device->Bind(i2c_channel));
+  device_async_remove(device->zxdev());
+  mock_ddk::ReleaseFlaggedDevices(fake_parent.get());
 
-  device->DdkAsyncRemove();
-  EXPECT_TRUE(ddk_.Ok());
-  device->DdkRelease();
+  // TODO(fxbug.dev/79639): Removed the obsolete fake_ddk.Ok() check.
+  // To test Unbind and Release behavior, call UnbindOp and ReleaseOp directly.
 }
 
 }  // namespace ssd1306