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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2290473004: Rename ash desktop_background to wallpaper. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 | « ash/root_window_controller.cc ('k') | ash/shell.h » ('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/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 // Make sure lock related windows moves. 295 // Make sure lock related windows moves.
296 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { 296 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) {
297 if (!SupportsMultipleDisplays()) 297 if (!SupportsMultipleDisplays())
298 return; 298 return;
299 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); 299 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true);
300 300
301 UpdateDisplay("500x500"); 301 UpdateDisplay("500x500");
302 const int kLockScreenWindowId = 1000; 302 const int kLockScreenWindowId = 1000;
303 const int kLockBackgroundWindowId = 1001; 303 const int kLockWallpaperWindowId = 1001;
304 304
305 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); 305 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
306 306
307 aura::Window* lock_container = 307 aura::Window* lock_container =
308 controller->GetContainer(kShellWindowId_LockScreenContainer); 308 controller->GetContainer(kShellWindowId_LockScreenContainer);
309 aura::Window* lock_background_container = 309 aura::Window* lock_wallpaper_container =
310 controller->GetContainer(kShellWindowId_LockScreenBackgroundContainer); 310 controller->GetContainer(kShellWindowId_LockScreenWallpaperContainer);
311 311
312 views::Widget* lock_screen = 312 views::Widget* lock_screen =
313 CreateModalWidgetWithParent(gfx::Rect(10, 10, 100, 100), lock_container); 313 CreateModalWidgetWithParent(gfx::Rect(10, 10, 100, 100), lock_container);
314 lock_screen->GetNativeWindow()->set_id(kLockScreenWindowId); 314 lock_screen->GetNativeWindow()->set_id(kLockScreenWindowId);
315 lock_screen->SetFullscreen(true); 315 lock_screen->SetFullscreen(true);
316 316
317 views::Widget* lock_background = CreateModalWidgetWithParent( 317 views::Widget* lock_wallpaper = CreateModalWidgetWithParent(
318 gfx::Rect(10, 10, 100, 100), lock_background_container); 318 gfx::Rect(10, 10, 100, 100), lock_wallpaper_container);
319 lock_background->GetNativeWindow()->set_id(kLockBackgroundWindowId); 319 lock_wallpaper->GetNativeWindow()->set_id(kLockWallpaperWindowId);
320 320
321 ASSERT_EQ(lock_screen->GetNativeWindow(), 321 ASSERT_EQ(lock_screen->GetNativeWindow(),
322 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 322 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
323 ASSERT_EQ(lock_background->GetNativeWindow(), 323 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
324 controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); 324 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
325 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 325 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
326 326
327 // Switch to unified. 327 // Switch to unified.
328 UpdateDisplay("500x500,500x500"); 328 UpdateDisplay("500x500,500x500");
329 329
330 // In unified mode, RWC is created 330 // In unified mode, RWC is created
331 controller = Shell::GetPrimaryRootWindowController(); 331 controller = Shell::GetPrimaryRootWindowController();
332 332
333 ASSERT_EQ(lock_screen->GetNativeWindow(), 333 ASSERT_EQ(lock_screen->GetNativeWindow(),
334 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 334 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
335 ASSERT_EQ(lock_background->GetNativeWindow(), 335 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
336 controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); 336 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
337 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 337 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
338 338
339 // Switch to mirror. 339 // Switch to mirror.
340 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 340 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
341 display_manager->SetMirrorMode(true); 341 display_manager->SetMirrorMode(true);
342 EXPECT_TRUE(display_manager->IsInMirrorMode()); 342 EXPECT_TRUE(display_manager->IsInMirrorMode());
343 343
344 controller = Shell::GetPrimaryRootWindowController(); 344 controller = Shell::GetPrimaryRootWindowController();
345 ASSERT_EQ(lock_screen->GetNativeWindow(), 345 ASSERT_EQ(lock_screen->GetNativeWindow(),
346 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 346 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
347 ASSERT_EQ(lock_background->GetNativeWindow(), 347 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
348 controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); 348 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
349 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 349 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
350 350
351 // Switch to unified. 351 // Switch to unified.
352 display_manager->SetMirrorMode(false); 352 display_manager->SetMirrorMode(false);
353 EXPECT_TRUE(display_manager->IsInUnifiedMode()); 353 EXPECT_TRUE(display_manager->IsInUnifiedMode());
354 354
355 controller = Shell::GetPrimaryRootWindowController(); 355 controller = Shell::GetPrimaryRootWindowController();
356 356
357 ASSERT_EQ(lock_screen->GetNativeWindow(), 357 ASSERT_EQ(lock_screen->GetNativeWindow(),
358 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 358 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
359 ASSERT_EQ(lock_background->GetNativeWindow(), 359 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
360 controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); 360 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
361 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); 361 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString());
362 362
363 // Switch to single display. 363 // Switch to single display.
364 UpdateDisplay("600x500"); 364 UpdateDisplay("600x500");
365 EXPECT_FALSE(display_manager->IsInUnifiedMode()); 365 EXPECT_FALSE(display_manager->IsInUnifiedMode());
366 EXPECT_FALSE(display_manager->IsInMirrorMode()); 366 EXPECT_FALSE(display_manager->IsInMirrorMode());
367 367
368 controller = Shell::GetPrimaryRootWindowController(); 368 controller = Shell::GetPrimaryRootWindowController();
369 369
370 ASSERT_EQ(lock_screen->GetNativeWindow(), 370 ASSERT_EQ(lock_screen->GetNativeWindow(),
371 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); 371 controller->GetRootWindow()->GetChildById(kLockScreenWindowId));
372 ASSERT_EQ(lock_background->GetNativeWindow(), 372 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
373 controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); 373 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
374 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); 374 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString());
375 } 375 }
376 376
377 TEST_P(RootWindowControllerTest, ModalContainer) { 377 TEST_P(RootWindowControllerTest, ModalContainer) {
378 UpdateDisplay("600x600"); 378 UpdateDisplay("600x600");
379 WmShell* wm_shell = WmShell::Get(); 379 WmShell* wm_shell = WmShell::Get();
380 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); 380 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
381 EXPECT_EQ(LoginStatus::USER, 381 EXPECT_EQ(LoginStatus::USER,
382 wm_shell->system_tray_delegate()->GetUserLoginStatus()); 382 wm_shell->system_tray_delegate()->GetUserLoginStatus());
383 EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) 383 EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer)
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1042 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1043 gfx::Rect(0, 400, 800, 200)); 1043 gfx::Rect(0, 400, 800, 200));
1044 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1044 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1045 1045
1046 UpdateDisplay("600x800"); 1046 UpdateDisplay("600x800");
1047 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1047 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1048 } 1048 }
1049 1049
1050 } // namespace test 1050 } // namespace test
1051 } // namespace ash 1051 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698