OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "components/mus/public/cpp/tests/window_server_shelltest_base.h" | 13 #include "components/mus/public/cpp/tests/window_server_shelltest_base.h" |
14 #include "components/mus/public/interfaces/window_tree.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree.mojom.h" |
15 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
16 #include "components/mus/ws/ids.h" | 16 #include "components/mus/ws/ids.h" |
17 #include "components/mus/ws/test_change_tracker.h" | 17 #include "components/mus/ws/test_change_tracker.h" |
18 #include "mojo/public/cpp/bindings/associated_binding.h" | 18 #include "mojo/public/cpp/bindings/associated_binding.h" |
19 #include "services/shell/public/cpp/shell_test.h" | 19 #include "services/shell/public/cpp/shell_test.h" |
20 | 20 |
21 using mojo::Array; | 21 using mojo::Array; |
22 using mojo::Callback; | 22 using mojo::Callback; |
23 using shell::Connection; | 23 using shell::Connection; |
24 using mojo::InterfaceRequest; | 24 using mojo::InterfaceRequest; |
25 using shell::ShellClient; | 25 using shell::ShellClient; |
26 using mojo::String; | 26 using mojo::String; |
27 using mus::mojom::ErrorCode; | 27 using mus::mojom::ErrorCode; |
28 using mus::mojom::EventPtr; | |
29 using mus::mojom::WindowDataPtr; | 28 using mus::mojom::WindowDataPtr; |
30 using mus::mojom::WindowTree; | 29 using mus::mojom::WindowTree; |
31 using mus::mojom::WindowTreeClient; | 30 using mus::mojom::WindowTreeClient; |
32 | 31 |
33 namespace mus { | 32 namespace mus { |
34 namespace ws { | 33 namespace ws { |
35 namespace test { | 34 namespace test { |
36 | 35 |
37 namespace { | 36 namespace { |
38 | 37 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 void OnWindowOpacityChanged(uint32_t window, | 341 void OnWindowOpacityChanged(uint32_t window, |
343 float old_opacity, | 342 float old_opacity, |
344 float new_opacity) override { | 343 float new_opacity) override { |
345 tracker()->OnWindowOpacityChanged(window, new_opacity); | 344 tracker()->OnWindowOpacityChanged(window, new_opacity); |
346 } | 345 } |
347 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override { | 346 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override { |
348 tracker()->OnWindowParentDrawnStateChanged(window, drawn); | 347 tracker()->OnWindowParentDrawnStateChanged(window, drawn); |
349 } | 348 } |
350 void OnWindowInputEvent(uint32_t event_id, | 349 void OnWindowInputEvent(uint32_t event_id, |
351 Id window_id, | 350 Id window_id, |
352 EventPtr event, | 351 std::unique_ptr<ui::Event> event, |
353 uint32_t event_observer_id) override { | 352 uint32_t event_observer_id) override { |
354 // Ack input events to clear the state on the server. These can be received | 353 // Ack input events to clear the state on the server. These can be received |
355 // during test startup. X11Window::DispatchEvent sends a synthetic move | 354 // during test startup. X11Window::DispatchEvent sends a synthetic move |
356 // event to notify of entry. | 355 // event to notify of entry. |
357 tree()->OnWindowInputEventAck(event_id, mojom::EventResult::HANDLED); | 356 tree()->OnWindowInputEventAck(event_id, mojom::EventResult::HANDLED); |
358 // Don't log input events as none of the tests care about them and they | 357 // Don't log input events as none of the tests care about them and they |
359 // may come in at random points. | 358 // may come in at random points. |
360 } | 359 } |
361 void OnEventObserved(EventPtr event, uint32_t event_observer_id) override {} | 360 void OnEventObserved(std::unique_ptr<ui::Event>, |
| 361 uint32_t event_observer_id) override {} |
362 void OnWindowSharedPropertyChanged(uint32_t window, | 362 void OnWindowSharedPropertyChanged(uint32_t window, |
363 const String& name, | 363 const String& name, |
364 Array<uint8_t> new_data) override { | 364 Array<uint8_t> new_data) override { |
365 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); | 365 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); |
366 } | 366 } |
367 // TODO(sky): add testing coverage. | 367 // TODO(sky): add testing coverage. |
368 void OnWindowFocused(uint32_t focused_window_id) override {} | 368 void OnWindowFocused(uint32_t focused_window_id) override {} |
369 void OnWindowPredefinedCursorChanged(uint32_t window_id, | 369 void OnWindowPredefinedCursorChanged(uint32_t window_id, |
370 mojom::Cursor cursor_id) override { | 370 mojom::Cursor cursor_id) override { |
371 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); | 371 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); |
(...skipping 29 matching lines...) Expand all Loading... |
401 void WmCreateTopLevelWindow( | 401 void WmCreateTopLevelWindow( |
402 uint32_t change_id, | 402 uint32_t change_id, |
403 ClientSpecificId requesting_client_id, | 403 ClientSpecificId requesting_client_id, |
404 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override { | 404 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override { |
405 NOTIMPLEMENTED(); | 405 NOTIMPLEMENTED(); |
406 } | 406 } |
407 void WmClientJankinessChanged(ClientSpecificId client_id, | 407 void WmClientJankinessChanged(ClientSpecificId client_id, |
408 bool janky) override { | 408 bool janky) override { |
409 NOTIMPLEMENTED(); | 409 NOTIMPLEMENTED(); |
410 } | 410 } |
411 void OnAccelerator(uint32_t id, mojom::EventPtr event) override { | 411 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override { |
412 NOTIMPLEMENTED(); | 412 NOTIMPLEMENTED(); |
413 } | 413 } |
414 | 414 |
415 TestChangeTracker tracker_; | 415 TestChangeTracker tracker_; |
416 | 416 |
417 mojom::WindowTreePtr tree_; | 417 mojom::WindowTreePtr tree_; |
418 | 418 |
419 // If non-null we're waiting for OnEmbed() using this RunLoop. | 419 // If non-null we're waiting for OnEmbed() using this RunLoop. |
420 std::unique_ptr<base::RunLoop> embed_run_loop_; | 420 std::unique_ptr<base::RunLoop> embed_run_loop_; |
421 | 421 |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 | 2027 |
2028 // TODO(sky): make sure coverage of what was | 2028 // TODO(sky): make sure coverage of what was |
2029 // WindowManagerTest.SecondEmbedRoot_InitService and | 2029 // WindowManagerTest.SecondEmbedRoot_InitService and |
2030 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 2030 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
2031 // manager | 2031 // manager |
2032 // tests. | 2032 // tests. |
2033 | 2033 |
2034 } // namespace test | 2034 } // namespace test |
2035 } // namespace ws | 2035 } // namespace ws |
2036 } // namespace mus | 2036 } // namespace mus |
OLD | NEW |