Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: services/ui/ws/test_utils.h

Issue 2352893002: Makes windowserver not send messages during shutdown (Closed)
Patch Set: merge Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | services/ui/ws/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "services/ui/public/interfaces/display.mojom.h" 15 #include "services/ui/public/interfaces/display.mojom.h"
15 #include "services/ui/public/interfaces/window_tree.mojom.h" 16 #include "services/ui/public/interfaces/window_tree.mojom.h"
16 #include "services/ui/ws/display.h" 17 #include "services/ui/ws/display.h"
17 #include "services/ui/ws/display_binding.h" 18 #include "services/ui/ws/display_binding.h"
18 #include "services/ui/ws/drag_controller.h" 19 #include "services/ui/ws/drag_controller.h"
19 #include "services/ui/ws/event_dispatcher.h" 20 #include "services/ui/ws/event_dispatcher.h"
20 #include "services/ui/ws/platform_display.h" 21 #include "services/ui/ws/platform_display.h"
21 #include "services/ui/ws/platform_display_factory.h" 22 #include "services/ui/ws/platform_display_factory.h"
22 #include "services/ui/ws/test_change_tracker.h" 23 #include "services/ui/ws/test_change_tracker.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 bool record_on_change_completed_ = false; 467 bool record_on_change_completed_ = false;
467 468
468 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); 469 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient);
469 }; 470 };
470 471
471 // ----------------------------------------------------------------------------- 472 // -----------------------------------------------------------------------------
472 473
473 // WindowTreeBinding implementation that vends TestWindowTreeBinding. 474 // WindowTreeBinding implementation that vends TestWindowTreeBinding.
474 class TestWindowTreeBinding : public WindowTreeBinding { 475 class TestWindowTreeBinding : public WindowTreeBinding {
475 public: 476 public:
476 explicit TestWindowTreeBinding(WindowTree* tree); 477 TestWindowTreeBinding(WindowTree* tree,
478 std::unique_ptr<TestWindowTreeClient> client =
479 base::MakeUnique<TestWindowTreeClient>());
477 ~TestWindowTreeBinding() override; 480 ~TestWindowTreeBinding() override;
478 481
482 std::unique_ptr<TestWindowTreeClient> ReleaseClient() {
483 return std::move(client_);
484 }
485
479 WindowTree* tree() { return tree_; } 486 WindowTree* tree() { return tree_; }
480 TestWindowTreeClient* client() { return &client_; } 487 TestWindowTreeClient* client() { return client_.get(); }
481 TestWindowManager* window_manager() { return window_manager_.get(); } 488 TestWindowManager* window_manager() { return window_manager_.get(); }
482 489
483 bool is_paused() const { return is_paused_; } 490 bool is_paused() const { return is_paused_; }
484 491
485 // WindowTreeBinding: 492 // WindowTreeBinding:
486 mojom::WindowManager* GetWindowManager() override; 493 mojom::WindowManager* GetWindowManager() override;
487 void SetIncomingMethodCallProcessingPaused(bool paused) override; 494 void SetIncomingMethodCallProcessingPaused(bool paused) override;
488 495
496 protected:
497 // WindowTreeBinding:
498 mojom::WindowTreeClient* CreateClientForShutdown() override;
499
489 private: 500 private:
490 WindowTree* tree_; 501 WindowTree* tree_;
491 TestWindowTreeClient client_; 502 std::unique_ptr<TestWindowTreeClient> client_;
503 // This is the client created once ResetClientForShutdown() is called.
504 std::unique_ptr<TestWindowTreeClient> client_after_reset_;
492 bool is_paused_ = false; 505 bool is_paused_ = false;
493 std::unique_ptr<TestWindowManager> window_manager_; 506 std::unique_ptr<TestWindowManager> window_manager_;
494 507
495 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeBinding); 508 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeBinding);
496 }; 509 };
497 510
498 // ----------------------------------------------------------------------------- 511 // -----------------------------------------------------------------------------
499 512
500 // WindowServerDelegate that creates TestWindowTreeClients. 513 // WindowServerDelegate that creates TestWindowTreeClients.
501 class TestWindowServerDelegate : public WindowServerDelegate { 514 class TestWindowServerDelegate : public WindowServerDelegate {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 658 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
646 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 659 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
647 ServerWindow* parent, 660 ServerWindow* parent,
648 ClientWindowId* client_id); 661 ClientWindowId* client_id);
649 662
650 } // namespace test 663 } // namespace test
651 } // namespace ws 664 } // namespace ws
652 } // namespace ui 665 } // namespace ui
653 666
654 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 667 #endif // SERVICES_UI_WS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698