Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: ui/gfx/mojo/struct_traits_unittest.cc

Issue 2071163002: Add StructTraits for AcceleratedWidget instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/mojo/accelerated_widget_struct_traits.h ('k') | ui/gfx/mojo/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/mojo/struct_traits_unittest.cc
diff --git a/ui/gfx/mojo/struct_traits_unittest.cc b/ui/gfx/mojo/struct_traits_unittest.cc
index bca2193c7f8e2dad39769aaaeef5309569e4ef6d..1ecbf86db73cdbc698b7de651124069cbe2032ed 100644
--- a/ui/gfx/mojo/struct_traits_unittest.cc
+++ b/ui/gfx/mojo/struct_traits_unittest.cc
@@ -6,6 +6,7 @@
#include "mojo/public/cpp/bindings/binding_set.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/mojo/traits_test_service.mojom.h"
+#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/selection_bound.h"
#include "ui/gfx/transform.h"
@@ -13,6 +14,14 @@ namespace gfx {
namespace {
+gfx::AcceleratedWidget castToAcceleratedWidget(int i) {
+#if defined(USE_OZONE) || defined(USE_X11)
+ return static_cast<gfx::AcceleratedWidget>(i);
+#else
+ return reinterpret_cast<gfx::AcceleratedWidget>(i);
+#endif
+}
+
class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
public:
StructTraitsTest() {}
@@ -34,6 +43,12 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
callback.Run(t);
}
+ void EchoAcceleratedWidget(
+ const AcceleratedWidget& t,
+ const EchoAcceleratedWidgetCallback& callback) override {
+ callback.Run(t);
+ }
+
base::MessageLoop loop_;
mojo::BindingSet<TraitsTestService> traits_test_bindings_;
@@ -104,4 +119,19 @@ TEST_F(StructTraitsTest, Transform) {
EXPECT_EQ(col4row4, output.matrix().get(3, 3));
}
+// AcceleratedWidgets can only be sent between processes on X11, Ozone, Win
+#if defined(OS_WIN) || defined(USE_OZONE) || defined(USE_X11)
+#define MAYBE_AcceleratedWidget AcceleratedWidget
+#else
+#define MAYBE_AcceleratedWidget DISABLED_AcceleratedWidget
+#endif
+
+TEST_F(StructTraitsTest, MAYBE_AcceleratedWidget) {
+ gfx::AcceleratedWidget input(castToAcceleratedWidget(1001));
+ mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+ gfx::AcceleratedWidget output;
+ proxy->EchoAcceleratedWidget(input, &output);
+ EXPECT_EQ(input, output);
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/mojo/accelerated_widget_struct_traits.h ('k') | ui/gfx/mojo/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698