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

Side by Side Diff: ash/shell_unittest.cc

Issue 2318223003: mash: Migrate wallpaper controllers to ash/common. (Closed)
Patch Set: Fix nit. 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/shell.cc ('k') | ash/sysui/wallpaper_delegate_mus.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/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
11 #include "ash/common/session/session_state_delegate.h" 11 #include "ash/common/session/session_state_delegate.h"
12 #include "ash/common/shelf/shelf_layout_manager.h" 12 #include "ash/common/shelf/shelf_layout_manager.h"
13 #include "ash/common/shelf/shelf_widget.h" 13 #include "ash/common/shelf/shelf_widget.h"
14 #include "ash/common/shelf/wm_shelf.h" 14 #include "ash/common/shelf/wm_shelf.h"
15 #include "ash/common/shell_window_ids.h" 15 #include "ash/common/shell_window_ids.h"
16 #include "ash/common/wallpaper/wallpaper_widget_controller.h"
17 #include "ash/common/wm_root_window_controller.h"
16 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
19 #include "ash/common/wm_window.h"
17 #include "ash/display/mouse_cursor_event_filter.h" 20 #include "ash/display/mouse_cursor_event_filter.h"
18 #include "ash/drag_drop/drag_drop_controller.h" 21 #include "ash/drag_drop/drag_drop_controller.h"
19 #include "ash/root_window_controller.h" 22 #include "ash/root_window_controller.h"
20 #include "ash/test/ash_test_base.h" 23 #include "ash/test/ash_test_base.h"
21 #include "ash/test/shell_test_api.h" 24 #include "ash/test/shell_test_api.h"
22 #include "ash/wallpaper/wallpaper_widget_controller.h"
23 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
24 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
25 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
26 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
27 #include "ui/aura/env.h" 29 #include "ui/aura/env.h"
28 #include "ui/aura/window.h" 30 #include "ui/aura/window.h"
29 #include "ui/aura/window_event_dispatcher.h" 31 #include "ui/aura/window_event_dispatcher.h"
30 #include "ui/base/models/simple_menu_model.h" 32 #include "ui/base/models/simple_menu_model.h"
31 #include "ui/events/test/event_generator.h" 33 #include "ui/events/test/event_generator.h"
32 #include "ui/events/test/events_test_utils.h" 34 #include "ui/events/test/events_test_utils.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EXPECT_TRUE(delegate->IsScreenLocked()); 341 EXPECT_TRUE(delegate->IsScreenLocked());
340 delegate->UnlockScreen(); 342 delegate->UnlockScreen();
341 EXPECT_FALSE(delegate->IsScreenLocked()); 343 EXPECT_FALSE(delegate->IsScreenLocked());
342 } 344 }
343 345
344 TEST_F(ShellTest, LockScreenClosesActiveMenu) { 346 TEST_F(ShellTest, LockScreenClosesActiveMenu) {
345 SimpleMenuDelegate menu_delegate; 347 SimpleMenuDelegate menu_delegate;
346 std::unique_ptr<ui::SimpleMenuModel> menu_model( 348 std::unique_ptr<ui::SimpleMenuModel> menu_model(
347 new ui::SimpleMenuModel(&menu_delegate)); 349 new ui::SimpleMenuModel(&menu_delegate));
348 menu_model->AddItem(0, base::ASCIIToUTF16("Menu item")); 350 menu_model->AddItem(0, base::ASCIIToUTF16("Menu item"));
349 views::Widget* widget = Shell::GetPrimaryRootWindowController() 351 views::Widget* widget = WmShell::Get()
352 ->GetPrimaryRootWindow()
353 ->GetRootWindowController()
350 ->wallpaper_widget_controller() 354 ->wallpaper_widget_controller()
351 ->widget(); 355 ->widget();
352 std::unique_ptr<views::MenuRunner> menu_runner( 356 std::unique_ptr<views::MenuRunner> menu_runner(
353 new views::MenuRunner(menu_model.get(), views::MenuRunner::CONTEXT_MENU)); 357 new views::MenuRunner(menu_model.get(), views::MenuRunner::CONTEXT_MENU));
354 358
355 // When MenuRunner runs a nested loop the LockScreenAndVerifyMenuClosed 359 // When MenuRunner runs a nested loop the LockScreenAndVerifyMenuClosed
356 // command will fire, check the menu state and ensure the nested menu loop 360 // command will fire, check the menu state and ensure the nested menu loop
357 // is exited so that the test will terminate. 361 // is exited so that the test will terminate.
358 base::ThreadTaskRunnerHandle::Get()->PostTask( 362 base::ThreadTaskRunnerHandle::Get()->PostTask(
359 FROM_HERE, base::Bind(&ShellTest::LockScreenAndVerifyMenuClosed, 363 FROM_HERE, base::Bind(&ShellTest::LockScreenAndVerifyMenuClosed,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 private: 508 private:
505 DISALLOW_COPY_AND_ASSIGN(ShellTest2); 509 DISALLOW_COPY_AND_ASSIGN(ShellTest2);
506 }; 510 };
507 511
508 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { 512 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) {
509 window_.reset(new aura::Window(NULL)); 513 window_.reset(new aura::Window(NULL));
510 window_->Init(ui::LAYER_NOT_DRAWN); 514 window_->Init(ui::LAYER_NOT_DRAWN);
511 } 515 }
512 516
513 } // namespace ash 517 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/sysui/wallpaper_delegate_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698