Chromium Code Reviews| 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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 #include "ash/accelerators/accelerator_table.h" | 6 #include "ash/accelerators/accelerator_table.h" |
| 7 #include "ash/caps_lock_delegate.h" | 7 #include "ash/caps_lock_delegate.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/ime_control_delegate.h" | 9 #include "ash/ime_control_delegate.h" |
| 10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 } | 494 } |
| 495 | 495 |
| 496 TEST_F(AcceleratorControllerTest, WindowSnap) { | 496 TEST_F(AcceleratorControllerTest, WindowSnap) { |
| 497 scoped_ptr<aura::Window> window( | 497 scoped_ptr<aura::Window> window( |
| 498 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 498 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 499 const ui::Accelerator dummy; | 499 const ui::Accelerator dummy; |
| 500 | 500 |
| 501 wm::ActivateWindow(window.get()); | 501 wm::ActivateWindow(window.get()); |
| 502 | 502 |
| 503 { | 503 { |
| 504 gfx::Rect window_bounds = window->bounds(); | |
| 504 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | 505 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); |
| 505 gfx::Rect snap_left = window->bounds(); | 506 EXPECT_NE(window->bounds().ToString(), window_bounds.ToString()); |
|
Mr4D (OOO till 08-26)
2013/08/29 01:03:15
Could you do some more tests towards the result (e
| |
| 506 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | 507 window_bounds = window->bounds(); |
| 507 EXPECT_NE(window->bounds().ToString(), snap_left.ToString()); | |
| 508 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | |
| 509 EXPECT_NE(window->bounds().ToString(), snap_left.ToString()); | |
| 510 | |
| 511 // It should cycle back to the first snapped position. | |
| 512 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | |
| 513 EXPECT_EQ(window->bounds().ToString(), snap_left.ToString()); | |
| 514 } | |
| 515 { | |
| 516 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | 508 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); |
| 517 gfx::Rect snap_right = window->bounds(); | 509 EXPECT_NE(window->bounds().ToString(), window_bounds.ToString()); |
|
Mr4D (OOO till 08-26)
2013/08/29 01:03:15
Same here.
| |
| 518 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | |
| 519 EXPECT_NE(window->bounds().ToString(), snap_right.ToString()); | |
| 520 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | |
| 521 EXPECT_NE(window->bounds().ToString(), snap_right.ToString()); | |
| 522 | |
| 523 // It should cycle back to the first snapped position. | |
| 524 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | |
| 525 EXPECT_EQ(window->bounds().ToString(), snap_right.ToString()); | |
| 526 } | 510 } |
| 527 { | 511 { |
| 528 gfx::Rect normal_bounds = window->bounds(); | 512 gfx::Rect normal_bounds = window->bounds(); |
| 529 | 513 |
| 530 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 514 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 531 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); | 515 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); |
| 532 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); | 516 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); |
| 533 | 517 |
| 534 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 518 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 535 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); | 519 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 EXPECT_EQ(volume_down, delegate->last_accelerator()); | 1318 EXPECT_EQ(volume_down, delegate->last_accelerator()); |
| 1335 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 1319 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
| 1336 EXPECT_TRUE(ProcessWithContext(volume_up)); | 1320 EXPECT_TRUE(ProcessWithContext(volume_up)); |
| 1337 EXPECT_EQ(1, delegate->handle_volume_up_count()); | 1321 EXPECT_EQ(1, delegate->handle_volume_up_count()); |
| 1338 EXPECT_EQ(volume_up, delegate->last_accelerator()); | 1322 EXPECT_EQ(volume_up, delegate->last_accelerator()); |
| 1339 } | 1323 } |
| 1340 } | 1324 } |
| 1341 #endif | 1325 #endif |
| 1342 | 1326 |
| 1343 } // namespace ash | 1327 } // namespace ash |
| OLD | NEW |