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 |