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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 1827323002: Take screenshot of active window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 EXPECT_TRUE(ProcessInController( 851 EXPECT_TRUE(ProcessInController(
852 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); 852 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN)));
853 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); 853 EXPECT_EQ(1, delegate->handle_take_screenshot_count());
854 EXPECT_TRUE( 854 EXPECT_TRUE(
855 ProcessInController(ui::Accelerator( 855 ProcessInController(ui::Accelerator(
856 ui::VKEY_PRINT, ui::EF_NONE))); 856 ui::VKEY_PRINT, ui::EF_NONE)));
857 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); 857 EXPECT_EQ(2, delegate->handle_take_screenshot_count());
858 EXPECT_TRUE(ProcessInController(ui::Accelerator( 858 EXPECT_TRUE(ProcessInController(ui::Accelerator(
859 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); 859 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN)));
860 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); 860 EXPECT_EQ(2, delegate->handle_take_screenshot_count());
861 // None active window test case.
862 EXPECT_TRUE(ProcessInController(ui::Accelerator(
863 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN)));
864 EXPECT_EQ(0, delegate->handle_take_window_screenshot_count());
865 // Active window test case.
866 std::unique_ptr<aura::Window> window;
867 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
868 wm::ActivateWindow(window.get());
869 EXPECT_TRUE(ProcessInController(ui::Accelerator(
870 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN)));
871 EXPECT_EQ(1, delegate->handle_take_window_screenshot_count());
861 } 872 }
862 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); 873 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE);
863 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); 874 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE);
864 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); 875 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE);
865 { 876 {
866 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; 877 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate;
867 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( 878 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate(
868 std::unique_ptr<VolumeControlDelegate>(delegate)); 879 std::unique_ptr<VolumeControlDelegate>(delegate));
869 EXPECT_EQ(0, delegate->handle_volume_mute_count()); 880 EXPECT_EQ(0, delegate->handle_volume_mute_count());
870 EXPECT_TRUE(ProcessInController(volume_mute)); 881 EXPECT_TRUE(ProcessInController(volume_mute));
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 EXPECT_TRUE(IsMessageCenterEmpty()); 1587 EXPECT_TRUE(IsMessageCenterEmpty());
1577 1588
1578 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1589 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1579 // screen before we proceed testing the rest of accelerators. 1590 // screen before we proceed testing the rest of accelerators.
1580 ResetStateIfNeeded(); 1591 ResetStateIfNeeded();
1581 } 1592 }
1582 } 1593 }
1583 #endif // defined(OS_CHROMEOS) 1594 #endif // defined(OS_CHROMEOS)
1584 1595
1585 } // namespace ash 1596 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698