| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "gfx/canvas_skia.h" | 9 #include "gfx/canvas_skia.h" |
| 10 #include "gfx/path.h" | 10 #include "gfx/path.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 accelerator_count_map_.clear(); | 147 accelerator_count_map_.clear(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 virtual void DidChangeBounds(const gfx::Rect& previous, | 150 virtual void DidChangeBounds(const gfx::Rect& previous, |
| 151 const gfx::Rect& current); | 151 const gfx::Rect& current); |
| 152 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | 152 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); |
| 153 virtual bool OnMousePressed(const MouseEvent& event); | 153 virtual bool OnMousePressed(const MouseEvent& event); |
| 154 virtual bool OnMouseDragged(const MouseEvent& event); | 154 virtual bool OnMouseDragged(const MouseEvent& event); |
| 155 virtual void OnMouseReleased(const MouseEvent& event, bool canceled); | 155 virtual void OnMouseReleased(const MouseEvent& event, bool canceled); |
| 156 #if defined(TOUCH_UI) | 156 #if defined(TOUCH_UI) |
| 157 virtual bool OnTouchEvent(const TouchEvent& event); | 157 virtual TouchStatus OnTouchEvent(const TouchEvent& event); |
| 158 #endif | 158 #endif |
| 159 virtual void Paint(gfx::Canvas* canvas); | 159 virtual void Paint(gfx::Canvas* canvas); |
| 160 virtual bool AcceleratorPressed(const Accelerator& accelerator); | 160 virtual bool AcceleratorPressed(const Accelerator& accelerator); |
| 161 | 161 |
| 162 // DidChangeBounds test | 162 // DidChangeBounds test |
| 163 bool did_change_bounds_; | 163 bool did_change_bounds_; |
| 164 gfx::Rect previous_bounds_; | 164 gfx::Rect previous_bounds_; |
| 165 gfx::Rect new_bounds_; | 165 gfx::Rect new_bounds_; |
| 166 | 166 |
| 167 // AddRemoveNotifications test | 167 // AddRemoveNotifications test |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 last_touch_event_ = event.GetType(); | 422 last_touch_event_ = event.GetType(); |
| 423 last_view_ = source; | 423 last_view_ = source; |
| 424 previously_handled_flag_ = previouslyHandled; | 424 previously_handled_flag_ = previouslyHandled; |
| 425 dispatched_synthetic_event_ = true; | 425 dispatched_synthetic_event_ = true; |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 | 428 |
| 429 MockGestureManager::MockGestureManager() { | 429 MockGestureManager::MockGestureManager() { |
| 430 } | 430 } |
| 431 | 431 |
| 432 bool TestView::OnTouchEvent(const TouchEvent& event) { | 432 View::TouchStatus TestView::OnTouchEvent(const TouchEvent& event) { |
| 433 last_touch_event_type_ = event.GetType(); | 433 last_touch_event_type_ = event.GetType(); |
| 434 location_.SetPoint(event.x(), event.y()); | 434 location_.SetPoint(event.x(), event.y()); |
| 435 return last_touch_event_was_handled_; | 435 return last_touch_event_was_handled_ ? TOUCH_STATUS_CONTINUE : |
| 436 TOUCH_STATUS_UNKNOWN; |
| 436 } | 437 } |
| 437 | 438 |
| 438 TEST_F(ViewTest, TouchEvent) { | 439 TEST_F(ViewTest, TouchEvent) { |
| 439 MockGestureManager* gm = new MockGestureManager(); | 440 MockGestureManager* gm = new MockGestureManager(); |
| 440 | 441 |
| 441 TestView* v1 = new TestView(); | 442 TestView* v1 = new TestView(); |
| 442 v1->SetBounds(0, 0, 300, 300); | 443 v1->SetBounds(0, 0, 300, 300); |
| 443 | 444 |
| 444 TestView* v2 = new TestView(); | 445 TestView* v2 = new TestView(); |
| 445 v2->SetBounds(100, 100, 100, 100); | 446 v2->SetBounds(100, 100, 100, 100); |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 #endif | 1468 #endif |
| 1468 } | 1469 } |
| 1469 | 1470 |
| 1470 TEST_F(ViewTest, ChangeNativeViewHierarchyChangeHierarchy) { | 1471 TEST_F(ViewTest, ChangeNativeViewHierarchyChangeHierarchy) { |
| 1471 // TODO(georgey): Fix the test for Linux | 1472 // TODO(georgey): Fix the test for Linux |
| 1472 #if defined(OS_WIN) | 1473 #if defined(OS_WIN) |
| 1473 TestChangeNativeViewHierarchy test(this); | 1474 TestChangeNativeViewHierarchy test(this); |
| 1474 test.CheckChangingHierarhy(); | 1475 test.CheckChangingHierarhy(); |
| 1475 #endif | 1476 #endif |
| 1476 } | 1477 } |
| OLD | NEW |