diff options
author | jamescook <jamescook@chromium.org> | 2015-03-25 10:19:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 17:19:53 +0000 |
commit | 531e5de190fbba5fda62175101e14ace7038c7da (patch) | |
tree | 6192fc93adf25afc580ec397eaa173c870b6aad4 /ash | |
parent | ab68be76b53c10e7aac00e0ed6f2018c72e6af88 (diff) | |
download | chromium_src-531e5de190fbba5fda62175101e14ace7038c7da.zip chromium_src-531e5de190fbba5fda62175101e14ace7038c7da.tar.gz chromium_src-531e5de190fbba5fda62175101e14ace7038c7da.tar.bz2 |
Revert of Test Accelerators In Interactive UI Tests (patchset #5 id:80001 of https://codereview.chromium.org/1026513005/)
Reason for revert:
AcceleratorInteractiveUITest.ChromeOsAccelerators and AcceleratorInteractiveUITest.TestNonRepeatableNeedingWindowActions are failing on the cros_trunk official builders.
http://master.chrome.corp.google.com:8011/builders/cros%20trunk/builds/31840
Original issue's description:
> Test Accelerators In Interactive UI Tests
>
> In order to avoid future regressions.
>
> BUG=469235
> TEST=interactive_ui_tests --gtest_filter=AcceleratorInteractiveUITest.*
>
> Committed: https://crrev.com/b0c1e2d572b2bda87f11007c89ecdaac6301770a
> Cr-Commit-Position: refs/heads/master@{#322076}
TBR=oshima@chromium.org,afakhry@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=469235
Review URL: https://codereview.chromium.org/1035763003
Cr-Commit-Position: refs/heads/master@{#322184}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_interactive_uitest.cc | 233 |
1 files changed, 0 insertions, 233 deletions
diff --git a/ash/accelerators/accelerator_interactive_uitest.cc b/ash/accelerators/accelerator_interactive_uitest.cc deleted file mode 100644 index 6dc8d59..0000000 --- a/ash/accelerators/accelerator_interactive_uitest.cc +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/accelerators/accelerator_controller.h" - -#include "ash/shell.h" -#include "ash/shell_observer.h" -#include "ash/system/tray/system_tray_delegate.h" -#include "ash/system/tray/system_tray_notifier.h" -#include "ash/test/ash_test_base.h" -#include "ash/test/test_screenshot_delegate.h" -#include "ash/test/test_volume_control_delegate.h" -#include "ash/wm/window_state.h" -#include "ash/wm/window_util.h" -#include "base/path_service.h" -#include "base/run_loop.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/test/ui_controls.h" -#include "ui/base/ui_base_paths.h" -#include "ui/gl/gl_surface.h" - -#if defined(OS_CHROMEOS) -#include "ash/system/chromeos/network/network_observer.h" -#include "chromeos/network/network_handler.h" -#endif // defined(OS_CHROMEOS) - -namespace ash { -namespace test { - -namespace { - -#if defined(OS_CHROMEOS) -// A network observer to watch for the toggle wifi events. -class TestNetworkObserver : public NetworkObserver { - public: - TestNetworkObserver() : wifi_enabled_status_(false) {} - - // ash::NetworkObserver: - void RequestToggleWifi() override { - wifi_enabled_status_ = !wifi_enabled_status_; - } - - bool wifi_enabled_status() const { return wifi_enabled_status_; } - - private: - bool wifi_enabled_status_; - - DISALLOW_COPY_AND_ASSIGN(TestNetworkObserver); -}; -#endif // defined(OS_CHROMEOS) - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// - -// This is intended to test few samples from each category of accelerators to -// make sure they work properly. The test is done as an interactive ui test -// using ui_controls::Send*() functions. -// This is to catch any future regressions (crbug.com/469235). -class AcceleratorInteractiveUITest : public AshTestBase, public ShellObserver { - public: - AcceleratorInteractiveUITest() : is_in_overview_mode_(false) {} - - void SetUp() override { - gfx::GLSurface::InitializeOneOffForTests(); - - ui::RegisterPathProvider(); - ui::ResourceBundle::InitSharedInstanceWithLocale( - "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); - base::FilePath resources_pack_path; - PathService::Get(base::DIR_MODULE, &resources_pack_path); - resources_pack_path = - resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( - resources_pack_path, ui::SCALE_FACTOR_NONE); - - AshTestBase::SetUp(); - - Shell::GetInstance()->AddShellObserver(this); - -#if defined(OS_CHROMEOS) - chromeos::NetworkHandler::Initialize(); -#endif // defined(OS_CHROMEOS) - } - - void TearDown() override { - Shell::GetInstance()->RemoveShellObserver(this); - -#if defined(OS_CHROMEOS) - chromeos::NetworkHandler::Shutdown(); -#endif // defined(OS_CHROMEOS) - - AshTestBase::TearDown(); - } - - // Sends a key press event and waits synchronously until it's completely - // processed. - void SendKeyPressSync(ui::KeyboardCode key, - bool control, - bool shift, - bool alt) { - base::RunLoop loop; - ui_controls::SendKeyPressNotifyWhenDone(root_window(), key, control, shift, - alt, false, loop.QuitClosure()); - loop.Run(); - } - - // ash::ShellObserver: - void OnOverviewModeStarting() override { is_in_overview_mode_ = true; } - void OnOverviewModeEnded() override { is_in_overview_mode_ = false; } - - Shell* shell() const { return Shell::GetInstance(); } - aura::Window* root_window() const { return Shell::GetPrimaryRootWindow(); } - - protected: - bool is_in_overview_mode_; - - private: - DISALLOW_COPY_AND_ASSIGN(AcceleratorInteractiveUITest); -}; - -//////////////////////////////////////////////////////////////////////////////// - -#if !defined(OS_CHROMEOS) -#define MAYBE_TestNonRepeatableNeedingWindowActions \ - DISABLED_TestNonRepeatableNeedingWindowActions -#define MAYBE_ToggleAppList DISABLED_ToggleAppList -#else -#define MAYBE_TestNonRepeatableNeedingWindowActions \ - TestNonRepeatableNeedingWindowActions -#define MAYBE_ToggleAppList ToggleAppList -#endif // !defined(OS_CHROMEOS) - -// Tests a sample of the non-repeatable accelerators that need windows to be -// enabled. -TEST_F(AcceleratorInteractiveUITest, - MAYBE_TestNonRepeatableNeedingWindowActions) { - // Create a bunch of windows to work with. - aura::Window* window_1 = - CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100)); - aura::Window* window_2 = - CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100)); - window_1->Show(); - wm::ActivateWindow(window_1); - window_2->Show(); - wm::ActivateWindow(window_2); - - // Test TOGGLE_OVERVIEW. - EXPECT_FALSE(is_in_overview_mode_); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP1, false, false, false); - EXPECT_TRUE(is_in_overview_mode_); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP1, false, false, false); - EXPECT_FALSE(is_in_overview_mode_); - - // Test CYCLE_FORWARD_MRU and CYCLE_BACKWARD_MRU. - wm::ActivateWindow(window_1); - EXPECT_TRUE(wm::IsActiveWindow(window_1)); - EXPECT_FALSE(wm::IsActiveWindow(window_2)); - SendKeyPressSync(ui::VKEY_TAB, false, false, true); // CYCLE_FORWARD_MRU. - EXPECT_TRUE(wm::IsActiveWindow(window_2)); - EXPECT_FALSE(wm::IsActiveWindow(window_1)); - SendKeyPressSync(ui::VKEY_TAB, false, true, true); // CYCLE_BACKWARD_MRU. - EXPECT_TRUE(wm::IsActiveWindow(window_1)); - EXPECT_FALSE(wm::IsActiveWindow(window_2)); - - // Test TOGGLE_FULLSCREEN. - wm::WindowState* active_window_state = wm::GetActiveWindowState(); - EXPECT_FALSE(active_window_state->IsFullscreen()); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP2, false, false, false); - EXPECT_TRUE(active_window_state->IsFullscreen()); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP2, false, false, false); - EXPECT_FALSE(active_window_state->IsFullscreen()); -} - -#if defined(OS_CHROMEOS) -// Tests a sample of ChromeOS specific accelerators. -TEST_F(AcceleratorInteractiveUITest, ChromeOsAccelerators) { - // Test TAKE_SCREENSHOT and TAKE_PARTIAL_SCREENSHOT. - TestScreenshotDelegate* screenshot_delegate = GetScreenshotDelegate(); - screenshot_delegate->set_can_take_screenshot(true); - EXPECT_EQ(0, screenshot_delegate->handle_take_screenshot_count()); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP1, true, false, false); - EXPECT_EQ(1, screenshot_delegate->handle_take_screenshot_count()); - SendKeyPressSync(ui::VKEY_PRINT, false, false, false); - EXPECT_EQ(2, screenshot_delegate->handle_take_screenshot_count()); - SendKeyPressSync(ui::VKEY_MEDIA_LAUNCH_APP1, true, true, false); - EXPECT_EQ(2, screenshot_delegate->handle_take_screenshot_count()); - // Press ESC to go out of the partial screenshot mode. - SendKeyPressSync(ui::VKEY_ESCAPE, false, false, false); - - // Test VOLUME_MUTE, VOLUME_DOWN, and VOLUME_UP. - TestVolumeControlDelegate* volume_delegate = new TestVolumeControlDelegate; - shell()->system_tray_delegate()->SetVolumeControlDelegate( - scoped_ptr<VolumeControlDelegate>(volume_delegate).Pass()); - // VOLUME_MUTE. - EXPECT_EQ(0, volume_delegate->handle_volume_mute_count()); - SendKeyPressSync(ui::VKEY_VOLUME_MUTE, false, false, false); - EXPECT_EQ(1, volume_delegate->handle_volume_mute_count()); - // VOLUME_DOWN. - EXPECT_EQ(0, volume_delegate->handle_volume_down_count()); - SendKeyPressSync(ui::VKEY_VOLUME_DOWN, false, false, false); - EXPECT_EQ(1, volume_delegate->handle_volume_down_count()); - // VOLUME_UP. - EXPECT_EQ(0, volume_delegate->handle_volume_up_count()); - SendKeyPressSync(ui::VKEY_VOLUME_UP, false, false, false); - EXPECT_EQ(1, volume_delegate->handle_volume_up_count()); - - // Test TOGGLE_WIFI. - TestNetworkObserver network_observer; - shell()->system_tray_notifier()->AddNetworkObserver(&network_observer); - - EXPECT_FALSE(network_observer.wifi_enabled_status()); - SendKeyPressSync(ui::VKEY_WLAN, false, false, false); - EXPECT_TRUE(network_observer.wifi_enabled_status()); - SendKeyPressSync(ui::VKEY_WLAN, false, false, false); - EXPECT_FALSE(network_observer.wifi_enabled_status()); - - shell()->system_tray_notifier()->RemoveNetworkObserver(&network_observer); -} -#endif // defined(OS_CHROMEOS) - -// Tests the app list accelerator. -TEST_F(AcceleratorInteractiveUITest, MAYBE_ToggleAppList) { - EXPECT_FALSE(shell()->GetAppListTargetVisibility()); - SendKeyPressSync(ui::VKEY_LWIN, false, false, false); - EXPECT_TRUE(shell()->GetAppListTargetVisibility()); - SendKeyPressSync(ui::VKEY_LWIN, false, false, false); - EXPECT_FALSE(shell()->GetAppListTargetVisibility()); -} - -} // namespace test -} // namespace ash |