| 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/macros.h" | 6 #include "base/macros.h" |
| 7 #include "components/exo/buffer.h" | 7 #include "components/exo/buffer.h" |
| 8 #include "components/exo/keyboard.h" | 8 #include "components/exo/keyboard.h" |
| 9 #include "components/exo/keyboard_delegate.h" | 9 #include "components/exo/keyboard_delegate.h" |
| 10 #include "components/exo/shell_surface.h" | 10 #include "components/exo/shell_surface.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class MockKeyboardDelegate : public KeyboardDelegate { | 24 class MockKeyboardDelegate : public KeyboardDelegate { |
| 25 public: | 25 public: |
| 26 MockKeyboardDelegate() {} | 26 MockKeyboardDelegate() {} |
| 27 | 27 |
| 28 // Overridden from KeyboardDelegate: | 28 // Overridden from KeyboardDelegate: |
| 29 MOCK_METHOD1(OnKeyboardDestroying, void(Keyboard*)); | 29 MOCK_METHOD1(OnKeyboardDestroying, void(Keyboard*)); |
| 30 MOCK_CONST_METHOD1(CanAcceptKeyboardEventsForSurface, bool(Surface*)); | 30 MOCK_CONST_METHOD1(CanAcceptKeyboardEventsForSurface, bool(Surface*)); |
| 31 MOCK_METHOD2(OnKeyboardEnter, | 31 MOCK_METHOD2(OnKeyboardEnter, |
| 32 void(Surface*, const std::vector<ui::DomCode>&)); | 32 void(Surface*, const std::vector<ui::DomCode>&)); |
| 33 MOCK_METHOD1(OnKeyboardLeave, void(Surface*)); | 33 MOCK_METHOD1(OnKeyboardLeave, void(Surface*)); |
| 34 MOCK_METHOD3(OnKeyboardKey, void(base::TimeDelta, ui::DomCode, bool)); | 34 MOCK_METHOD3(OnKeyboardKey, void(base::TimeTicks, ui::DomCode, bool)); |
| 35 MOCK_METHOD1(OnKeyboardModifiers, void(int)); | 35 MOCK_METHOD1(OnKeyboardModifiers, void(int)); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 TEST_F(KeyboardTest, OnKeyboardEnter) { | 38 TEST_F(KeyboardTest, OnKeyboardEnter) { |
| 39 std::unique_ptr<Surface> surface(new Surface); | 39 std::unique_ptr<Surface> surface(new Surface); |
| 40 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 40 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 41 gfx::Size buffer_size(10, 10); | 41 gfx::Size buffer_size(10, 10); |
| 42 std::unique_ptr<Buffer> buffer( | 42 std::unique_ptr<Buffer> buffer( |
| 43 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 43 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 44 surface->Attach(buffer.get()); | 44 surface->Attach(buffer.get()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 EXPECT_CALL(delegate, OnKeyboardKey(testing::_, ui::DomCode::US_B, false)); | 184 EXPECT_CALL(delegate, OnKeyboardKey(testing::_, ui::DomCode::US_B, false)); |
| 185 EXPECT_CALL(delegate, OnKeyboardModifiers(0)); | 185 EXPECT_CALL(delegate, OnKeyboardModifiers(0)); |
| 186 generator.ReleaseKey(ui::VKEY_B, 0); | 186 generator.ReleaseKey(ui::VKEY_B, 0); |
| 187 | 187 |
| 188 EXPECT_CALL(delegate, OnKeyboardDestroying(keyboard.get())); | 188 EXPECT_CALL(delegate, OnKeyboardDestroying(keyboard.get())); |
| 189 keyboard.reset(); | 189 keyboard.reset(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace | 192 } // namespace |
| 193 } // namespace exo | 193 } // namespace exo |
| OLD | NEW |