| 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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90)); | 1358 ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90)); |
| 1359 | 1359 |
| 1360 // Caret is at the end. (This emulates Japanese MSIME 2007 and later) | 1360 // Caret is at the end. (This emulates Japanese MSIME 2007 and later) |
| 1361 composition_text.selection = gfx::Range(4); | 1361 composition_text.selection = gfx::Range(4); |
| 1362 | 1362 |
| 1363 view_->SetCompositionText(composition_text); | 1363 view_->SetCompositionText(composition_text); |
| 1364 EXPECT_TRUE(view_->has_composition_text_); | 1364 EXPECT_TRUE(view_->has_composition_text_); |
| 1365 sink_->ClearMessages(); | 1365 sink_->ClearMessages(); |
| 1366 | 1366 |
| 1367 // Simulates the mouse press. | 1367 // Simulates the mouse press. |
| 1368 ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 1368 ui::MouseEvent mouse_event( |
| 1369 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 1369 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 1370 0); | 1370 ui::EF_LEFT_MOUSE_BUTTON, 0, |
| 1371 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1371 view_->OnMouseEvent(&mouse_event); | 1372 view_->OnMouseEvent(&mouse_event); |
| 1372 | 1373 |
| 1373 EXPECT_FALSE(view_->has_composition_text_); | 1374 EXPECT_FALSE(view_->has_composition_text_); |
| 1374 | 1375 |
| 1375 EXPECT_EQ(2U, sink_->message_count()); | 1376 EXPECT_EQ(2U, sink_->message_count()); |
| 1376 | 1377 |
| 1377 if (sink_->message_count() == 2) { | 1378 if (sink_->message_count() == 2) { |
| 1378 // Verify mouse event happens after the finish composing text event. | 1379 // Verify mouse event happens after the finish composing text event. |
| 1379 EXPECT_EQ(InputMsg_ImeFinishComposingText::ID, | 1380 EXPECT_EQ(InputMsg_ImeFinishComposingText::ID, |
| 1380 sink_->GetMessageAt(0)->type()); | 1381 sink_->GetMessageAt(0)->type()); |
| (...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4505 aura::Window* root = parent_view_->GetNativeView()->GetRootWindow(); | 4506 aura::Window* root = parent_view_->GetNativeView()->GetRootWindow(); |
| 4506 | 4507 |
| 4507 // Set up test delegate and window hierarchy. | 4508 // Set up test delegate and window hierarchy. |
| 4508 aura::test::EventCountDelegate delegate; | 4509 aura::test::EventCountDelegate delegate; |
| 4509 std::unique_ptr<aura::Window> parent(new aura::Window(&delegate)); | 4510 std::unique_ptr<aura::Window> parent(new aura::Window(&delegate)); |
| 4510 parent->Init(ui::LAYER_TEXTURED); | 4511 parent->Init(ui::LAYER_TEXTURED); |
| 4511 root->AddChild(parent.get()); | 4512 root->AddChild(parent.get()); |
| 4512 view_->InitAsChild(parent.get()); | 4513 view_->InitAsChild(parent.get()); |
| 4513 | 4514 |
| 4514 // Simulate mouse events, ensure they are forwarded to delegate. | 4515 // Simulate mouse events, ensure they are forwarded to delegate. |
| 4515 ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 4516 ui::MouseEvent mouse_event( |
| 4516 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 4517 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 4517 0); | 4518 ui::EF_LEFT_MOUSE_BUTTON, 0, |
| 4519 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 4518 view_->OnMouseEvent(&mouse_event); | 4520 view_->OnMouseEvent(&mouse_event); |
| 4519 EXPECT_EQ("1 0", delegate.GetMouseButtonCountsAndReset()); | 4521 EXPECT_EQ("1 0", delegate.GetMouseButtonCountsAndReset()); |
| 4520 | 4522 |
| 4521 // Simulate mouse events, ensure they are forwarded to delegate. | 4523 // Simulate mouse events, ensure they are forwarded to delegate. |
| 4522 mouse_event = ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(1, 1), | 4524 mouse_event = ui::MouseEvent( |
| 4523 gfx::Point(), ui::EventTimeForNow(), 0, 0); | 4525 ui::ET_MOUSE_MOVED, gfx::Point(1, 1), gfx::Point(), ui::EventTimeForNow(), |
| 4526 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 4524 view_->OnMouseEvent(&mouse_event); | 4527 view_->OnMouseEvent(&mouse_event); |
| 4525 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); | 4528 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); |
| 4526 | 4529 |
| 4527 // Lock the mouse, simulate, and ensure they are forwarded. | 4530 // Lock the mouse, simulate, and ensure they are forwarded. |
| 4528 view_->LockMouse(); | 4531 view_->LockMouse(); |
| 4529 | 4532 |
| 4530 mouse_event = | 4533 mouse_event = ui::MouseEvent( |
| 4531 ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 4534 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 4532 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); | 4535 ui::EF_LEFT_MOUSE_BUTTON, 0, |
| 4536 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 4533 view_->OnMouseEvent(&mouse_event); | 4537 view_->OnMouseEvent(&mouse_event); |
| 4534 EXPECT_EQ("1 0", delegate.GetMouseButtonCountsAndReset()); | 4538 EXPECT_EQ("1 0", delegate.GetMouseButtonCountsAndReset()); |
| 4535 | 4539 |
| 4536 mouse_event = ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), | 4540 mouse_event = ui::MouseEvent( |
| 4537 ui::EventTimeForNow(), 0, 0); | 4541 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, |
| 4542 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 4538 view_->OnMouseEvent(&mouse_event); | 4543 view_->OnMouseEvent(&mouse_event); |
| 4539 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); | 4544 EXPECT_EQ("0 1 0", delegate.GetMouseMotionCountsAndReset()); |
| 4540 | 4545 |
| 4541 view_->UnlockMouse(); | 4546 view_->UnlockMouse(); |
| 4542 | 4547 |
| 4543 // view_ will be destroyed when parent is destroyed. | 4548 // view_ will be destroyed when parent is destroyed. |
| 4544 view_ = nullptr; | 4549 view_ = nullptr; |
| 4545 } | 4550 } |
| 4546 | 4551 |
| 4547 // This class provides functionality to test a RenderWidgetHostViewAura | 4552 // This class provides functionality to test a RenderWidgetHostViewAura |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5101 // There is no composition in the beginning. | 5106 // There is no composition in the beginning. |
| 5102 EXPECT_FALSE(has_composition_text()); | 5107 EXPECT_FALSE(has_composition_text()); |
| 5103 SetHasCompositionTextToTrue(); | 5108 SetHasCompositionTextToTrue(); |
| 5104 view->ImeCancelComposition(); | 5109 view->ImeCancelComposition(); |
| 5105 // The composition must have been canceled. | 5110 // The composition must have been canceled. |
| 5106 EXPECT_FALSE(has_composition_text()); | 5111 EXPECT_FALSE(has_composition_text()); |
| 5107 } | 5112 } |
| 5108 } | 5113 } |
| 5109 | 5114 |
| 5110 } // namespace content | 5115 } // namespace content |
| OLD | NEW |