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

Side by Side Diff: content/browser/web_contents/aura/window_slider_unittest.cc

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 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
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 "content/browser/web_contents/aura/window_slider.h" 5 #include "content/browser/web_contents/aura/window_slider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/aura/root_window.h" 9 #include "ui/aura/root_window.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
11 #include "ui/aura/test/event_generator.h" 11 #include "ui/aura/test/event_generator.h"
12 #include "ui/aura/test/test_window_delegate.h" 12 #include "ui/aura/test/test_window_delegate.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/base/hit_test.h" 14 #include "ui/base/hit_test.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 void DispatchEventDuringScrollCallback(aura::WindowEventDispatcher* dispatcher, 18 void DispatchEventDuringScrollCallback(aura::WindowEventDispatcher* dispatcher,
19 ui::Event* event, 19 ui::Event* event,
20 ui::EventType type, 20 ui::EventType type,
21 const gfx::Vector2dF& delta) { 21 const gfx::Vector2dF& delta) {
22 if (type != ui::ET_GESTURE_SCROLL_UPDATE) 22 if (type != ui::ET_GESTURE_SCROLL_UPDATE)
23 return; 23 return;
24 aura::WindowTreeHostDelegate* delegate = 24 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(event);
25 dispatcher->AsWindowTreeHostDelegate(); 25 CHECK(!details.dispatcher_destroyed);
26 if (event->IsMouseEvent())
27 delegate->OnHostMouseEvent(static_cast<ui::MouseEvent*>(event));
28 else if (event->IsKeyEvent())
29 delegate->OnHostKeyEvent(static_cast<ui::KeyEvent*>(event));
30 } 26 }
31 27
32 void ChangeSliderOwnerDuringScrollCallback(scoped_ptr<aura::Window>* window, 28 void ChangeSliderOwnerDuringScrollCallback(scoped_ptr<aura::Window>* window,
33 WindowSlider* slider, 29 WindowSlider* slider,
34 ui::EventType type, 30 ui::EventType type,
35 const gfx::Vector2dF& delta) { 31 const gfx::Vector2dF& delta) {
36 if (type != ui::ET_GESTURE_SCROLL_UPDATE) 32 if (type != ui::ET_GESTURE_SCROLL_UPDATE)
37 return; 33 return;
38 aura::Window* new_window = new aura::Window(NULL); 34 aura::Window* new_window = new aura::Window(NULL);
39 new_window->Init(aura::WINDOW_LAYER_TEXTURED); 35 new_window->Init(aura::WINDOW_LAYER_TEXTURED);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 EXPECT_FALSE(slider_delegate.created_front_layer()); 400 EXPECT_FALSE(slider_delegate.created_front_layer());
405 EXPECT_FALSE(slider_delegate.slide_aborted()); 401 EXPECT_FALSE(slider_delegate.slide_aborted());
406 EXPECT_TRUE(slider_delegate.slider_destroyed()); 402 EXPECT_TRUE(slider_delegate.slider_destroyed());
407 403
408 // Destroying the slider would have destroyed |window| too. So |window| should 404 // Destroying the slider would have destroyed |window| too. So |window| should
409 // not need to be destroyed here. 405 // not need to be destroyed here.
410 EXPECT_EQ(child_windows, root_window()->children().size()); 406 EXPECT_EQ(child_windows, root_window()->children().size());
411 } 407 }
412 408
413 } // namespace content 409 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698