| OLD | NEW |
| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/test/shell_test_api.h" | 22 #include "ash/test/shell_test_api.h" |
| 23 #include "ash/wm/root_window_layout_manager.h" | 23 #include "ash/wm/root_window_layout_manager.h" |
| 24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
| 27 #include "ui/aura/env.h" | 27 #include "ui/aura/env.h" |
| 28 #include "ui/aura/test/event_generator.h" | 28 #include "ui/aura/test/event_generator.h" |
| 29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 31 #include "ui/base/models/simple_menu_model.h" | 31 #include "ui/base/models/simple_menu_model.h" |
| 32 #include "ui/events/platform/platform_event_source.h" |
| 32 #include "ui/events/test/events_test_utils.h" | 33 #include "ui/events/test/events_test_utils.h" |
| 33 #include "ui/events/test/test_event_handler.h" | 34 #include "ui/events/test/test_event_handler.h" |
| 34 #include "ui/gfx/size.h" | 35 #include "ui/gfx/size.h" |
| 35 #include "ui/views/controls/menu/menu_controller.h" | 36 #include "ui/views/controls/menu/menu_controller.h" |
| 36 #include "ui/views/controls/menu/menu_runner.h" | 37 #include "ui/views/controls/menu/menu_runner.h" |
| 37 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 38 #include "ui/views/widget/widget_delegate.h" | 39 #include "ui/views/widget/widget_delegate.h" |
| 39 #include "ui/views/window/dialog_delegate.h" | 40 #include "ui/views/window/dialog_delegate.h" |
| 40 | 41 |
| 41 using aura::RootWindow; | 42 using aura::RootWindow; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 TEST_F(ShellTest, IsScreenLocked) { | 368 TEST_F(ShellTest, IsScreenLocked) { |
| 368 SessionStateDelegate* delegate = | 369 SessionStateDelegate* delegate = |
| 369 Shell::GetInstance()->session_state_delegate(); | 370 Shell::GetInstance()->session_state_delegate(); |
| 370 delegate->LockScreen(); | 371 delegate->LockScreen(); |
| 371 EXPECT_TRUE(delegate->IsScreenLocked()); | 372 EXPECT_TRUE(delegate->IsScreenLocked()); |
| 372 delegate->UnlockScreen(); | 373 delegate->UnlockScreen(); |
| 373 EXPECT_FALSE(delegate->IsScreenLocked()); | 374 EXPECT_FALSE(delegate->IsScreenLocked()); |
| 374 } | 375 } |
| 375 | 376 |
| 376 TEST_F(ShellTest, LockScreenClosesActiveMenu) { | 377 TEST_F(ShellTest, LockScreenClosesActiveMenu) { |
| 378 scoped_ptr<ui::PlatformEventSource> event_source( |
| 379 ui::PlatformEventSource::CreateDefault()); |
| 377 SimpleMenuDelegate menu_delegate; | 380 SimpleMenuDelegate menu_delegate; |
| 378 scoped_ptr<ui::SimpleMenuModel> menu_model( | 381 scoped_ptr<ui::SimpleMenuModel> menu_model( |
| 379 new ui::SimpleMenuModel(&menu_delegate)); | 382 new ui::SimpleMenuModel(&menu_delegate)); |
| 380 menu_model->AddItem(0, base::ASCIIToUTF16("Menu item")); | 383 menu_model->AddItem(0, base::ASCIIToUTF16("Menu item")); |
| 381 views::Widget* widget = ash::Shell::GetPrimaryRootWindowController()-> | 384 views::Widget* widget = ash::Shell::GetPrimaryRootWindowController()-> |
| 382 wallpaper_controller()->widget(); | 385 wallpaper_controller()->widget(); |
| 383 scoped_ptr<views::MenuRunner> menu_runner( | 386 scoped_ptr<views::MenuRunner> menu_runner( |
| 384 new views::MenuRunner(menu_model.get())); | 387 new views::MenuRunner(menu_model.get())); |
| 385 | 388 |
| 386 // When MenuRunner runs a nested loop the LockScreenAndVerifyMenuClosed | 389 // When MenuRunner runs a nested loop the LockScreenAndVerifyMenuClosed |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 private: | 545 private: |
| 543 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 546 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
| 544 }; | 547 }; |
| 545 | 548 |
| 546 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 549 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
| 547 window_.reset(new aura::Window(NULL)); | 550 window_.reset(new aura::Window(NULL)); |
| 548 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 551 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
| 549 } | 552 } |
| 550 | 553 |
| 551 } // namespace ash | 554 } // namespace ash |
| OLD | NEW |