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

Unified Diff: ash/mus/test/wm_test_base.cc

Issue 2484813002: Add child for parent_mus when params.parent_mus is not initialized. (Closed)
Patch Set: Discard this patchset. Wrong branch committed. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager_ash_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/test/wm_test_base.cc
diff --git a/ash/mus/test/wm_test_base.cc b/ash/mus/test/wm_test_base.cc
index c45eb6e73457fd27f8e573754940c7f90f90f533..afee0f0b3376c5c5ccbe4eebec0ac07c3cd99d82 100644
--- a/ash/mus/test/wm_test_base.cc
+++ b/ash/mus/test/wm_test_base.cc
@@ -123,6 +123,65 @@ ui::Window* WmTestBase::CreateTestWindow(const gfx::Rect& bounds,
return window;
}
+RootWindowController* WmTestBase::GetPrimaryRootWindowController() {
+ std::vector<RootWindowController*> roots =
+ test_helper_->GetRootsOrderedByDisplayId();
+ DCHECK(!roots.empty());
+ return roots[0];
+}
+
+RootWindowController* WmTestBase::GetSecondaryRootWindowController() {
+ std::vector<RootWindowController*> roots =
+ test_helper_->GetRootsOrderedByDisplayId();
+ return roots.size() < 2 ? nullptr : roots[1];
+}
+
+ui::Window* WmTestBase::CreateTestWindow(const gfx::Rect& bounds,
+ ui::wm::WindowType window_type,
+ RootWindowController* root) {
+ std::map<std::string, std::vector<uint8_t>> properties;
+ properties[ui::mojom::WindowManager::kWindowType_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(
+ static_cast<int32_t>(MusWindowTypeFromWmWindowType(window_type)));
+ if (!bounds.IsEmpty()) {
+ properties[ui::mojom::WindowManager::kInitialBounds_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(bounds);
+ }
+ properties[ui::mojom::WindowManager::kResizeBehavior_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(
+ ui::mojom::kResizeBehaviorCanResize |
+ ui::mojom::kResizeBehaviorCanMaximize |
+ ui::mojom::kResizeBehaviorCanMinimize);
+
+ properties[ui::mojom::WindowManager::kInitialDisplayId_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(root->display().id());
+ // LOG(ERROR) << "\n WmTestBase::CreateTestWindow
+ // properties[ui::mojom::WindowManager::kInitialDisplayId_Property]=" <<
+ // mojo::TypeConverter<int64_t,
+ // std::vector<uint8_t>>::Convert(properties[ui::mojom::WindowManager::kInitialDisplayId_Property]);
+
+ LOG(ERROR) << "\n root->display().id()" << root->display().id() << "\n";
+
+ ui::Window* window = root->window_manager()->NewTopLevelWindow(&properties);
+ window->SetVisible(true);
+ // Most tests expect a minimum size of 0x0.
+ WmWindowMusTestApi(WmWindowMus::Get(window)).set_use_empty_minimum_size(true);
+ return window;
+}
+
+ui::Window* WmTestBase::CreateFullscreenTestWindow(RootWindowController* root) {
+ std::map<std::string, std::vector<uint8_t>> properties;
+ properties[ui::mojom::WindowManager::kShowState_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(
+ static_cast<int32_t>(ui::mojom::ShowState::FULLSCREEN));
+ properties[ui::mojom::WindowManager::kInitialDisplayId_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(root->display().id());
+
+ ui::Window* window = root->window_manager()->NewTopLevelWindow(&properties);
+ window->SetVisible(true);
+ return window;
+}
+
ui::Window* WmTestBase::CreateFullscreenTestWindow() {
std::map<std::string, std::vector<uint8_t>> properties;
properties[ui::mojom::WindowManager::kShowState_Property] =
« no previous file with comments | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698