Chromium Code Reviews| 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 #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 Loading... | |
| 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 properties[ui::mojom::WindowManager::kInitialDisplayId_Property] = | |
| 132 mojo::ConvertTo<std::vector<uint8_t>>(display_id); | |
|
kylechar
2016/11/23 00:28:00
For the default value kInvalidDisplayId, do you re
thanhph
2016/11/23 01:05:02
Good question. I found a use case of kInvalidDispl
kylechar
2016/11/23 14:14:20
So the value kInvalidDisplayId is appropriate to u
| |
| 133 | |
| 131 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0] | 134 ui::Window* window = test_helper_->GetRootsOrderedByDisplayId()[0] |
| 132 ->window_manager() | 135 ->window_manager() |
| 133 ->NewTopLevelWindow(&properties); | 136 ->NewTopLevelWindow(&properties); |
| 134 window->SetVisible(true); | 137 window->SetVisible(true); |
| 135 return window; | 138 return window; |
| 136 } | 139 } |
| 137 | 140 |
| 138 ui::Window* WmTestBase::CreateChildTestWindow(ui::Window* parent, | 141 ui::Window* WmTestBase::CreateChildTestWindow(ui::Window* parent, |
| 139 const gfx::Rect& bounds) { | 142 const gfx::Rect& bounds) { |
| 140 std::map<std::string, std::vector<uint8_t>> properties; | 143 std::map<std::string, std::vector<uint8_t>> properties; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 157 test_helper_->Init(); | 160 test_helper_->Init(); |
| 158 } | 161 } |
| 159 | 162 |
| 160 void WmTestBase::TearDown() { | 163 void WmTestBase::TearDown() { |
| 161 teardown_called_ = true; | 164 teardown_called_ = true; |
| 162 test_helper_.reset(); | 165 test_helper_.reset(); |
| 163 } | 166 } |
| 164 | 167 |
| 165 } // namespace mus | 168 } // namespace mus |
| 166 } // namespace ash | 169 } // namespace ash |
| OLD | NEW |