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

Side by Side Diff: ash/mus/test/wm_test_base.cc

Issue 2503623002: Support creation of toplevel mus::Windows on separate displays (Closed)
Patch Set: Don't use mus kInitialDisplayId_Property if the display id is negative. Created 4 years, 1 month 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 | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager_unittest.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 #include "ash/mus/test/wm_test_base.h" 5 #include "ash/mus/test/wm_test_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/mus/bridge/wm_window_mus_test_api.h" 10 #include "ash/mus/bridge/wm_window_mus_test_api.h"
11 #include "ash/mus/root_window_controller.h" 11 #include "ash/mus/root_window_controller.h"
12 #include "ash/mus/test/wm_test_helper.h" 12 #include "ash/mus/test/wm_test_helper.h"
13 #include "ash/mus/window_manager.h" 13 #include "ash/mus/window_manager.h"
14 #include "ash/mus/window_manager_application.h" 14 #include "ash/mus/window_manager_application.h"
15 #include "services/ui/public/cpp/property_type_converters.h" 15 #include "services/ui/public/cpp/property_type_converters.h"
16 #include "services/ui/public/cpp/window_tree_client.h" 16 #include "services/ui/public/cpp/window_tree_client.h"
17 #include "ui/display/display.h"
18 17
19 namespace ash { 18 namespace ash {
20 namespace mus { 19 namespace mus {
21 namespace { 20 namespace {
22 21
23 ui::mojom::WindowType MusWindowTypeFromWmWindowType( 22 ui::mojom::WindowType MusWindowTypeFromWmWindowType(
24 ui::wm::WindowType wm_window_type) { 23 ui::wm::WindowType wm_window_type) {
25 switch (wm_window_type) { 24 switch (wm_window_type) {
26 case ui::wm::WINDOW_TYPE_UNKNOWN: 25 case ui::wm::WINDOW_TYPE_UNKNOWN:
27 break; 26 break;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 115
117 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0] 116 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0]
118 ->window_manager() 117 ->window_manager()
119 ->NewTopLevelWindow(&properties); 118 ->NewTopLevelWindow(&properties);
120 window->SetVisible(true); 119 window->SetVisible(true);
121 // Most tests expect a minimum size of 0x0. 120 // Most tests expect a minimum size of 0x0.
122 WmWindowMusTestApi(WmWindowMus::Get(window)).set_use_empty_minimum_size(true); 121 WmWindowMusTestApi(WmWindowMus::Get(window)).set_use_empty_minimum_size(true);
123 return window; 122 return window;
124 } 123 }
125 124
126 ui::Window* WmTestBase::CreateFullscreenTestWindow() { 125 ui::Window* WmTestBase::CreateFullscreenTestWindow(int64_t display_id) {
127 std::map<std::string, std::vector<uint8_t>> properties; 126 std::map<std::string, std::vector<uint8_t>> properties;
128 properties[ui::mojom::WindowManager::kShowState_Property] = 127 properties[ui::mojom::WindowManager::kShowState_Property] =
129 mojo::ConvertTo<std::vector<uint8_t>>( 128 mojo::ConvertTo<std::vector<uint8_t>>(
130 static_cast<int32_t>(ui::mojom::ShowState::FULLSCREEN)); 129 static_cast<int32_t>(ui::mojom::ShowState::FULLSCREEN));
130
131 if (display_id > -1) {
kylechar 2016/11/23 14:14:20 if (display_id != display::kInvalidDisplayId) { ..
thanhph 2016/11/23 14:26:19 Done.
132 properties[ui::mojom::WindowManager::kInitialDisplayId_Property] =
133 mojo::ConvertTo<std::vector<uint8_t>>(display_id);
134 }
135
131 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0] 136 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0]
132 ->window_manager() 137 ->window_manager()
133 ->NewTopLevelWindow(&properties); 138 ->NewTopLevelWindow(&properties);
134 window->SetVisible(true); 139 window->SetVisible(true);
135 return window; 140 return window;
136 } 141 }
137 142
138 ui::Window* WmTestBase::CreateChildTestWindow(ui::Window* parent, 143 ui::Window* WmTestBase::CreateChildTestWindow(ui::Window* parent,
139 const gfx::Rect& bounds) { 144 const gfx::Rect& bounds) {
140 std::map<std::string, std::vector<uint8_t>> properties; 145 std::map<std::string, std::vector<uint8_t>> properties;
(...skipping 16 matching lines...) Expand all
157 test_helper_->Init(); 162 test_helper_->Init();
158 } 163 }
159 164
160 void WmTestBase::TearDown() { 165 void WmTestBase::TearDown() {
161 teardown_called_ = true; 166 teardown_called_ = true;
162 test_helper_.reset(); 167 test_helper_.reset();
163 } 168 }
164 169
165 } // namespace mus 170 } // namespace mus
166 } // namespace ash 171 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698