| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/screenshot_controller.h" | 5 #include "ash/utility/screenshot_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/cursor_window_controller.h" | 7 #include "ash/display/cursor_window_controller.h" |
| 8 #include "ash/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
| 9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(499, 11))); | 268 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(499, 11))); |
| 269 EXPECT_EQ(gfx::Point(499, 11), | 269 EXPECT_EQ(gfx::Point(499, 11), |
| 270 aura::Env::GetInstance()->last_mouse_location()); | 270 aura::Env::GetInstance()->last_mouse_location()); |
| 271 | 271 |
| 272 Cancel(); | 272 Cancel(); |
| 273 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 11))); | 273 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 11))); |
| 274 EXPECT_EQ(gfx::Point(501, 11), | 274 EXPECT_EQ(gfx::Point(501, 11), |
| 275 aura::Env::GetInstance()->last_mouse_location()); | 275 aura::Env::GetInstance()->last_mouse_location()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 #if defined(OS_CHROMEOS) | |
| 279 TEST_F(PartialScreenshotControllerTest, VisibilityTest) { | 278 TEST_F(PartialScreenshotControllerTest, VisibilityTest) { |
| 280 aura::client::CursorClient* client = Shell::GetInstance()->cursor_manager(); | 279 aura::client::CursorClient* client = Shell::GetInstance()->cursor_manager(); |
| 281 | 280 |
| 282 GetEventGenerator().PressKey(ui::VKEY_A, 0); | 281 GetEventGenerator().PressKey(ui::VKEY_A, 0); |
| 283 GetEventGenerator().ReleaseKey(ui::VKEY_A, 0); | 282 GetEventGenerator().ReleaseKey(ui::VKEY_A, 0); |
| 284 | 283 |
| 285 EXPECT_FALSE(client->IsCursorVisible()); | 284 EXPECT_FALSE(client->IsCursorVisible()); |
| 286 | 285 |
| 287 StartPartialScreenshotSession(); | 286 StartPartialScreenshotSession(); |
| 288 EXPECT_TRUE(IsActive()); | 287 EXPECT_TRUE(IsActive()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 event_generator.MoveMouseTo(cursor_location); | 326 event_generator.MoveMouseTo(cursor_location); |
| 328 EXPECT_EQ(cursor_location, test_api.GetCursorLocation()); | 327 EXPECT_EQ(cursor_location, test_api.GetCursorLocation()); |
| 329 | 328 |
| 330 event_generator.ReleaseLeftButton(); | 329 event_generator.ReleaseLeftButton(); |
| 331 | 330 |
| 332 EXPECT_EQ(1, GetScreenshotDelegate()->handle_take_partial_screenshot_count()); | 331 EXPECT_EQ(1, GetScreenshotDelegate()->handle_take_partial_screenshot_count()); |
| 333 EXPECT_EQ(gfx::Rect(1, 1, 5, 5), GetScreenshotDelegate()->last_rect()); | 332 EXPECT_EQ(gfx::Rect(1, 1, 5, 5), GetScreenshotDelegate()->last_rect()); |
| 334 RunAllPendingInMessageLoop(); | 333 RunAllPendingInMessageLoop(); |
| 335 EXPECT_FALSE(IsActive()); | 334 EXPECT_FALSE(IsActive()); |
| 336 } | 335 } |
| 337 #endif | |
| 338 | 336 |
| 339 TEST_F(WindowScreenshotControllerTest, KeyboardOperation) { | 337 TEST_F(WindowScreenshotControllerTest, KeyboardOperation) { |
| 340 ui::test::EventGenerator& generator(GetEventGenerator()); | 338 ui::test::EventGenerator& generator(GetEventGenerator()); |
| 341 test::TestScreenshotDelegate* test_delegate = GetScreenshotDelegate(); | 339 test::TestScreenshotDelegate* test_delegate = GetScreenshotDelegate(); |
| 342 | 340 |
| 343 StartWindowScreenshotSession(); | 341 StartWindowScreenshotSession(); |
| 344 generator.PressKey(ui::VKEY_ESCAPE, 0); | 342 generator.PressKey(ui::VKEY_ESCAPE, 0); |
| 345 generator.ReleaseKey(ui::VKEY_ESCAPE, 0); | 343 generator.ReleaseKey(ui::VKEY_ESCAPE, 0); |
| 346 EXPECT_FALSE(IsActive()); | 344 EXPECT_FALSE(IsActive()); |
| 347 EXPECT_FALSE(test_delegate->GetSelectedWindowAndReset()); | 345 EXPECT_FALSE(test_delegate->GetSelectedWindowAndReset()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 CreateSelectableWindow(gfx::Rect(100, 100, 100, 100))); | 485 CreateSelectableWindow(gfx::Rect(100, 100, 100, 100))); |
| 488 window->SetCapture(); | 486 window->SetCapture(); |
| 489 EXPECT_TRUE(window->HasCapture()); | 487 EXPECT_TRUE(window->HasCapture()); |
| 490 StartWindowScreenshotSession(); | 488 StartWindowScreenshotSession(); |
| 491 EXPECT_TRUE(window->HasCapture()); | 489 EXPECT_TRUE(window->HasCapture()); |
| 492 Cancel(); | 490 Cancel(); |
| 493 EXPECT_FALSE(window->HasCapture()); | 491 EXPECT_FALSE(window->HasCapture()); |
| 494 } | 492 } |
| 495 | 493 |
| 496 } // namespace ash | 494 } // namespace ash |
| OLD | NEW |