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 "ui/wm/core/capture_controller.h" | 5 #include "ui/wm/core/capture_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 EXPECT_FALSE(widget1->GetNativeView()->HasCapture()); | 161 EXPECT_FALSE(widget1->GetNativeView()->HasCapture()); |
162 EXPECT_FALSE(widget2->GetNativeView()->HasCapture()); | 162 EXPECT_FALSE(widget2->GetNativeView()->HasCapture()); |
163 EXPECT_EQ(reinterpret_cast<aura::Window*>(0), | 163 EXPECT_EQ(reinterpret_cast<aura::Window*>(0), |
164 capture_client->GetCaptureWindow()); | 164 capture_client->GetCaptureWindow()); |
165 | 165 |
166 widget1->GetNativeView()->SetCapture(); | 166 widget1->GetNativeView()->SetCapture(); |
167 EXPECT_TRUE(widget1->GetNativeView()->HasCapture()); | 167 EXPECT_TRUE(widget1->GetNativeView()->HasCapture()); |
168 EXPECT_FALSE(widget2->GetNativeView()->HasCapture()); | 168 EXPECT_FALSE(widget2->GetNativeView()->HasCapture()); |
169 EXPECT_EQ(capture_client->GetCaptureWindow(), widget1->GetNativeView()); | 169 EXPECT_EQ(capture_client->GetCaptureWindow(), widget1->GetNativeView()); |
170 | 170 |
171 ui::GestureEvent g1(80, | 171 ui::GestureEvent g1(80, 80, 0, base::TimeTicks(), |
172 80, | |
173 0, | |
174 base::TimeDelta(), | |
175 ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); | 172 ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); |
176 details = root1->OnEventFromSource(&g1); | 173 details = root1->OnEventFromSource(&g1); |
177 EXPECT_FALSE(details.dispatcher_destroyed); | 174 EXPECT_FALSE(details.dispatcher_destroyed); |
178 EXPECT_FALSE(details.target_destroyed); | 175 EXPECT_FALSE(details.target_destroyed); |
179 | 176 |
180 EXPECT_TRUE(v1->received_gesture_event()); | 177 EXPECT_TRUE(v1->received_gesture_event()); |
181 EXPECT_FALSE(v2->received_gesture_event()); | 178 EXPECT_FALSE(v2->received_gesture_event()); |
182 v1->Reset(); | 179 v1->Reset(); |
183 v2->Reset(); | 180 v2->Reset(); |
184 | 181 |
185 widget2->GetNativeView()->SetCapture(); | 182 widget2->GetNativeView()->SetCapture(); |
186 | 183 |
187 EXPECT_FALSE(widget1->GetNativeView()->HasCapture()); | 184 EXPECT_FALSE(widget1->GetNativeView()->HasCapture()); |
188 EXPECT_TRUE(widget2->GetNativeView()->HasCapture()); | 185 EXPECT_TRUE(widget2->GetNativeView()->HasCapture()); |
189 EXPECT_EQ(capture_client->GetCaptureWindow(), widget2->GetNativeView()); | 186 EXPECT_EQ(capture_client->GetCaptureWindow(), widget2->GetNativeView()); |
190 | 187 |
191 details = root2->OnEventFromSource(&g1); | 188 details = root2->OnEventFromSource(&g1); |
192 EXPECT_FALSE(details.dispatcher_destroyed); | 189 EXPECT_FALSE(details.dispatcher_destroyed); |
193 EXPECT_FALSE(details.target_destroyed); | 190 EXPECT_FALSE(details.target_destroyed); |
194 | 191 |
195 EXPECT_TRUE(v2->received_gesture_event()); | 192 EXPECT_TRUE(v2->received_gesture_event()); |
196 EXPECT_FALSE(v1->received_gesture_event()); | 193 EXPECT_FALSE(v1->received_gesture_event()); |
197 | 194 |
198 widget1->CloseNow(); | 195 widget1->CloseNow(); |
199 widget2->CloseNow(); | 196 widget2->CloseNow(); |
200 RunPendingMessages(); | 197 RunPendingMessages(); |
201 } | 198 } |
202 | 199 |
203 } // namespace views | 200 } // namespace views |
OLD | NEW |