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/display/mouse_cursor_event_filter.h" | 10 #include "ash/display/mouse_cursor_event_filter.h" |
11 #include "ash/drag_drop/drag_drop_controller.h" | 11 #include "ash/drag_drop/drag_drop_controller.h" |
| 12 #include "ash/public/cpp/config.h" |
12 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
13 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
14 #include "ash/session/session_controller.h" | 15 #include "ash/session/session_controller.h" |
15 #include "ash/shelf/shelf_layout_manager.h" | 16 #include "ash/shelf/shelf_layout_manager.h" |
16 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
17 #include "ash/shelf/wm_shelf.h" | 18 #include "ash/shelf/wm_shelf.h" |
18 #include "ash/shell_port.h" | 19 #include "ash/shell_port.h" |
19 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
20 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
21 #include "ash/test/test_session_controller_client.h" | 22 #include "ash/test/test_session_controller_client.h" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 457 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
457 | 458 |
458 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 459 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
459 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 460 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
460 } | 461 } |
461 | 462 |
462 // Tests that the cursor-filter is ahead of the drag-drop controller in the | 463 // Tests that the cursor-filter is ahead of the drag-drop controller in the |
463 // pre-target list. | 464 // pre-target list. |
464 TEST_F(ShellTest, TestPreTargetHandlerOrder) { | 465 TEST_F(ShellTest, TestPreTargetHandlerOrder) { |
465 // TODO: investigate failure in mash, http://crbug.com/695758. | 466 // TODO: investigate failure in mash, http://crbug.com/695758. |
466 if (ShellPort::Get()->IsRunningInMash()) | 467 if (Shell::GetAshConfig() == Config::MASH) |
467 return; | 468 return; |
468 | 469 |
469 Shell* shell = Shell::Get(); | 470 Shell* shell = Shell::Get(); |
470 ui::EventTargetTestApi test_api(shell); | 471 ui::EventTargetTestApi test_api(shell); |
471 test::ShellTestApi shell_test_api(shell); | 472 test::ShellTestApi shell_test_api(shell); |
472 | 473 |
473 const ui::EventHandlerList& handlers = test_api.pre_target_handlers(); | 474 const ui::EventHandlerList& handlers = test_api.pre_target_handlers(); |
474 ui::EventHandlerList::const_iterator cursor_filter = | 475 ui::EventHandlerList::const_iterator cursor_filter = |
475 std::find(handlers.begin(), handlers.end(), shell->mouse_cursor_filter()); | 476 std::find(handlers.begin(), handlers.end(), shell->mouse_cursor_filter()); |
476 ui::EventHandlerList::const_iterator drag_drop = std::find( | 477 ui::EventHandlerList::const_iterator drag_drop = std::find( |
(...skipping 30 matching lines...) Expand all Loading... |
507 | 508 |
508 private: | 509 private: |
509 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 510 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
510 }; | 511 }; |
511 | 512 |
512 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 513 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
513 // TODO: delete this test when conversion to mash is done. This test isn't | 514 // TODO: delete this test when conversion to mash is done. This test isn't |
514 // applicable to mash as all windows must be destroyed before ash, that isn't | 515 // applicable to mash as all windows must be destroyed before ash, that isn't |
515 // the case with classic-ash where embedders can separately create | 516 // the case with classic-ash where embedders can separately create |
516 // aura::Windows. | 517 // aura::Windows. |
517 if (ShellPort::Get()->IsRunningInMash()) | 518 if (Shell::GetAshConfig() == Config::MASH) |
518 return; | 519 return; |
519 | 520 |
520 window_.reset(new aura::Window(NULL)); | 521 window_.reset(new aura::Window(NULL)); |
521 window_->Init(ui::LAYER_NOT_DRAWN); | 522 window_->Init(ui::LAYER_NOT_DRAWN); |
522 } | 523 } |
523 | 524 |
524 } // namespace ash | 525 } // namespace ash |
OLD | NEW |