summaryrefslogtreecommitdiffstats
path: root/ash/focus_cycler_unittest.cc
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-13 07:53:50 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-13 07:53:50 +0000
commit1852c8eb07dd11961e32e75d324fe36015dea0d6 (patch)
treee62762ea5090f382448f3aca5c61d2ece2a274b4 /ash/focus_cycler_unittest.cc
parentd9125889f82bf7ad4859d319a5c16d27c2627194 (diff)
downloadchromium_src-1852c8eb07dd11961e32e75d324fe36015dea0d6.zip
chromium_src-1852c8eb07dd11961e32e75d324fe36015dea0d6.tar.gz
chromium_src-1852c8eb07dd11961e32e75d324fe36015dea0d6.tar.bz2
Revert 121685 - Add a unit test for the focus cycler.
BUG=None TEST=Run aura_shell_unittest Review URL: http://codereview.chromium.org/9317027 TBR=zork@chromium.org Review URL: https://chromiumcodereview.appspot.com/9387002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/focus_cycler_unittest.cc')
-rw-r--r--ash/focus_cycler_unittest.cc122
1 files changed, 0 insertions, 122 deletions
diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc
deleted file mode 100644
index d985dcd..0000000
--- a/ash/focus_cycler_unittest.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2012 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/focus_cycler.h"
-
-#include "ash/launcher/launcher.h"
-#include "ash/shell.h"
-#include "ash/shell_window_ids.h"
-#include "ash/wm/window_util.h"
-#include "ash/test/aura_shell_test_base.h"
-#include "ash/shell_factory.h"
-#include "ui/aura/test/test_windows.h"
-#include "ui/aura/window.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/widget/widget.h"
-
-typedef ash::test::AuraShellTestBase FocusCyclerTest;
-
-namespace ash {
-
-using aura::test::CreateTestWindowWithId;
-using aura::Window;
-using internal::FocusCycler;
-
-TEST_F(FocusCyclerTest, CycleFocusBrowserOnly) {
- scoped_ptr<FocusCycler> focus_cycler(new FocusCycler());
-
- // Create a single test window.
- Window* default_container =
- ash::Shell::GetInstance()->GetContainer(
- internal::kShellWindowId_DefaultContainer);
- scoped_ptr<Window> window0(CreateTestWindowWithId(0, default_container));
- ActivateWindow(window0.get());
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-
- // Cycle the window
- focus_cycler->RotateFocus(FocusCycler::FORWARD);
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-}
-
-TEST_F(FocusCyclerTest, CycleFocusForward) {
- scoped_ptr<FocusCycler> focus_cycler(new FocusCycler());
-
- // Add the Status area
- views::Widget* status_widget = internal::CreateStatusArea();
- ASSERT_TRUE(status_widget);
- focus_cycler->AddWidget(status_widget);
-
- // Add a mock button to the status area.
- status_widget->GetContentsView()->AddChildView(
- new views::MenuButton(NULL, string16(), NULL, false));
-
- // Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
- ASSERT_TRUE(launcher);
- views::Widget* launcher_widget = launcher->widget();
- ASSERT_TRUE(launcher_widget);
- focus_cycler->AddWidget(launcher_widget);
-
- // Create a single test window.
- Window* default_container =
- ash::Shell::GetInstance()->GetContainer(
- internal::kShellWindowId_DefaultContainer);
- scoped_ptr<Window> window0(CreateTestWindowWithId(0, default_container));
- ActivateWindow(window0.get());
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-
- // Cycle focus to the status area
- focus_cycler->RotateFocus(FocusCycler::FORWARD);
- EXPECT_TRUE(status_widget->IsActive());
-
- // Cycle focus to the launcher
- focus_cycler->RotateFocus(FocusCycler::FORWARD);
- EXPECT_TRUE(launcher_widget->IsActive());
-
- // Cycle focus to the browser
- focus_cycler->RotateFocus(FocusCycler::FORWARD);
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-}
-
-TEST_F(FocusCyclerTest, CycleFocusBackward) {
- scoped_ptr<FocusCycler> focus_cycler(new FocusCycler());
-
- // Add the Status area
- views::Widget* status_widget = internal::CreateStatusArea();
- ASSERT_TRUE(status_widget);
- focus_cycler->AddWidget(status_widget);
-
- // Add a mock button to the status area.
- status_widget->GetContentsView()->AddChildView(
- new views::MenuButton(NULL, string16(), NULL, false));
-
- // Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
- ASSERT_TRUE(launcher);
- views::Widget* launcher_widget = launcher->widget();
- ASSERT_TRUE(launcher_widget);
- focus_cycler->AddWidget(launcher_widget);
-
- // Create a single test window.
- Window* default_container =
- ash::Shell::GetInstance()->GetContainer(
- internal::kShellWindowId_DefaultContainer);
- scoped_ptr<Window> window0(CreateTestWindowWithId(0, default_container));
- ActivateWindow(window0.get());
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-
- // Cycle focus to the launcher
- focus_cycler->RotateFocus(FocusCycler::BACKWARD);
- EXPECT_TRUE(launcher_widget->IsActive());
-
- // Cycle focus to the status area
- focus_cycler->RotateFocus(FocusCycler::BACKWARD);
- EXPECT_TRUE(status_widget->IsActive());
-
- // Cycle focus to the browser
- focus_cycler->RotateFocus(FocusCycler::BACKWARD);
- EXPECT_TRUE(IsActiveWindow(window0.get()));
-}
-
-} // namespace ash