| 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 5495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5506 ui::EventTimeForNow(), 0, 0); | 5506 ui::EventTimeForNow(), 0, 0); |
| 5507 view_->OnMouseEvent(&mouse_event); | 5507 view_->OnMouseEvent(&mouse_event); |
| 5508 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); | 5508 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); |
| 5509 | 5509 |
| 5510 view_->UnlockMouse(); | 5510 view_->UnlockMouse(); |
| 5511 | 5511 |
| 5512 // view_ will be destroyed when parent is destroyed. | 5512 // view_ will be destroyed when parent is destroyed. |
| 5513 view_ = nullptr; | 5513 view_ = nullptr; |
| 5514 } | 5514 } |
| 5515 | 5515 |
| 5516 TEST_F(RenderWidgetHostViewAuraTest, GestureTapFromStylusHasPointerType) { |
| 5517 view_->InitAsFullscreen(parent_view_); |
| 5518 view_->Show(); |
| 5519 |
| 5520 aura::Window* root = view_->GetNativeView()->GetRootWindow(); |
| 5521 root->SetTargetHandler(view_); |
| 5522 |
| 5523 ui::test::EventGenerator generator(root, root->bounds().CenterPoint()); |
| 5524 |
| 5525 // Simulate touch press and release to generate a GestureTap. |
| 5526 sink_->ClearMessages(); |
| 5527 generator.EnterPenPointerMode(); |
| 5528 generator.PressTouch(); |
| 5529 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 5530 generator.ReleaseTouch(); |
| 5531 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 5532 |
| 5533 // GestureTap event should have correct pointer type. |
| 5534 EXPECT_EQ(5U, sink_->message_count()); |
| 5535 const WebInputEvent* input_event = GetInputEventFromMessage( |
| 5536 *sink_->GetMessageAt(sink_->message_count() - 1)); |
| 5537 EXPECT_EQ(WebInputEvent::kGestureTap, input_event->GetType()); |
| 5538 const WebGestureEvent* geture_event = |
| 5539 static_cast<const WebGestureEvent*>(input_event); |
| 5540 EXPECT_EQ(blink::WebPointerProperties::PointerType::kPen, |
| 5541 geture_event->primary_pointer_type); |
| 5542 |
| 5543 sink_->ClearMessages(); |
| 5544 } |
| 5545 |
| 5516 // This class provides functionality to test a RenderWidgetHostViewAura | 5546 // This class provides functionality to test a RenderWidgetHostViewAura |
| 5517 // instance which has been hooked up to a test RenderViewHost instance and | 5547 // instance which has been hooked up to a test RenderViewHost instance and |
| 5518 // a WebContents instance. | 5548 // a WebContents instance. |
| 5519 class RenderWidgetHostViewAuraWithViewHarnessTest | 5549 class RenderWidgetHostViewAuraWithViewHarnessTest |
| 5520 : public RenderViewHostImplTestHarness { | 5550 : public RenderViewHostImplTestHarness { |
| 5521 public: | 5551 public: |
| 5522 RenderWidgetHostViewAuraWithViewHarnessTest() | 5552 RenderWidgetHostViewAuraWithViewHarnessTest() |
| 5523 : view_(nullptr) {} | 5553 : view_(nullptr) {} |
| 5524 ~RenderWidgetHostViewAuraWithViewHarnessTest() override {} | 5554 ~RenderWidgetHostViewAuraWithViewHarnessTest() override {} |
| 5525 | 5555 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6070 // There is no composition in the beginning. | 6100 // There is no composition in the beginning. |
| 6071 EXPECT_FALSE(has_composition_text()); | 6101 EXPECT_FALSE(has_composition_text()); |
| 6072 SetHasCompositionTextToTrue(); | 6102 SetHasCompositionTextToTrue(); |
| 6073 view->ImeCancelComposition(); | 6103 view->ImeCancelComposition(); |
| 6074 // The composition must have been canceled. | 6104 // The composition must have been canceled. |
| 6075 EXPECT_FALSE(has_composition_text()); | 6105 EXPECT_FALSE(has_composition_text()); |
| 6076 } | 6106 } |
| 6077 } | 6107 } |
| 6078 | 6108 |
| 6079 } // namespace content | 6109 } // namespace content |
| OLD | NEW |