diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-14 13:33:23 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-14 13:33:23 +0000 |
commit | c5be11f4e5663736128f7c0b34af155155a27806 (patch) | |
tree | e46c093059f09005cec058df6202dc4b4035a7f0 /views/view_unittest.cc | |
parent | 8bff0e34eb5f15a4f1210239a3aced0df9d5d317 (diff) | |
download | chromium_src-c5be11f4e5663736128f7c0b34af155155a27806.zip chromium_src-c5be11f4e5663736128f7c0b34af155155a27806.tar.gz chromium_src-c5be11f4e5663736128f7c0b34af155155a27806.tar.bz2 |
Move views::Accelerator to ui in order to use it from aura code.
This is the first preliminary change for the support of global keyboard shortcut.
BUG=97255
TEST=None
Review URL: http://codereview.chromium.org/8508055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view_unittest.cc')
-rw-r--r-- | views/view_unittest.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/views/view_unittest.cc b/views/view_unittest.cc index d1b032d..545c1ab 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -12,6 +12,7 @@ #include "ui/base/clipboard/clipboard.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/models/simple_menu_model.h" +#include "ui/base/models/accelerator.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/layer.h" @@ -215,7 +216,7 @@ class TestView : public View { virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE; virtual void Paint(gfx::Canvas* canvas) OVERRIDE; virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; // OnBoundsChanged. bool did_change_bounds_; @@ -237,7 +238,7 @@ class TestView : public View { SkRect last_clip_; // Accelerators. - std::map<Accelerator, int> accelerator_count_map_; + std::map<ui::Accelerator, int> accelerator_count_map_; }; // Mock instance of the GestureManager for testing. @@ -963,7 +964,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { //////////////////////////////////////////////////////////////////////////////// // Accelerators //////////////////////////////////////////////////////////////////////////////// -bool TestView::AcceleratorPressed(const Accelerator& accelerator) { +bool TestView::AcceleratorPressed(const ui::Accelerator& accelerator) { accelerator_count_map_[accelerator]++; return true; } @@ -971,7 +972,7 @@ bool TestView::AcceleratorPressed(const Accelerator& accelerator) { #if defined(OS_WIN) && !defined(USE_AURA) TEST_F(ViewTest, ActivateAccelerator) { // Register a keyboard accelerator before the view is added to a window. - Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); + ui::Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); TestView* view = new TestView(); view->Reset(); view->AddAccelerator(return_accelerator); @@ -996,7 +997,7 @@ TEST_F(ViewTest, ActivateAccelerator) { EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1); // Hit the escape key. Nothing should happen. - Accelerator escape_accelerator(ui::VKEY_ESCAPE, false, false, false); + ui::Accelerator escape_accelerator(ui::VKEY_ESCAPE, false, false, false); EXPECT_FALSE(focus_manager->ProcessAccelerator(escape_accelerator)); EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1); EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 0); @@ -1037,7 +1038,7 @@ TEST_F(ViewTest, ActivateAccelerator) { #if defined(OS_WIN) && !defined(USE_AURA) TEST_F(ViewTest, HiddenViewWithAccelerator) { - Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); + ui::Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); TestView* view = new TestView(); view->Reset(); view->AddAccelerator(return_accelerator); @@ -1069,7 +1070,7 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) { #if defined(OS_WIN) && !defined(USE_AURA) TEST_F(ViewTest, ViewInHiddenWidgetWithAccelerator) { - Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); + ui::Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); TestView* view = new TestView(); view->Reset(); view->AddAccelerator(return_accelerator); |