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

Side by Side Diff: components/exo/touch_unittest.cc

Issue 2162193003: Separates out accelerators using non-common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@accelerators
Patch Set: sim=20 Created 4 years, 5 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
« no previous file with comments | « components/exo/pointer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/aura/wm_window_aura.h"
5 #include "ash/common/shell_window_ids.h" 6 #include "ash/common/shell_window_ids.h"
6 #include "ash/common/wm/window_positioner.h" 7 #include "ash/common/wm/window_positioner.h"
8 #include "ash/common/wm/window_positioning_utils.h"
7 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
8 #include "ash/shell.h" 10 #include "ash/shell.h"
9 #include "ash/wm/window_util.h"
10 #include "components/exo/buffer.h" 11 #include "components/exo/buffer.h"
11 #include "components/exo/shell_surface.h" 12 #include "components/exo/shell_surface.h"
12 #include "components/exo/surface.h" 13 #include "components/exo/surface.h"
13 #include "components/exo/test/exo_test_base.h" 14 #include "components/exo/test/exo_test_base.h"
14 #include "components/exo/test/exo_test_helper.h" 15 #include "components/exo/test/exo_test_helper.h"
15 #include "components/exo/touch.h" 16 #include "components/exo/touch.h"
16 #include "components/exo/touch_delegate.h" 17 #include "components/exo/touch_delegate.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "ui/events/base_event_utils.h" 19 #include "ui/events/base_event_utils.h"
19 #include "ui/events/test/event_generator.h" 20 #include "ui/events/test/event_generator.h"
(...skipping 22 matching lines...) Expand all
42 ash::WindowPositioner::DisableAutoPositioning(true); 43 ash::WindowPositioner::DisableAutoPositioning(true);
43 44
44 std::unique_ptr<Surface> bottom_surface(new Surface); 45 std::unique_ptr<Surface> bottom_surface(new Surface);
45 std::unique_ptr<ShellSurface> bottom_shell_surface( 46 std::unique_ptr<ShellSurface> bottom_shell_surface(
46 new ShellSurface(bottom_surface.get())); 47 new ShellSurface(bottom_surface.get()));
47 gfx::Size bottom_buffer_size(10, 10); 48 gfx::Size bottom_buffer_size(10, 10);
48 std::unique_ptr<Buffer> bottom_buffer( 49 std::unique_ptr<Buffer> bottom_buffer(
49 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(bottom_buffer_size))); 50 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(bottom_buffer_size)));
50 bottom_surface->Attach(bottom_buffer.get()); 51 bottom_surface->Attach(bottom_buffer.get());
51 bottom_surface->Commit(); 52 bottom_surface->Commit();
52 ash::wm::CenterWindow(bottom_shell_surface->GetWidget()->GetNativeWindow()); 53 ash::wm::CenterWindow(ash::WmWindowAura::Get(
54 bottom_shell_surface->GetWidget()->GetNativeWindow()));
53 55
54 std::unique_ptr<Surface> top_surface(new Surface); 56 std::unique_ptr<Surface> top_surface(new Surface);
55 std::unique_ptr<ShellSurface> top_shell_surface( 57 std::unique_ptr<ShellSurface> top_shell_surface(
56 new ShellSurface(top_surface.get())); 58 new ShellSurface(top_surface.get()));
57 gfx::Size top_buffer_size(8, 8); 59 gfx::Size top_buffer_size(8, 8);
58 std::unique_ptr<Buffer> top_buffer( 60 std::unique_ptr<Buffer> top_buffer(
59 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(top_buffer_size))); 61 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(top_buffer_size)));
60 top_surface->Attach(top_buffer.get()); 62 top_surface->Attach(top_buffer.get());
61 top_surface->Commit(); 63 top_surface->Commit();
62 ash::wm::CenterWindow(top_shell_surface->GetWidget()->GetNativeWindow()); 64 ash::wm::CenterWindow(ash::WmWindowAura::Get(
65 top_shell_surface->GetWidget()->GetNativeWindow()));
63 66
64 MockTouchDelegate delegate; 67 MockTouchDelegate delegate;
65 std::unique_ptr<Touch> touch(new Touch(&delegate)); 68 std::unique_ptr<Touch> touch(new Touch(&delegate));
66 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 69 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
67 70
68 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(top_surface.get())) 71 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(top_surface.get()))
69 .WillRepeatedly(testing::Return(true)); 72 .WillRepeatedly(testing::Return(true));
70 EXPECT_CALL(delegate, 73 EXPECT_CALL(delegate,
71 OnTouchDown(top_surface.get(), testing::_, 1, gfx::Point())); 74 OnTouchDown(top_surface.get(), testing::_, 1, gfx::Point()));
72 generator.set_current_location( 75 generator.set_current_location(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 208
206 // Create surface for modal window. 209 // Create surface for modal window.
207 std::unique_ptr<Surface> surface2(new Surface); 210 std::unique_ptr<Surface> surface2(new Surface);
208 std::unique_ptr<ShellSurface> shell_surface2( 211 std::unique_ptr<ShellSurface> shell_surface2(
209 new ShellSurface(surface2.get(), nullptr, gfx::Rect(0, 0, 5, 5), true, 212 new ShellSurface(surface2.get(), nullptr, gfx::Rect(0, 0, 5, 5), true,
210 ash::kShellWindowId_SystemModalContainer)); 213 ash::kShellWindowId_SystemModalContainer));
211 std::unique_ptr<Buffer> buffer2( 214 std::unique_ptr<Buffer> buffer2(
212 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); 215 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5))));
213 surface2->Attach(buffer2.get()); 216 surface2->Attach(buffer2.get());
214 surface2->Commit(); 217 surface2->Commit();
215 ash::wm::CenterWindow(surface2->window()); 218 ash::wm::CenterWindow(ash::WmWindowAura::Get(surface2->window()));
216 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); 219 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin();
217 220
218 // Make the window modal. 221 // Make the window modal.
219 shell_surface2->SetSystemModal(true); 222 shell_surface2->SetSystemModal(true);
220 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 223 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen());
221 224
222 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get())) 225 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
223 .WillRepeatedly(testing::Return(true)); 226 .WillRepeatedly(testing::Return(true));
224 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface2.get())) 227 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface2.get()))
225 .WillRepeatedly(testing::Return(true)); 228 .WillRepeatedly(testing::Return(true));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 268 }
266 generator.set_current_location(location); 269 generator.set_current_location(location);
267 generator.PressMoveAndReleaseTouchBy(1, 1); 270 generator.PressMoveAndReleaseTouchBy(1, 1);
268 271
269 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 272 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
270 touch.reset(); 273 touch.reset();
271 } 274 }
272 275
273 } // namespace 276 } // namespace
274 } // namespace exo 277 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/pointer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698