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

Side by Side Diff: ash/shell_unittest.cc

Issue 11017079: Remove Shell::shelf()|status_area_widget()|launcher() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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
« no previous file with comments | « ash/shell/window_watcher.cc ('k') | ash/system/ime/tray_ime.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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/launcher/launcher.h" 12 #include "ash/launcher/launcher.h"
13 #include "ash/root_window_controller.h"
13 #include "ash/shell_delegate.h" 14 #include "ash/shell_delegate.h"
14 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
15 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
16 #include "ash/wm/root_window_layout_manager.h" 17 #include "ash/wm/root_window_layout_manager.h"
17 #include "ash/wm/shelf_layout_manager.h" 18 #include "ash/wm/shelf_layout_manager.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
19 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/root_window.h" 21 #include "ui/aura/root_window.h"
21 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
22 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 #else 271 #else
271 #define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics 272 #define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics
272 #endif 273 #endif
273 TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) { 274 TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
274 Shell* shell = Shell::GetInstance(); 275 Shell* shell = Shell::GetInstance();
275 Shell::TestApi test_api(shell); 276 Shell::TestApi test_api(shell);
276 277
277 // We start with the usual window containers. 278 // We start with the usual window containers.
278 ExpectAllContainers(); 279 ExpectAllContainers();
279 // Launcher is visible. 280 // Launcher is visible.
280 views::Widget* launcher_widget = shell->launcher()->widget(); 281 views::Widget* launcher_widget = Launcher::ForPrimaryDisplay()->widget();
281 EXPECT_TRUE(launcher_widget->IsVisible()); 282 EXPECT_TRUE(launcher_widget->IsVisible());
282 // Launcher is at bottom-left of screen. 283 // Launcher is at bottom-left of screen.
283 EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); 284 EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x());
284 EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(), 285 EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(),
285 launcher_widget->GetWindowBoundsInScreen().bottom()); 286 launcher_widget->GetWindowBoundsInScreen().bottom());
286 // We have a desktop background but not a bare layer. 287 // We have a desktop background but not a bare layer.
287 // TODO (antrim): enable once we find out why it fails component build. 288 // TODO (antrim): enable once we find out why it fails component build.
288 // internal::DesktopBackgroundWidgetController* background = 289 // internal::DesktopBackgroundWidgetController* background =
289 // Shell::GetPrimaryRootWindow()-> 290 // Shell::GetPrimaryRootWindow()->
290 // GetProperty(internal::kWindowDesktopComponent); 291 // GetProperty(internal::kWindowDesktopComponent);
(...skipping 18 matching lines...) Expand all
309 310
310 // Create a normal window. It is not maximized. 311 // Create a normal window. It is not maximized.
311 views::Widget::InitParams widget_params( 312 views::Widget::InitParams widget_params(
312 views::Widget::InitParams::TYPE_WINDOW); 313 views::Widget::InitParams::TYPE_WINDOW);
313 widget_params.bounds.SetRect(11, 22, 300, 400); 314 widget_params.bounds.SetRect(11, 22, 300, 400);
314 views::Widget* widget = CreateTestWindow(widget_params); 315 views::Widget* widget = CreateTestWindow(widget_params);
315 widget->Show(); 316 widget->Show();
316 EXPECT_FALSE(widget->IsMaximized()); 317 EXPECT_FALSE(widget->IsMaximized());
317 318
318 // Shelf defaults to visible. 319 // Shelf defaults to visible.
319 EXPECT_EQ(internal::ShelfLayoutManager::VISIBLE, 320 EXPECT_EQ(
320 Shell::GetInstance()->shelf()->visibility_state()); 321 internal::ShelfLayoutManager::VISIBLE,
322 Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
321 323
322 // Fullscreen window hides it. 324 // Fullscreen window hides it.
323 widget->SetFullscreen(true); 325 widget->SetFullscreen(true);
324 EXPECT_EQ(internal::ShelfLayoutManager::HIDDEN, 326 EXPECT_EQ(
325 Shell::GetInstance()->shelf()->visibility_state()); 327 internal::ShelfLayoutManager::HIDDEN,
328 Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
326 329
327 // Restoring the window restores it. 330 // Restoring the window restores it.
328 widget->Restore(); 331 widget->Restore();
329 EXPECT_EQ(internal::ShelfLayoutManager::VISIBLE, 332 EXPECT_EQ(
330 Shell::GetInstance()->shelf()->visibility_state()); 333 internal::ShelfLayoutManager::VISIBLE,
334 Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
331 335
332 // Clean up. 336 // Clean up.
333 widget->Close(); 337 widget->Close();
334 } 338 }
335 339
336 namespace { 340 namespace {
337 341
338 // Builds the list of parents from |window| to the root. The returned vector is 342 // Builds the list of parents from |window| to the root. The returned vector is
339 // in reverse order (|window| is first). 343 // in reverse order (|window| is first).
340 std::vector<aura::Window*> BuildPathToRoot(aura::Window* window) { 344 std::vector<aura::Window*> BuildPathToRoot(aura::Window* window) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 private: 409 private:
406 DISALLOW_COPY_AND_ASSIGN(ShellTest2); 410 DISALLOW_COPY_AND_ASSIGN(ShellTest2);
407 }; 411 };
408 412
409 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { 413 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) {
410 window_.reset(new aura::Window(NULL)); 414 window_.reset(new aura::Window(NULL));
411 window_->Init(ui::LAYER_NOT_DRAWN); 415 window_->Init(ui::LAYER_NOT_DRAWN);
412 } 416 }
413 417
414 } // namespace ash 418 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/window_watcher.cc ('k') | ash/system/ime/tray_ime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698