OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/wayland/wayland_test.h" | 5 #include "ui/ozone/platform/wayland/wayland_test.h" |
6 | 6 |
| 7 using ::testing::SaveArg; |
| 8 using ::testing::_; |
| 9 |
7 namespace ui { | 10 namespace ui { |
8 | 11 |
9 WaylandTest::WaylandTest() | 12 WaylandTest::WaylandTest() |
10 : window(&delegate, &display, gfx::Rect(0, 0, 800, 600)) {} | 13 : window(&delegate, &display, gfx::Rect(0, 0, 800, 600)) {} |
11 | 14 |
12 WaylandTest::~WaylandTest() {} | 15 WaylandTest::~WaylandTest() {} |
13 | 16 |
14 void WaylandTest::SetUp() { | 17 void WaylandTest::SetUp() { |
15 ASSERT_TRUE(server.Start()); | 18 ASSERT_TRUE(server.Start()); |
16 ASSERT_TRUE(display.Initialize()); | 19 ASSERT_TRUE(display.Initialize()); |
| 20 EXPECT_CALL(delegate, OnAcceleratedWidgetAvailable(_, _)) |
| 21 .WillOnce(SaveArg<0>(&widget)); |
17 ASSERT_TRUE(window.Initialize()); | 22 ASSERT_TRUE(window.Initialize()); |
| 23 ASSERT_NE(widget, gfx::kNullAcceleratedWidget); |
18 wl_display_roundtrip(display.display()); | 24 wl_display_roundtrip(display.display()); |
19 | 25 |
20 server.Pause(); | 26 server.Pause(); |
21 | 27 |
22 surface = server.GetObject<wl::MockSurface>(window.GetWidget()); | 28 surface = server.GetObject<wl::MockSurface>(widget); |
23 ASSERT_TRUE(surface); | 29 ASSERT_TRUE(surface); |
24 initialized = true; | 30 initialized = true; |
25 } | 31 } |
26 | 32 |
27 void WaylandTest::TearDown() { | 33 void WaylandTest::TearDown() { |
28 server.Resume(); | 34 server.Resume(); |
29 if (initialized) | 35 if (initialized) |
30 wl_display_roundtrip(display.display()); | 36 wl_display_roundtrip(display.display()); |
31 } | 37 } |
32 | 38 |
33 void WaylandTest::Sync() { | 39 void WaylandTest::Sync() { |
34 server.Resume(); | 40 server.Resume(); |
35 wl_display_roundtrip(display.display()); | 41 wl_display_roundtrip(display.display()); |
36 server.Pause(); | 42 server.Pause(); |
37 } | 43 } |
38 | 44 |
39 } // namespace ui | 45 } // namespace ui |
OLD | NEW |