| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "components/exo/buffer.h" | 8 #include "components/exo/buffer.h" |
| 9 #include "components/exo/gamepad.h" | 9 #include "components/exo/gamepad.h" |
| 10 #include "components/exo/gamepad_delegate.h" | 10 #include "components/exo/gamepad_delegate.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 axis_moved.items[0].timestamp = 1; | 138 axis_moved.items[0].timestamp = 1; |
| 139 axis_moved.items[0].axesLength = 1; | 139 axis_moved.items[0].axesLength = 1; |
| 140 axis_moved.items[0].axes[0] = 1.0; | 140 axis_moved.items[0].axes[0] = 1.0; |
| 141 | 141 |
| 142 EXPECT_CALL(delegate, OnStateChange(true)).Times(1); | 142 EXPECT_CALL(delegate, OnStateChange(true)).Times(1); |
| 143 EXPECT_CALL(delegate, OnAxis(0, 1.0)).Times(1); | 143 EXPECT_CALL(delegate, OnAxis(0, 1.0)).Times(1); |
| 144 EXPECT_CALL(delegate, OnFrame()).Times(1); | 144 EXPECT_CALL(delegate, OnFrame()).Times(1); |
| 145 SetDataAndPostToDelegate(axis_moved); | 145 SetDataAndPostToDelegate(axis_moved); |
| 146 | 146 |
| 147 DestroyGamepad(&delegate); | 147 DestroyGamepad(&delegate); |
| 148 usleep(100000); |
| 149 base::MessageLoop::current()->RunUntilIdle(); |
| 150 usleep(100000); |
| 151 base::MessageLoop::current()->RunUntilIdle(); |
| 152 usleep(100000); |
| 153 base::MessageLoop::current()->RunUntilIdle(); |
| 148 } | 154 } |
| 149 | 155 |
| 150 TEST_F(GamepadTest, OnButton) { | 156 TEST_F(GamepadTest, OnButton) { |
| 151 std::unique_ptr<Surface> surface(new Surface); | 157 std::unique_ptr<Surface> surface(new Surface); |
| 152 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 158 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 153 gfx::Size buffer_size(10, 10); | 159 gfx::Size buffer_size(10, 10); |
| 154 std::unique_ptr<Buffer> buffer( | 160 std::unique_ptr<Buffer> buffer( |
| 155 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 161 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 156 surface->Attach(buffer.get()); | 162 surface->Attach(buffer.get()); |
| 157 surface->Commit(); | 163 surface->Commit(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // scheduled in the next round. | 218 // scheduled in the next round. |
| 213 polling_task_runner_->RunPendingTasks(); | 219 polling_task_runner_->RunPendingTasks(); |
| 214 polling_task_runner_->RunPendingTasks(); | 220 polling_task_runner_->RunPendingTasks(); |
| 215 ASSERT_FALSE(polling_task_runner_->HasPendingTask()); | 221 ASSERT_FALSE(polling_task_runner_->HasPendingTask()); |
| 216 | 222 |
| 217 DestroyGamepad(&delegate); | 223 DestroyGamepad(&delegate); |
| 218 } | 224 } |
| 219 | 225 |
| 220 } // namespace | 226 } // namespace |
| 221 } // namespace exo | 227 } // namespace exo |
| OLD | NEW |