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

Side by Side Diff: views/view_unittest.cc

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 accelerator_count_map_.clear(); 208 accelerator_count_map_.clear();
209 } 209 }
210 210
211 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 211 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
212 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; 212 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
213 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; 213 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE;
214 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; 214 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE;
215 virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE; 215 virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE;
216 virtual void Paint(gfx::Canvas* canvas) OVERRIDE; 216 virtual void Paint(gfx::Canvas* canvas) OVERRIDE;
217 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; 217 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE;
218 virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; 218 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
219 219
220 // OnBoundsChanged. 220 // OnBoundsChanged.
221 bool did_change_bounds_; 221 bool did_change_bounds_;
222 gfx::Rect new_bounds_; 222 gfx::Rect new_bounds_;
223 223
224 // MouseEvent. 224 // MouseEvent.
225 int last_mouse_event_type_; 225 int last_mouse_event_type_;
226 gfx::Point location_; 226 gfx::Point location_;
227 227
228 // Painting. 228 // Painting.
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 ::SendMessage(normal->GetTestingHandle(), WM_PASTE, 0, 0); 956 ::SendMessage(normal->GetTestingHandle(), WM_PASTE, 0, 0);
957 ::GetWindowText(normal->GetTestingHandle(), buffer, 1024); 957 ::GetWindowText(normal->GetTestingHandle(), buffer, 1024);
958 EXPECT_EQ(kReadOnlyText, string16(buffer)); 958 EXPECT_EQ(kReadOnlyText, string16(buffer));
959 widget->CloseNow(); 959 widget->CloseNow();
960 } 960 }
961 #endif 961 #endif
962 962
963 //////////////////////////////////////////////////////////////////////////////// 963 ////////////////////////////////////////////////////////////////////////////////
964 // Accelerators 964 // Accelerators
965 //////////////////////////////////////////////////////////////////////////////// 965 ////////////////////////////////////////////////////////////////////////////////
966 bool TestView::AcceleratorPressed(const Accelerator& accelerator) { 966 bool TestView::AcceleratorPressed(const ui::Accelerator& accelerator) {
967 accelerator_count_map_[accelerator]++; 967 accelerator_count_map_[accelerator]++;
968 return true; 968 return true;
969 } 969 }
970 970
971 #if defined(OS_WIN) && !defined(USE_AURA) 971 #if defined(OS_WIN) && !defined(USE_AURA)
972 TEST_F(ViewTest, ActivateAccelerator) { 972 TEST_F(ViewTest, ActivateAccelerator) {
973 // Register a keyboard accelerator before the view is added to a window. 973 // Register a keyboard accelerator before the view is added to a window.
974 Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false); 974 Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false);
975 TestView* view = new TestView(); 975 TestView* view = new TestView();
976 view->Reset(); 976 view->Reset();
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 ScrambleTree(content); 3096 ScrambleTree(content);
3097 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); 3097 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer()));
3098 3098
3099 ScrambleTree(content); 3099 ScrambleTree(content);
3100 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); 3100 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer()));
3101 } 3101 }
3102 3102
3103 #endif // VIEWS_COMPOSITOR 3103 #endif // VIEWS_COMPOSITOR
3104 3104
3105 } // namespace views 3105 } // namespace views
OLDNEW
« views/accelerator.h ('K') | « views/view.cc ('k') | views/window/dialog_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698