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

Side by Side Diff: ui/wm/core/capture_controller_unittest.cc

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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
OLDNEW
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 "ui/aura/client/capture_delegate.h" 8 #include "ui/aura/client/capture_delegate.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 91 };
92 92
93 // Makes sure that internal details that are set on mouse down (such as 93 // Makes sure that internal details that are set on mouse down (such as
94 // mouse_pressed_handler()) are cleared when another root window takes capture. 94 // mouse_pressed_handler()) are cleared when another root window takes capture.
95 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { 95 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) {
96 // Create a window inside the WindowEventDispatcher. 96 // Create a window inside the WindowEventDispatcher.
97 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL)); 97 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL));
98 98
99 // Make a synthesized mouse down event. Ensure that the WindowEventDispatcher 99 // Make a synthesized mouse down event. Ensure that the WindowEventDispatcher
100 // will dispatch further mouse events to |w1|. 100 // will dispatch further mouse events to |w1|.
101 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), 101 ui::MouseEvent mouse_pressed_event(
102 gfx::Point(5, 5), ui::EventTimeForNow(), 0, 102 ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
103 0); 103 ui::EventTimeForNow(), 0, 0,
104 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
104 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); 105 DispatchEventUsingWindowDispatcher(&mouse_pressed_event);
105 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_pressed_handler()); 106 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_pressed_handler());
106 107
107 // Build a window in the second WindowEventDispatcher. 108 // Build a window in the second WindowEventDispatcher.
108 scoped_ptr<aura::Window> w2( 109 scoped_ptr<aura::Window> w2(
109 CreateNormalWindow(2, second_host_->window(), NULL)); 110 CreateNormalWindow(2, second_host_->window(), NULL));
110 111
111 // The act of having the second window take capture should clear out mouse 112 // The act of having the second window take capture should clear out mouse
112 // pressed handler in the first WindowEventDispatcher. 113 // pressed handler in the first WindowEventDispatcher.
113 w2->SetCapture(); 114 w2->SetCapture();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 EXPECT_FALSE(delegate2->HasNativeCapture()); 187 EXPECT_FALSE(delegate2->HasNativeCapture());
187 188
188 w->ReleaseCapture(); 189 w->ReleaseCapture();
189 EXPECT_EQ(nullptr, GetCaptureWindow()); 190 EXPECT_EQ(nullptr, GetCaptureWindow());
190 EXPECT_EQ(nullptr, GetSecondCaptureWindow()); 191 EXPECT_EQ(nullptr, GetSecondCaptureWindow());
191 EXPECT_FALSE(delegate->HasNativeCapture()); 192 EXPECT_FALSE(delegate->HasNativeCapture());
192 EXPECT_FALSE(delegate2->HasNativeCapture()); 193 EXPECT_FALSE(delegate2->HasNativeCapture());
193 } 194 }
194 195
195 } // namespace wm 196 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698