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 "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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 delegate->OnHostKeyEvent(static_cast<ui::KeyEvent*>(event)); | 29 delegate->OnHostKeyEvent(static_cast<ui::KeyEvent*>(event)); |
30 } | 30 } |
31 | 31 |
32 void ChangeSliderOwnerDuringScrollCallback(scoped_ptr<aura::Window>* window, | 32 void ChangeSliderOwnerDuringScrollCallback(scoped_ptr<aura::Window>* window, |
33 WindowSlider* slider, | 33 WindowSlider* slider, |
34 ui::EventType type, | 34 ui::EventType type, |
35 const gfx::Vector2dF& delta) { | 35 const gfx::Vector2dF& delta) { |
36 if (type != ui::ET_GESTURE_SCROLL_UPDATE) | 36 if (type != ui::ET_GESTURE_SCROLL_UPDATE) |
37 return; | 37 return; |
38 aura::Window* new_window = new aura::Window(NULL); | 38 aura::Window* new_window = new aura::Window(NULL); |
39 new_window->Init(ui::LAYER_TEXTURED); | 39 new_window->Init(aura::WINDOW_LAYER_TEXTURED); |
40 new_window->Show(); | 40 new_window->Show(); |
41 slider->ChangeOwner(new_window); | 41 slider->ChangeOwner(new_window); |
42 (*window)->parent()->AddChild(new_window); | 42 (*window)->parent()->AddChild(new_window); |
43 window->reset(new_window); | 43 window->reset(new_window); |
44 } | 44 } |
45 | 45 |
46 // The window delegate does not receive any events. | 46 // The window delegate does not receive any events. |
47 class NoEventWindowDelegate : public aura::test::TestWindowDelegate { | 47 class NoEventWindowDelegate : public aura::test::TestWindowDelegate { |
48 public: | 48 public: |
49 NoEventWindowDelegate() { | 49 NoEventWindowDelegate() { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 EXPECT_FALSE(slider_delegate.created_front_layer()); | 404 EXPECT_FALSE(slider_delegate.created_front_layer()); |
405 EXPECT_FALSE(slider_delegate.slide_aborted()); | 405 EXPECT_FALSE(slider_delegate.slide_aborted()); |
406 EXPECT_TRUE(slider_delegate.slider_destroyed()); | 406 EXPECT_TRUE(slider_delegate.slider_destroyed()); |
407 | 407 |
408 // Destroying the slider would have destroyed |window| too. So |window| should | 408 // Destroying the slider would have destroyed |window| too. So |window| should |
409 // not need to be destroyed here. | 409 // not need to be destroyed here. |
410 EXPECT_EQ(child_windows, root_window()->children().size()); | 410 EXPECT_EQ(child_windows, root_window()->children().size()); |
411 } | 411 } |
412 | 412 |
413 } // namespace content | 413 } // namespace content |
OLD | NEW |