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

Side by Side Diff: ui/views/widget/native_widget_aura_unittest.cc

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 years, 9 months 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 422 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
423 params.context = root_window(); 423 params.context = root_window();
424 params.bounds = gfx::Rect(0, 0, 100, 200); 424 params.bounds = gfx::Rect(0, 0, 100, 200);
425 widget->Init(params); 425 widget->Init(params);
426 widget->SetContentsView(view); 426 widget->SetContentsView(view);
427 widget->Show(); 427 widget->Show();
428 428
429 ui::TouchEvent press( 429 ui::TouchEvent press(
430 ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), ui::EventTimeForNow(), 430 ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), ui::EventTimeForNow(),
431 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)); 431 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
432 ui::EventDispatchDetails details = 432 ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&press);
433 event_processor()->OnEventFromSource(&press);
434 ASSERT_FALSE(details.dispatcher_destroyed); 433 ASSERT_FALSE(details.dispatcher_destroyed);
435 // Both views should get the press. 434 // Both views should get the press.
436 EXPECT_TRUE(view->got_gesture_event()); 435 EXPECT_TRUE(view->got_gesture_event());
437 EXPECT_TRUE(child->got_gesture_event()); 436 EXPECT_TRUE(child->got_gesture_event());
438 view->clear_got_gesture_event(); 437 view->clear_got_gesture_event();
439 child->clear_got_gesture_event(); 438 child->clear_got_gesture_event();
440 // Touch events should not automatically grab capture. 439 // Touch events should not automatically grab capture.
441 EXPECT_FALSE(widget->HasCapture()); 440 EXPECT_FALSE(widget->HasCapture());
442 441
443 // Release touch. Only |view| should get the release since that it consumed 442 // Release touch. Only |view| should get the release since that it consumed
444 // the press. 443 // the press.
445 ui::TouchEvent release( 444 ui::TouchEvent release(
446 ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), ui::EventTimeForNow(), 445 ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), ui::EventTimeForNow(),
447 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)); 446 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
448 details = event_processor()->OnEventFromSource(&release); 447 details = event_sink()->OnEventFromSource(&release);
449 ASSERT_FALSE(details.dispatcher_destroyed); 448 ASSERT_FALSE(details.dispatcher_destroyed);
450 EXPECT_TRUE(view->got_gesture_event()); 449 EXPECT_TRUE(view->got_gesture_event());
451 EXPECT_FALSE(child->got_gesture_event()); 450 EXPECT_FALSE(child->got_gesture_event());
452 view->clear_got_gesture_event(); 451 view->clear_got_gesture_event();
453 452
454 // Work around for bug in NativeWidgetAura. 453 // Work around for bug in NativeWidgetAura.
455 // TODO: fix bug and remove this. 454 // TODO: fix bug and remove this.
456 widget->Close(); 455 widget->Close();
457 } 456 }
458 457
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 EXPECT_FALSE(delegate.view()->HasFocus()); 646 EXPECT_FALSE(delegate.view()->HasFocus());
648 647
649 test_focus_rules()->set_can_activate(true); 648 test_focus_rules()->set_can_activate(true);
650 views::test::TestInitialFocusWidgetDelegate delegate2(root_window()); 649 views::test::TestInitialFocusWidgetDelegate delegate2(root_window());
651 delegate2.GetWidget()->Show(); 650 delegate2.GetWidget()->Show();
652 EXPECT_TRUE(delegate2.view()->HasFocus()); 651 EXPECT_TRUE(delegate2.view()->HasFocus());
653 } 652 }
654 653
655 } // namespace 654 } // namespace
656 } // namespace views 655 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698