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

Side by Side Diff: ash/wm/shelf_layout_manager_unittest.cc

Issue 10857021: Prepare a bunch of ash tests for workspace2. With Workspace2 you can't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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/wm/shelf_layout_manager.h" 5 #include "ash/wm/shelf_layout_manager.h"
6 6
7 #include "ash/focus_cycler.h" 7 #include "ash/focus_cycler.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_delegate.h" 11 #include "ash/shell_delegate.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/system/tray/system_tray.h" 13 #include "ash/system/tray/system_tray.h"
14 #include "ash/test/ash_test_base.h" 14 #include "ash/test/ash_test_base.h"
15 #include "ash/wm/window_util.h"
15 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
17 #include "ui/aura/display_manager.h" 18 #include "ui/aura/display_manager.h"
18 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
19 #include "ui/aura/test/event_generator.h" 20 #include "ui/aura/test/event_generator.h"
20 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
21 #include "ui/base/animation/animation_container_element.h" 22 #include "ui/base/animation/animation_container_element.h"
22 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
23 #include "ui/compositor/layer_animator.h" 24 #include "ui/compositor/layer_animator.h"
24 #include "ui/gfx/display.h" 25 #include "ui/gfx/display.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 void UpdateAutoHideStateNow() { 59 void UpdateAutoHideStateNow() {
59 GetShelfLayoutManager()->UpdateAutoHideStateNow(); 60 GetShelfLayoutManager()->UpdateAutoHideStateNow();
60 } 61 }
61 62
62 aura::Window* CreateTestWindow() { 63 aura::Window* CreateTestWindow() {
63 aura::Window* window = new aura::Window(NULL); 64 aura::Window* window = new aura::Window(NULL);
64 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 65 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
65 window->SetType(aura::client::WINDOW_TYPE_NORMAL); 66 window->SetType(aura::client::WINDOW_TYPE_NORMAL);
66 window->Init(ui::LAYER_TEXTURED); 67 window->Init(ui::LAYER_TEXTURED);
67 aura::Window* parent = Shell::GetContainer( 68 window->SetParent(NULL);
68 Shell::GetPrimaryRootWindow(),
69 internal::kShellWindowId_DefaultContainer);
70 window->SetParent(parent);
71 return window; 69 return window;
72 } 70 }
73 71
74 private: 72 private:
75 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest); 73 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest);
76 }; 74 };
77 75
78 // Fails on Mac only. Need to be implemented. http://crbug.com/111279. 76 // Fails on Mac only. Need to be implemented. http://crbug.com/111279.
79 #if defined(OS_MACOSX) 77 #if defined(OS_MACOSX)
80 #define MAYBE_SetVisible FAILS_SetVisible 78 #define MAYBE_SetVisible FAILS_SetVisible
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 Shell* shell = Shell::GetInstance(); 431 Shell* shell = Shell::GetInstance();
434 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); 432 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
435 shelf->LayoutShelf(); 433 shelf->LayoutShelf();
436 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); 434 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT);
437 435
438 // Create a window and show it in maximized state. 436 // Create a window and show it in maximized state.
439 aura::Window* window = CreateTestWindow(); 437 aura::Window* window = CreateTestWindow();
440 window->SetBounds(gfx::Rect(0, 0, 100, 100)); 438 window->SetBounds(gfx::Rect(0, 0, 100, 100));
441 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 439 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
442 window->Show(); 440 window->Show();
441 wm::ActivateWindow(window);
443 442
444 EXPECT_FALSE(shell->GetAppListTargetVisibility()); 443 EXPECT_FALSE(shell->GetAppListTargetVisibility());
445 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); 444 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
446 445
447 // Toggle app list to show. 446 // Toggle app list to show.
448 shell->ToggleAppList(); 447 shell->ToggleAppList();
449 // The shelf's auto hide state won't be changed until the timer fires, so 448 // The shelf's auto hide state won't be changed until the timer fires, so
450 // calling shell->UpdateShelfVisibility() is kind of manually helping it to 449 // calling shell->UpdateShelfVisibility() is kind of manually helping it to
451 // update the state. 450 // update the state.
452 shell->UpdateShelfVisibility(); 451 shell->UpdateShelfVisibility();
(...skipping 13 matching lines...) Expand all
466 Shell* shell = Shell::GetInstance(); 465 Shell* shell = Shell::GetInstance();
467 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); 466 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
468 // For shelf to be visible, app list is not open in initial state. 467 // For shelf to be visible, app list is not open in initial state.
469 shelf->LayoutShelf(); 468 shelf->LayoutShelf();
470 469
471 // Create a window and make it full screen. 470 // Create a window and make it full screen.
472 aura::Window* window = CreateTestWindow(); 471 aura::Window* window = CreateTestWindow();
473 window->SetBounds(gfx::Rect(0, 0, 100, 100)); 472 window->SetBounds(gfx::Rect(0, 0, 100, 100));
474 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 473 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
475 window->Show(); 474 window->Show();
475 wm::ActivateWindow(window);
476 476
477 // App list and shelf is not shown. 477 // App list and shelf is not shown.
478 EXPECT_FALSE(shell->GetAppListTargetVisibility()); 478 EXPECT_FALSE(shell->GetAppListTargetVisibility());
479 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 479 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
480 480
481 // Toggle app list to show. 481 // Toggle app list to show.
482 shell->ToggleAppList(); 482 shell->ToggleAppList();
483 EXPECT_TRUE(shell->GetAppListTargetVisibility()); 483 EXPECT_TRUE(shell->GetAppListTargetVisibility());
484 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 484 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
485 485
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 EXPECT_EQ(0, display.GetWorkAreaInsets().top()); 543 EXPECT_EQ(0, display.GetWorkAreaInsets().top());
544 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); 544 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
545 EXPECT_EQ(0, display.GetWorkAreaInsets().left()); 545 EXPECT_EQ(0, display.GetWorkAreaInsets().left());
546 EXPECT_EQ(display.work_area().right(), launcher_bounds.x()); 546 EXPECT_EQ(display.work_area().right(), launcher_bounds.x());
547 EXPECT_EQ(display.bounds().y(), launcher_bounds.y()); 547 EXPECT_EQ(display.bounds().y(), launcher_bounds.y());
548 EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); 548 EXPECT_EQ(display.bounds().height(), launcher_bounds.height());
549 } 549 }
550 550
551 } // namespace internal 551 } // namespace internal
552 } // namespace ash 552 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/frame_painter_unittest.cc ('k') | ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698