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

Side by Side Diff: ui/aura/root_window_unittest.cc

Issue 10908127: events: Move EventTarget into Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/aura/shared/compound_event_filter.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/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/aura/client/event_client.h" 10 #include "ui/aura/client/event_client.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 int mouse_event_count() const { return mouse_event_count_; } 49 int mouse_event_count() const { return mouse_event_count_; }
50 gfx::Point mouse_event_location() const { return mouse_event_location_; } 50 gfx::Point mouse_event_location() const { return mouse_event_location_; }
51 int mouse_event_flags() const { return mouse_event_flags_; } 51 int mouse_event_flags() const { return mouse_event_flags_; }
52 52
53 virtual int GetNonClientComponent(const gfx::Point& location) const OVERRIDE { 53 virtual int GetNonClientComponent(const gfx::Point& location) const OVERRIDE {
54 NonClientDelegate* self = const_cast<NonClientDelegate*>(this); 54 NonClientDelegate* self = const_cast<NonClientDelegate*>(this);
55 self->non_client_count_++; 55 self->non_client_count_++;
56 self->non_client_location_ = location; 56 self->non_client_location_ = location;
57 return HTTOPLEFT; 57 return HTTOPLEFT;
58 } 58 }
59 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 59 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
60 mouse_event_count_++; 60 mouse_event_count_++;
61 mouse_event_location_ = event->location(); 61 mouse_event_location_ = event->location();
62 mouse_event_flags_ = event->flags(); 62 mouse_event_flags_ = event->flags();
63 return true; 63 return ui::ER_HANDLED;
64 } 64 }
65 65
66 private: 66 private:
67 int non_client_count_; 67 int non_client_count_;
68 gfx::Point non_client_location_; 68 gfx::Point non_client_location_;
69 int mouse_event_count_; 69 int mouse_event_count_;
70 gfx::Point mouse_event_location_; 70 gfx::Point mouse_event_location_;
71 int mouse_event_flags_; 71 int mouse_event_flags_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(NonClientDelegate); 73 DISALLOW_COPY_AND_ASSIGN(NonClientDelegate);
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 674
675 void Reset(Window* window, bool delete_during_handle) { 675 void Reset(Window* window, bool delete_during_handle) {
676 window_ = window; 676 window_ = window;
677 delete_during_handle_ = delete_during_handle; 677 delete_during_handle_ = delete_during_handle;
678 got_event_ = false; 678 got_event_ = false;
679 } 679 }
680 bool got_event() const { return got_event_; } 680 bool got_event() const { return got_event_; }
681 681
682 private: 682 private:
683 // Overridden from WindowDelegate: 683 // Overridden from WindowDelegate:
684 virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE { 684 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE {
685 if (delete_during_handle_) 685 if (delete_during_handle_)
686 delete window_; 686 delete window_;
687 got_event_ = true; 687 got_event_ = true;
688 return false; 688 return ui::ER_UNHANDLED;
689 } 689 }
690 690
691 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 691 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
692 if (delete_during_handle_) 692 if (delete_during_handle_)
693 delete window_; 693 delete window_;
694 got_event_ = true; 694 got_event_ = true;
695 return false; 695 return ui::ER_UNHANDLED;
696 } 696 }
697 697
698 Window* window_; 698 Window* window_;
699 bool delete_during_handle_; 699 bool delete_during_handle_;
700 bool got_event_; 700 bool got_event_;
701 701
702 DISALLOW_COPY_AND_ASSIGN(DeletingWindowDelegate); 702 DISALLOW_COPY_AND_ASSIGN(DeletingWindowDelegate);
703 }; 703 };
704 704
705 TEST_F(RootWindowTest, DeleteWindowDuringDispatch) { 705 TEST_F(RootWindowTest, DeleteWindowDuringDispatch) {
(...skipping 30 matching lines...) Expand all
736 // handle steps from applying. 736 // handle steps from applying.
737 w11 = CreateWindow(11, w1.get(), &d11); 737 w11 = CreateWindow(11, w1.get(), &d11);
738 w1_filter->Reset(true); 738 w1_filter->Reset(true);
739 d11.Reset(w11, false); 739 d11.Reset(w11, false);
740 generator.PressLeftButton(); 740 generator.PressLeftButton();
741 EXPECT_FALSE(tracker.Contains(w11)); 741 EXPECT_FALSE(tracker.Contains(w11));
742 EXPECT_FALSE(d11.got_event()); 742 EXPECT_FALSE(d11.got_event());
743 } 743 }
744 744
745 } // namespace aura 745 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/aura/shared/compound_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698