OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 5257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5268 ui::EventTimeForNow(), 0, 0); | 5268 ui::EventTimeForNow(), 0, 0); |
5269 view_->OnMouseEvent(&mouse_event); | 5269 view_->OnMouseEvent(&mouse_event); |
5270 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); | 5270 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); |
5271 | 5271 |
5272 view_->UnlockMouse(); | 5272 view_->UnlockMouse(); |
5273 | 5273 |
5274 // view_ will be destroyed when parent is destroyed. | 5274 // view_ will be destroyed when parent is destroyed. |
5275 view_ = nullptr; | 5275 view_ = nullptr; |
5276 } | 5276 } |
5277 | 5277 |
| 5278 TEST_F(RenderWidgetHostViewAuraTest, GestureTapFromStylusHasPointerType) { |
| 5279 view_->InitAsFullscreen(parent_view_); |
| 5280 view_->Show(); |
| 5281 |
| 5282 aura::Window* root = view_->GetNativeView()->GetRootWindow(); |
| 5283 root->SetTargetHandler(view_); |
| 5284 |
| 5285 ui::test::EventGenerator generator(root, root->bounds().CenterPoint()); |
| 5286 |
| 5287 // Simulate touch press and release to generate a GestureTap. |
| 5288 sink_->ClearMessages(); |
| 5289 generator.EnterPenPointerMode(); |
| 5290 generator.PressTouch(); |
| 5291 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 5292 generator.ReleaseTouch(); |
| 5293 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 5294 |
| 5295 // GestureTap event should have correct pointer type. |
| 5296 EXPECT_EQ(5U, sink_->message_count()); |
| 5297 const WebInputEvent* input_event = GetInputEventFromMessage( |
| 5298 *sink_->GetMessageAt(sink_->message_count() - 1)); |
| 5299 EXPECT_EQ(WebInputEvent::kGestureTap, input_event->GetType()); |
| 5300 const WebGestureEvent* geture_event = |
| 5301 static_cast<const WebGestureEvent*>(input_event); |
| 5302 EXPECT_EQ(blink::WebPointerProperties::PointerType::kPen, |
| 5303 geture_event->primary_pointer_type); |
| 5304 |
| 5305 sink_->ClearMessages(); |
| 5306 } |
| 5307 |
5278 // This class provides functionality to test a RenderWidgetHostViewAura | 5308 // This class provides functionality to test a RenderWidgetHostViewAura |
5279 // instance which has been hooked up to a test RenderViewHost instance and | 5309 // instance which has been hooked up to a test RenderViewHost instance and |
5280 // a WebContents instance. | 5310 // a WebContents instance. |
5281 class RenderWidgetHostViewAuraWithViewHarnessTest | 5311 class RenderWidgetHostViewAuraWithViewHarnessTest |
5282 : public RenderViewHostImplTestHarness { | 5312 : public RenderViewHostImplTestHarness { |
5283 public: | 5313 public: |
5284 RenderWidgetHostViewAuraWithViewHarnessTest() | 5314 RenderWidgetHostViewAuraWithViewHarnessTest() |
5285 : view_(nullptr) {} | 5315 : view_(nullptr) {} |
5286 ~RenderWidgetHostViewAuraWithViewHarnessTest() override {} | 5316 ~RenderWidgetHostViewAuraWithViewHarnessTest() override {} |
5287 | 5317 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5832 // There is no composition in the beginning. | 5862 // There is no composition in the beginning. |
5833 EXPECT_FALSE(has_composition_text()); | 5863 EXPECT_FALSE(has_composition_text()); |
5834 SetHasCompositionTextToTrue(); | 5864 SetHasCompositionTextToTrue(); |
5835 view->ImeCancelComposition(); | 5865 view->ImeCancelComposition(); |
5836 // The composition must have been canceled. | 5866 // The composition must have been canceled. |
5837 EXPECT_FALSE(has_composition_text()); | 5867 EXPECT_FALSE(has_composition_text()); |
5838 } | 5868 } |
5839 } | 5869 } |
5840 | 5870 |
5841 } // namespace content | 5871 } // namespace content |
OLD | NEW |