OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "ui/gfx/native_widget_types.h" | 8 #include "ui/gfx/native_widget_types.h" |
9 #include "ui/views/test/widget_test.h" | 9 #include "ui/views/test/widget_test.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 127 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
128 // Start a nested loop. | 128 // Start a nested loop. |
129 widget_->Show(); | 129 widget_->Show(); |
130 widget_->SetCapture(widget_->GetContentsView()); | 130 widget_->SetCapture(widget_->GetContentsView()); |
131 EXPECT_TRUE(widget_->HasCapture()); | 131 EXPECT_TRUE(widget_->HasCapture()); |
132 | 132 |
133 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 133 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
134 base::MessageLoop::ScopedNestableTaskAllower allow(loop); | 134 base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
135 | 135 |
136 base::RunLoop run_loop; | 136 base::RunLoop run_loop; |
137 #if defined(USE_AURA) | |
138 run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher()); | |
139 #endif | |
140 run_loop.Run(); | 137 run_loop.Run(); |
141 return true; | 138 return true; |
142 } | 139 } |
143 | 140 |
144 Widget* widget_; | 141 Widget* widget_; |
145 | 142 |
146 DISALLOW_COPY_AND_ASSIGN(NestedLoopCaptureView); | 143 DISALLOW_COPY_AND_ASSIGN(NestedLoopCaptureView); |
147 }; | 144 }; |
148 | 145 |
149 } // namespace | 146 } // namespace |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> | 780 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> |
784 GetDispatcher()->OnEventFromSource(&mouse_event); | 781 GetDispatcher()->OnEventFromSource(&mouse_event); |
785 ASSERT_FALSE(details.dispatcher_destroyed); | 782 ASSERT_FALSE(details.dispatcher_destroyed); |
786 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 783 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
787 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 784 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
788 } | 785 } |
789 #endif | 786 #endif |
790 | 787 |
791 } // namespace test | 788 } // namespace test |
792 } // namespace views | 789 } // namespace views |
OLD | NEW |