| 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 #ifndef SERVICES_UI_WS_TEST_UTILS_H_ | 5 #ifndef SERVICES_UI_WS_TEST_UTILS_H_ |
| 6 #define SERVICES_UI_WS_TEST_UTILS_H_ | 6 #define SERVICES_UI_WS_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // WindowServerDelegate that creates TestWindowTreeClients. | 515 // WindowServerDelegate that creates TestWindowTreeClients. |
| 516 class TestWindowServerDelegate : public WindowServerDelegate { | 516 class TestWindowServerDelegate : public WindowServerDelegate { |
| 517 public: | 517 public: |
| 518 TestWindowServerDelegate(); | 518 TestWindowServerDelegate(); |
| 519 ~TestWindowServerDelegate() override; | 519 ~TestWindowServerDelegate() override; |
| 520 | 520 |
| 521 void set_window_server(WindowServer* window_server) { | 521 void set_window_server(WindowServer* window_server) { |
| 522 window_server_ = window_server; | 522 window_server_ = window_server; |
| 523 } | 523 } |
| 524 | 524 |
| 525 void set_num_displays_to_create(int count) { | |
| 526 num_displays_to_create_ = count; | |
| 527 } | |
| 528 | |
| 529 TestWindowTreeClient* last_client() { | 525 TestWindowTreeClient* last_client() { |
| 530 return last_binding() ? last_binding()->client() : nullptr; | 526 return last_binding() ? last_binding()->client() : nullptr; |
| 531 } | 527 } |
| 532 TestWindowTreeBinding* last_binding() { | 528 TestWindowTreeBinding* last_binding() { |
| 533 return bindings_.empty() ? nullptr : bindings_.back(); | 529 return bindings_.empty() ? nullptr : bindings_.back(); |
| 534 } | 530 } |
| 535 | 531 |
| 536 std::vector<TestWindowTreeBinding*>* bindings() { return &bindings_; } | 532 std::vector<TestWindowTreeBinding*>* bindings() { return &bindings_; } |
| 537 | 533 |
| 538 bool got_on_no_more_displays() const { return got_on_no_more_displays_; } | 534 bool got_on_no_more_displays() const { return got_on_no_more_displays_; } |
| 539 | 535 |
| 536 // Creates |num_displays| displays. |
| 537 void CreateDisplays(int num_displays); |
| 538 |
| 540 Display* AddDisplay(); | 539 Display* AddDisplay(); |
| 541 | 540 |
| 542 // WindowServerDelegate: | 541 // WindowServerDelegate: |
| 543 void OnNoMoreDisplays() override; | 542 void OnNoMoreDisplays() override; |
| 544 std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding( | 543 std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding( |
| 545 BindingType type, | 544 BindingType type, |
| 546 ws::WindowServer* window_server, | 545 ws::WindowServer* window_server, |
| 547 ws::WindowTree* tree, | 546 ws::WindowTree* tree, |
| 548 mojom::WindowTreeRequest* tree_request, | 547 mojom::WindowTreeRequest* tree_request, |
| 549 mojom::WindowTreeClientPtr* client) override; | 548 mojom::WindowTreeClientPtr* client) override; |
| 550 void CreateDefaultDisplays() override; | |
| 551 bool IsTestConfig() const override; | 549 bool IsTestConfig() const override; |
| 552 void UpdateTouchTransforms() override {} | 550 void UpdateTouchTransforms() override {} |
| 553 | 551 |
| 554 private: | 552 private: |
| 555 // If CreateDefaultDisplays() this is the number of Displays that are | |
| 556 // created. The default is 0, which results in a DCHECK. | |
| 557 int num_displays_to_create_ = 0; | |
| 558 WindowServer* window_server_ = nullptr; | 553 WindowServer* window_server_ = nullptr; |
| 559 bool got_on_no_more_displays_ = false; | 554 bool got_on_no_more_displays_ = false; |
| 560 // All TestWindowTreeBinding objects created via CreateWindowTreeBinding. | 555 // All TestWindowTreeBinding objects created via CreateWindowTreeBinding. |
| 561 // These are owned by the corresponding WindowTree. | 556 // These are owned by the corresponding WindowTree. |
| 562 std::vector<TestWindowTreeBinding*> bindings_; | 557 std::vector<TestWindowTreeBinding*> bindings_; |
| 563 | 558 |
| 564 DISALLOW_COPY_AND_ASSIGN(TestWindowServerDelegate); | 559 DISALLOW_COPY_AND_ASSIGN(TestWindowServerDelegate); |
| 565 }; | 560 }; |
| 566 | 561 |
| 567 // ----------------------------------------------------------------------------- | 562 // ----------------------------------------------------------------------------- |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 655 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
| 661 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 656 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 662 ServerWindow* parent, | 657 ServerWindow* parent, |
| 663 ClientWindowId* client_id); | 658 ClientWindowId* client_id); |
| 664 | 659 |
| 665 } // namespace test | 660 } // namespace test |
| 666 } // namespace ws | 661 } // namespace ws |
| 667 } // namespace ui | 662 } // namespace ui |
| 668 | 663 |
| 669 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 664 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
| OLD | NEW |