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 #include "ash/shell_window_ids.h" | 6 #include "ash/shell_window_ids.h" |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "ash/test/test_activation_delegate.h" | 8 #include "ash/test/test_activation_delegate.h" |
9 #include "ash/wm/activation_controller.h" | 9 #include "ash/wm/activation_controller.h" |
10 #include "ash/wm/cursor_manager.h" | 10 #include "ash/wm/cursor_manager.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 EXPECT_EQ(0, d2.activated_count()); | 359 EXPECT_EQ(0, d2.activated_count()); |
360 EXPECT_EQ(0, d2.lost_active_count()); | 360 EXPECT_EQ(0, d2.lost_active_count()); |
361 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 361 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
362 EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow()); | 362 EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow()); |
363 EXPECT_EQ(1, d1.activated_count()); | 363 EXPECT_EQ(1, d1.activated_count()); |
364 EXPECT_EQ(0, d1.lost_active_count()); | 364 EXPECT_EQ(0, d1.lost_active_count()); |
365 } | 365 } |
366 | 366 |
367 TEST_F(WindowManagerTest, MouseEventCursors) { | 367 TEST_F(WindowManagerTest, MouseEventCursors) { |
368 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 368 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); |
369 // Disable ash grid so that test can place a window at | |
370 // specific location. | |
371 ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); | |
372 | 369 |
373 // Create a window. | 370 // Create a window. |
374 const int kWindowLeft = 123; | 371 const int kWindowLeft = 123; |
375 const int kWindowTop = 45; | 372 const int kWindowTop = 45; |
376 HitTestWindowDelegate window_delegate; | 373 HitTestWindowDelegate window_delegate; |
377 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( | 374 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( |
378 &window_delegate, | 375 &window_delegate, |
379 -1, | 376 -1, |
380 gfx::Rect(kWindowLeft, kWindowTop, 640, 480), | 377 gfx::Rect(kWindowLeft, kWindowTop, 640, 480), |
381 NULL)); | 378 NULL)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 EXPECT_EQ(ui::kCursorNull, root_window->last_cursor().native_type()); | 456 EXPECT_EQ(ui::kCursorNull, root_window->last_cursor().native_type()); |
460 } | 457 } |
461 } | 458 } |
462 | 459 |
463 #if defined(OS_MACOSX) | 460 #if defined(OS_MACOSX) |
464 #define MAYBE_TransformActivate FAILS_TransformActivate | 461 #define MAYBE_TransformActivate FAILS_TransformActivate |
465 #else | 462 #else |
466 #define MAYBE_TransformActivate TransformActivate | 463 #define MAYBE_TransformActivate TransformActivate |
467 #endif | 464 #endif |
468 TEST_F(WindowManagerTest, MAYBE_TransformActivate) { | 465 TEST_F(WindowManagerTest, MAYBE_TransformActivate) { |
469 // Disable ash grid so that test can place a window at | |
470 // specific location. | |
471 ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); | |
472 | |
473 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 466 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); |
474 gfx::Size size = root_window->bounds().size(); | 467 gfx::Size size = root_window->bounds().size(); |
475 EXPECT_EQ( | 468 EXPECT_EQ( |
476 gfx::Rect(size).ToString(), | 469 gfx::Rect(size).ToString(), |
477 gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds().ToString()); | 470 gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds().ToString()); |
478 | 471 |
479 // Rotate it clock-wise 90 degrees. | 472 // Rotate it clock-wise 90 degrees. |
480 ui::Transform transform; | 473 ui::Transform transform; |
481 transform.SetRotate(90.0f); | 474 transform.SetRotate(90.0f); |
482 transform.ConcatTranslate(size.width(), 0); | 475 transform.ConcatTranslate(size.width(), 0); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 env_filter->set_update_cursor_visibility(false); | 613 env_filter->set_update_cursor_visibility(false); |
621 cursor_manager->ShowCursor(false); | 614 cursor_manager->ShowCursor(false); |
622 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); | 615 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); |
623 EXPECT_FALSE(cursor_manager->cursor_visible()); | 616 EXPECT_FALSE(cursor_manager->cursor_visible()); |
624 cursor_manager->ShowCursor(true); | 617 cursor_manager->ShowCursor(true); |
625 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); | 618 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); |
626 EXPECT_TRUE(cursor_manager->cursor_visible()); | 619 EXPECT_TRUE(cursor_manager->cursor_visible()); |
627 } | 620 } |
628 | 621 |
629 } // namespace ash | 622 } // namespace ash |
OLD | NEW |