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

Side by Side Diff: mash/wm/window_manager_unittest.cc

Issue 2024313002: Moves mash/wm/public -> ash/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 6 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 | « mash/wm/window_manager_application.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/interfaces/user_window_controller.mojom.h"
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "components/mus/public/cpp/window.h" 14 #include "components/mus/public/cpp/window.h"
14 #include "components/mus/public/cpp/window_tree_client.h" 15 #include "components/mus/public/cpp/window_tree_client.h"
15 #include "components/mus/public/cpp/window_tree_client_delegate.h" 16 #include "components/mus/public/cpp/window_tree_client_delegate.h"
16 #include "components/mus/public/interfaces/window_tree.mojom.h" 17 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "mash/wm/public/interfaces/user_window_controller.mojom.h"
18 #include "services/shell/public/cpp/shell_test.h" 18 #include "services/shell/public/cpp/shell_test.h"
19 19
20 namespace mash { 20 namespace mash {
21 namespace wm { 21 namespace wm {
22 22
23 class WindowTreeClientDelegate : public mus::WindowTreeClientDelegate { 23 class WindowTreeClientDelegate : public mus::WindowTreeClientDelegate {
24 public: 24 public:
25 WindowTreeClientDelegate() {} 25 WindowTreeClientDelegate() {}
26 ~WindowTreeClientDelegate() override {} 26 ~WindowTreeClientDelegate() override {}
27 27
(...skipping 12 matching lines...) Expand all
40 ~WindowManagerTest() override {} 40 ~WindowManagerTest() override {}
41 41
42 private: 42 private:
43 DISALLOW_COPY_AND_ASSIGN(WindowManagerTest); 43 DISALLOW_COPY_AND_ASSIGN(WindowManagerTest);
44 }; 44 };
45 45
46 void OnEmbed(bool success) { 46 void OnEmbed(bool success) {
47 ASSERT_TRUE(success); 47 ASSERT_TRUE(success);
48 } 48 }
49 49
50 class TestUserWindowObserver : public mojom::UserWindowObserver { 50 class TestUserWindowObserver : public ash::mojom::UserWindowObserver {
51 public: 51 public:
52 explicit TestUserWindowObserver(shell::Connector* connector) 52 explicit TestUserWindowObserver(shell::Connector* connector)
53 : binding_(this), window_count_(0u), expected_window_count_(0u) { 53 : binding_(this), window_count_(0u), expected_window_count_(0u) {
54 connector->ConnectToInterface("mojo:desktop_wm", &user_window_controller_); 54 connector->ConnectToInterface("mojo:desktop_wm", &user_window_controller_);
55 user_window_controller_->AddUserWindowObserver( 55 user_window_controller_->AddUserWindowObserver(
56 binding_.CreateInterfacePtrAndBind()); 56 binding_.CreateInterfacePtrAndBind());
57 } 57 }
58 58
59 ~TestUserWindowObserver() override {} 59 ~TestUserWindowObserver() override {}
60 60
(...skipping 10 matching lines...) Expand all
71 } 71 }
72 72
73 private: 73 private:
74 void QuitIfNecessary() { 74 void QuitIfNecessary() {
75 if (window_count_ == expected_window_count_ && !quit_callback_.is_null()) 75 if (window_count_ == expected_window_count_ && !quit_callback_.is_null())
76 quit_callback_.Run(); 76 quit_callback_.Run();
77 } 77 }
78 78
79 // mojom::UserWindowObserver: 79 // mojom::UserWindowObserver:
80 void OnUserWindowObserverAdded( 80 void OnUserWindowObserverAdded(
81 mojo::Array<mojom::UserWindowPtr> user_windows) override { 81 mojo::Array<ash::mojom::UserWindowPtr> user_windows) override {
82 window_count_ = user_windows.size(); 82 window_count_ = user_windows.size();
83 QuitIfNecessary(); 83 QuitIfNecessary();
84 } 84 }
85 85
86 void OnUserWindowAdded(mojom::UserWindowPtr user_window) override { 86 void OnUserWindowAdded(ash::mojom::UserWindowPtr user_window) override {
87 ++window_count_; 87 ++window_count_;
88 QuitIfNecessary(); 88 QuitIfNecessary();
89 } 89 }
90 90
91 void OnUserWindowRemoved(uint32_t window_id) override { 91 void OnUserWindowRemoved(uint32_t window_id) override {
92 ASSERT_TRUE(window_count_); 92 ASSERT_TRUE(window_count_);
93 --window_count_; 93 --window_count_;
94 QuitIfNecessary(); 94 QuitIfNecessary();
95 } 95 }
96 96
97 void OnUserWindowTitleChanged(uint32_t window_id, 97 void OnUserWindowTitleChanged(uint32_t window_id,
98 const mojo::String& window_title) override {} 98 const mojo::String& window_title) override {}
99 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override {} 99 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override {}
100 void OnUserWindowAppIconChanged(uint32_t window_id, 100 void OnUserWindowAppIconChanged(uint32_t window_id,
101 mojo::Array<uint8_t> app_icon) override {} 101 mojo::Array<uint8_t> app_icon) override {}
102 102
103 mojom::UserWindowControllerPtr user_window_controller_; 103 ash::mojom::UserWindowControllerPtr user_window_controller_;
104 mojo::Binding<mojom::UserWindowObserver> binding_; 104 mojo::Binding<ash::mojom::UserWindowObserver> binding_;
105 105
106 size_t window_count_; 106 size_t window_count_;
107 size_t expected_window_count_; 107 size_t expected_window_count_;
108 base::Closure quit_callback_; 108 base::Closure quit_callback_;
109 109
110 DISALLOW_COPY_AND_ASSIGN(TestUserWindowObserver); 110 DISALLOW_COPY_AND_ASSIGN(TestUserWindowObserver);
111 }; 111 };
112 112
113 TEST_F(WindowManagerTest, OpenWindow) { 113 TEST_F(WindowManagerTest, OpenWindow) {
114 WindowTreeClientDelegate window_tree_delegate; 114 WindowTreeClientDelegate window_tree_delegate;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 mus::Window* top_level_window = client->NewTopLevelWindow(nullptr); 153 mus::Window* top_level_window = client->NewTopLevelWindow(nullptr);
154 ASSERT_TRUE(top_level_window); 154 ASSERT_TRUE(top_level_window);
155 155
156 observer.WaitUntilWindowCountReaches(1u); 156 observer.WaitUntilWindowCountReaches(1u);
157 client.reset(); 157 client.reset();
158 observer.WaitUntilWindowCountReaches(0u); 158 observer.WaitUntilWindowCountReaches(0u);
159 } 159 }
160 160
161 } // namespace wm 161 } // namespace wm
162 } // namespace mash 162 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/window_manager_application.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698