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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 247433003: Mark touchcancel events as uncancelable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: avi CR feedback Created 6 years, 8 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 | Annotate | Revision Log
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 "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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 0, 528 0,
529 ui::EventTimeForNow()); 529 ui::EventTimeForNow());
530 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, 530 ui::TouchEvent release(ui::ET_TOUCH_RELEASED,
531 gfx::Point(20, 20), 531 gfx::Point(20, 20),
532 0, 532 0,
533 ui::EventTimeForNow()); 533 ui::EventTimeForNow());
534 534
535 view_->OnTouchEvent(&press); 535 view_->OnTouchEvent(&press);
536 EXPECT_FALSE(press.handled()); 536 EXPECT_FALSE(press.handled());
537 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); 537 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type);
538 EXPECT_TRUE(view_->touch_event_.cancelable);
538 EXPECT_EQ(1U, view_->touch_event_.touchesLength); 539 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
539 EXPECT_EQ(blink::WebTouchPoint::StatePressed, 540 EXPECT_EQ(blink::WebTouchPoint::StatePressed,
540 view_->touch_event_.touches[0].state); 541 view_->touch_event_.touches[0].state);
541 542
542 view_->OnTouchEvent(&move); 543 view_->OnTouchEvent(&move);
543 EXPECT_FALSE(move.handled()); 544 EXPECT_FALSE(move.handled());
544 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); 545 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type);
546 EXPECT_TRUE(view_->touch_event_.cancelable);
545 EXPECT_EQ(1U, view_->touch_event_.touchesLength); 547 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
546 EXPECT_EQ(blink::WebTouchPoint::StateMoved, 548 EXPECT_EQ(blink::WebTouchPoint::StateMoved,
547 view_->touch_event_.touches[0].state); 549 view_->touch_event_.touches[0].state);
548 550
549 view_->OnTouchEvent(&release); 551 view_->OnTouchEvent(&release);
550 EXPECT_FALSE(release.handled()); 552 EXPECT_FALSE(release.handled());
551 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); 553 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type);
554 EXPECT_TRUE(view_->touch_event_.cancelable);
552 EXPECT_EQ(0U, view_->touch_event_.touchesLength); 555 EXPECT_EQ(0U, view_->touch_event_.touchesLength);
553 556
554 // Now install some touch-event handlers and do the same steps. The touch 557 // Now install some touch-event handlers and do the same steps. The touch
555 // events should now be consumed. However, the touch-event state should be 558 // events should now be consumed. However, the touch-event state should be
556 // updated as before. 559 // updated as before.
557 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); 560 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true));
558 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); 561 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent());
559 562
560 view_->OnTouchEvent(&press); 563 view_->OnTouchEvent(&press);
561 EXPECT_TRUE(press.stopped_propagation()); 564 EXPECT_TRUE(press.stopped_propagation());
562 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); 565 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type);
566 EXPECT_TRUE(view_->touch_event_.cancelable);
563 EXPECT_EQ(1U, view_->touch_event_.touchesLength); 567 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
564 EXPECT_EQ(blink::WebTouchPoint::StatePressed, 568 EXPECT_EQ(blink::WebTouchPoint::StatePressed,
565 view_->touch_event_.touches[0].state); 569 view_->touch_event_.touches[0].state);
566 570
567 view_->OnTouchEvent(&move); 571 view_->OnTouchEvent(&move);
568 EXPECT_TRUE(move.stopped_propagation()); 572 EXPECT_TRUE(move.stopped_propagation());
569 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); 573 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type);
574 EXPECT_TRUE(view_->touch_event_.cancelable);
570 EXPECT_EQ(1U, view_->touch_event_.touchesLength); 575 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
571 EXPECT_EQ(blink::WebTouchPoint::StateMoved, 576 EXPECT_EQ(blink::WebTouchPoint::StateMoved,
572 view_->touch_event_.touches[0].state); 577 view_->touch_event_.touches[0].state);
573 578
574 view_->OnTouchEvent(&release); 579 view_->OnTouchEvent(&release);
575 EXPECT_TRUE(release.stopped_propagation()); 580 EXPECT_TRUE(release.stopped_propagation());
576 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); 581 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type);
582 EXPECT_TRUE(view_->touch_event_.cancelable);
577 EXPECT_EQ(0U, view_->touch_event_.touchesLength); 583 EXPECT_EQ(0U, view_->touch_event_.touchesLength);
578 584
579 // Now start a touch event, and remove the event-handlers before the release. 585 // Now start a touch event, and remove the event-handlers before the release.
580 view_->OnTouchEvent(&press); 586 view_->OnTouchEvent(&press);
581 EXPECT_TRUE(press.stopped_propagation()); 587 EXPECT_TRUE(press.stopped_propagation());
582 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); 588 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type);
583 EXPECT_EQ(1U, view_->touch_event_.touchesLength); 589 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
584 EXPECT_EQ(blink::WebTouchPoint::StatePressed, 590 EXPECT_EQ(blink::WebTouchPoint::StatePressed,
585 view_->touch_event_.touches[0].state); 591 view_->touch_event_.touches[0].state);
586 592
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1344
1339 // Because the copy request callback may be holding state within it, that 1345 // Because the copy request callback may be holding state within it, that
1340 // state must handle the RWHVA and ImageTransportFactory going away before the 1346 // state must handle the RWHVA and ImageTransportFactory going away before the
1341 // callback is called. This test passes if it does not crash as a result of 1347 // callback is called. This test passes if it does not crash as a result of
1342 // these things being destroyed. 1348 // these things being destroyed.
1343 EXPECT_EQ(2, callback_count_); 1349 EXPECT_EQ(2, callback_count_);
1344 EXPECT_FALSE(result_); 1350 EXPECT_FALSE(result_);
1345 } 1351 }
1346 1352
1347 } // namespace content 1353 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/web_touch_event_traits.cc ('k') | content/browser/renderer_host/ui_events_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698