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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2445583002: Relocate display_manager from ash to ui (Closed)
Patch Set: fix windows build 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/root_window_controller.cc ('k') | ash/rotator/screen_rotation_animator.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
11 #include "ash/common/session/session_state_delegate.h" 11 #include "ash/common/session/session_state_delegate.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/wm/system_modal_container_layout_manager.h" 13 #include "ash/common/wm/system_modal_container_layout_manager.h"
14 #include "ash/common/wm/window_state.h" 14 #include "ash/common/wm/window_state.h"
15 #include "ash/common/wm_lookup.h" 15 #include "ash/common/wm_lookup.h"
16 #include "ash/common/wm_root_window_controller.h" 16 #include "ash/common/wm_root_window_controller.h"
17 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 18 #include "ash/common/wm_window.h"
19 #include "ash/display/display_manager.h"
20 #include "ash/public/cpp/shell_window_ids.h" 19 #include "ash/public/cpp/shell_window_ids.h"
21 #include "ash/shell.h" 20 #include "ash/shell.h"
22 #include "ash/test/ash_md_test_base.h" 21 #include "ash/test/ash_md_test_base.h"
23 #include "ash/test/ash_test_base.h" 22 #include "ash/test/ash_test_base.h"
24 #include "ash/test/display_manager_test_api.h"
25 #include "ash/wm/window_properties.h" 23 #include "ash/wm/window_properties.h"
26 #include "ash/wm/window_state_aura.h" 24 #include "ash/wm/window_state_aura.h"
27 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
28 #include "base/command_line.h" 26 #include "base/command_line.h"
29 #include "ui/aura/client/focus_change_observer.h" 27 #include "ui/aura/client/focus_change_observer.h"
30 #include "ui/aura/client/focus_client.h" 28 #include "ui/aura/client/focus_client.h"
31 #include "ui/aura/client/window_parenting_client.h" 29 #include "ui/aura/client/window_parenting_client.h"
32 #include "ui/aura/env.h" 30 #include "ui/aura/env.h"
33 #include "ui/aura/test/test_window_delegate.h" 31 #include "ui/aura/test/test_window_delegate.h"
34 #include "ui/aura/test/test_windows.h" 32 #include "ui/aura/test/test_windows.h"
35 #include "ui/aura/window.h" 33 #include "ui/aura/window.h"
36 #include "ui/aura/window_event_dispatcher.h" 34 #include "ui/aura/window_event_dispatcher.h"
37 #include "ui/aura/window_tracker.h" 35 #include "ui/aura/window_tracker.h"
38 #include "ui/base/ime/dummy_text_input_client.h" 36 #include "ui/base/ime/dummy_text_input_client.h"
39 #include "ui/base/ime/input_method.h" 37 #include "ui/base/ime/input_method.h"
40 #include "ui/base/ime/text_input_client.h" 38 #include "ui/base/ime/text_input_client.h"
39 #include "ui/display/manager/display_manager.h"
41 #include "ui/events/test/event_generator.h" 40 #include "ui/events/test/event_generator.h"
42 #include "ui/events/test/test_event_handler.h" 41 #include "ui/events/test/test_event_handler.h"
43 #include "ui/keyboard/keyboard_controller.h" 42 #include "ui/keyboard/keyboard_controller.h"
44 #include "ui/keyboard/keyboard_switches.h" 43 #include "ui/keyboard/keyboard_switches.h"
45 #include "ui/keyboard/keyboard_ui.h" 44 #include "ui/keyboard/keyboard_ui.h"
46 #include "ui/keyboard/keyboard_util.h" 45 #include "ui/keyboard/keyboard_util.h"
47 #include "ui/views/controls/menu/menu_controller.h" 46 #include "ui/views/controls/menu/menu_controller.h"
48 #include "ui/views/widget/widget.h" 47 #include "ui/views/widget/widget.h"
49 #include "ui/views/widget/widget_delegate.h" 48 #include "ui/views/widget/widget_delegate.h"
50 49
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); 290 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow());
292 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 291 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
293 generator_1st.ClickLeftButton(); 292 generator_1st.ClickLeftButton();
294 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 293 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
295 } 294 }
296 295
297 // Make sure lock related windows moves. 296 // Make sure lock related windows moves.
298 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { 297 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) {
299 if (!SupportsMultipleDisplays()) 298 if (!SupportsMultipleDisplays())
300 return; 299 return;
301 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); 300 display_manager()->SetUnifiedDesktopEnabled(true);
302 301
303 UpdateDisplay("500x500"); 302 UpdateDisplay("500x500");
304 const int kLockScreenWindowId = 1000; 303 const int kLockScreenWindowId = 1000;
305 const int kLockWallpaperWindowId = 1001; 304 const int kLockWallpaperWindowId = 1001;
306 305
307 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); 306 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
308 307
309 aura::Window* lock_container = 308 aura::Window* lock_container =
310 controller->GetContainer(kShellWindowId_LockScreenContainer); 309 controller->GetContainer(kShellWindowId_LockScreenContainer);
311 aura::Window* lock_wallpaper_container = 310 aura::Window* lock_wallpaper_container =
(...skipping 20 matching lines...) Expand all
332 // In unified mode, RWC is created 331 // In unified mode, RWC is created
333 controller = Shell::GetPrimaryRootWindowController(); 332 controller = Shell::GetPrimaryRootWindowController();
334 333
335 ASSERT_EQ(lock_screen->GetNativeWindow(), 334 ASSERT_EQ(lock_screen->GetNativeWindow(),
336 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 335 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
337 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), 336 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
338 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); 337 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
339 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 338 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
340 339
341 // Switch to mirror. 340 // Switch to mirror.
342 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 341 display_manager()->SetMirrorMode(true);
343 display_manager->SetMirrorMode(true); 342 EXPECT_TRUE(display_manager()->IsInMirrorMode());
344 EXPECT_TRUE(display_manager->IsInMirrorMode());
345 343
346 controller = Shell::GetPrimaryRootWindowController(); 344 controller = Shell::GetPrimaryRootWindowController();
347 ASSERT_EQ(lock_screen->GetNativeWindow(), 345 ASSERT_EQ(lock_screen->GetNativeWindow(),
348 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 346 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
349 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), 347 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
350 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); 348 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
351 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 349 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
352 350
353 // Switch to unified. 351 // Switch to unified.
354 display_manager->SetMirrorMode(false); 352 display_manager()->SetMirrorMode(false);
355 EXPECT_TRUE(display_manager->IsInUnifiedMode()); 353 EXPECT_TRUE(display_manager()->IsInUnifiedMode());
356 354
357 controller = Shell::GetPrimaryRootWindowController(); 355 controller = Shell::GetPrimaryRootWindowController();
358 356
359 ASSERT_EQ(lock_screen->GetNativeWindow(), 357 ASSERT_EQ(lock_screen->GetNativeWindow(),
360 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 358 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
361 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), 359 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
362 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); 360 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
363 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 361 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
364 362
365 // Switch to single display. 363 // Switch to single display.
366 UpdateDisplay("600x500"); 364 UpdateDisplay("600x500");
367 EXPECT_FALSE(display_manager->IsInUnifiedMode()); 365 EXPECT_FALSE(display_manager()->IsInUnifiedMode());
368 EXPECT_FALSE(display_manager->IsInMirrorMode()); 366 EXPECT_FALSE(display_manager()->IsInMirrorMode());
369 367
370 controller = Shell::GetPrimaryRootWindowController(); 368 controller = Shell::GetPrimaryRootWindowController();
371 369
372 ASSERT_EQ(lock_screen->GetNativeWindow(), 370 ASSERT_EQ(lock_screen->GetNativeWindow(),
373 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 371 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
374 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), 372 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
375 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); 373 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
376 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); 374 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString());
377 } 375 }
378 376
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1031 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1034 gfx::Rect(0, 400, 800, 200)); 1032 gfx::Rect(0, 400, 800, 200));
1035 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1033 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1036 1034
1037 UpdateDisplay("600x800"); 1035 UpdateDisplay("600x800");
1038 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1036 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1039 } 1037 }
1040 1038
1041 } // namespace test 1039 } // namespace test
1042 } // namespace ash 1040 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/rotator/screen_rotation_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698