[mock_ddk] Convert dsi-dw 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: Idd5f22efcb0f8b49eaff9466defebb577df9daaa
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/552025
Reviewed-by: Suraj Malhotra <surajmalhotra@google.com>
Commit-Queue: Garratt Gallagher <garratt@google.com>
diff --git a/src/graphics/display/drivers/dsi-dw/BUILD.gn b/src/graphics/display/drivers/dsi-dw/BUILD.gn
index 4b6d20bb..9b3b44e 100644
--- a/src/graphics/display/drivers/dsi-dw/BUILD.gn
+++ b/src/graphics/display/drivers/dsi-dw/BUILD.gn
@@ -71,7 +71,7 @@
sources = [ "dsi-dw-test.cc" ]
deps = [
":common_srcs",
- "//src/devices/testing/fake_ddk",
+ "//src/devices/testing/mock-ddk",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
diff --git a/src/graphics/display/drivers/dsi-dw/dsi-dw-test.cc b/src/graphics/display/drivers/dsi-dw/dsi-dw-test.cc
index 5407573..ccbaf78 100644
--- a/src/graphics/display/drivers/dsi-dw/dsi-dw-test.cc
+++ b/src/graphics/display/drivers/dsi-dw/dsi-dw-test.cc
@@ -4,25 +4,24 @@
#include "dsi-dw.h"
-#include <lib/fake_ddk/fake_ddk.h>
#include <zircon/types.h>
#include <memory>
#include <zxtest/zxtest.h>
+#include "src/devices/testing/mock-ddk/mock-device.h"
#include "zxtest/base/test.h"
namespace dsi_dw {
TEST(DsiDwTest, DdkLifeCycle) {
- fake_ddk::Bind ddk;
- auto dev = std::make_unique<DsiDw>(fake_ddk::kFakeParent);
+ std::shared_ptr<MockDevice> fake_parent = MockDevice::FakeRootParent();
+ auto dev = std::make_unique<DsiDw>(fake_parent.get());
EXPECT_OK(dev->DdkAdd("dw-dsi"));
- dev->DdkAsyncRemove();
- EXPECT_TRUE(ddk.Ok());
- dev->DdkRelease();
- __UNUSED auto ptr = dev.release();
+ dev.release();
+ // TODO(fxbug.dev/79639): Removed the obsolete fake_ddk.Ok() check.
+ // To test Unbind and Release behavior, call UnbindOp and ReleaseOp directly.
}
} // namespace dsi_dw