| 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 "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 TEST_F(WindowSliderTest, WindowSlideIsCancelledOnEvent) { | 293 TEST_F(WindowSliderTest, WindowSlideIsCancelledOnEvent) { |
| 294 scoped_ptr<aura::Window> window(CreateNormalWindow(0, root_window(), NULL)); | 294 scoped_ptr<aura::Window> window(CreateNormalWindow(0, root_window(), NULL)); |
| 295 window->SetBounds(gfx::Rect(0, 0, 400, 400)); | 295 window->SetBounds(gfx::Rect(0, 0, 400, 400)); |
| 296 WindowSliderDelegateTest slider_delegate; | 296 WindowSliderDelegateTest slider_delegate; |
| 297 | 297 |
| 298 ui::Event* events[] = { | 298 ui::Event* events[] = { |
| 299 new ui::MouseEvent(ui::ET_MOUSE_MOVED, | 299 new ui::MouseEvent(ui::ET_MOUSE_MOVED, |
| 300 gfx::Point(55, 10), | 300 gfx::Point(55, 10), |
| 301 gfx::Point(55, 10), | 301 gfx::Point(55, 10), |
| 302 0, 0), | 302 0, 0), |
| 303 new ui::KeyEvent(ui::ET_KEY_PRESSED, | 303 new ui::KeyEvent('a', ui::VKEY_A, ui::EF_NONE), |
| 304 ui::VKEY_A, | |
| 305 0, | |
| 306 true), | |
| 307 NULL | 304 NULL |
| 308 }; | 305 }; |
| 309 | 306 |
| 310 new WindowSlider(&slider_delegate, root_window(), window.get()); | 307 new WindowSlider(&slider_delegate, root_window(), window.get()); |
| 311 for (int i = 0; events[i]; ++i) { | 308 for (int i = 0; events[i]; ++i) { |
| 312 // Generate a horizontal overscroll. | 309 // Generate a horizontal overscroll. |
| 313 aura::test::EventGenerator generator(root_window()); | 310 aura::test::EventGenerator generator(root_window()); |
| 314 generator.GestureScrollSequenceWithCallback( | 311 generator.GestureScrollSequenceWithCallback( |
| 315 gfx::Point(10, 10), | 312 gfx::Point(10, 10), |
| 316 gfx::Point(80, 10), | 313 gfx::Point(80, 10), |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 animator->Step(start_time2 + duration); | 638 animator->Step(start_time2 + duration); |
| 642 // The animation for the second slide should now be completed. | 639 // The animation for the second slide should now be completed. |
| 643 EXPECT_TRUE(slider_delegate.slide_completed()); | 640 EXPECT_TRUE(slider_delegate.slide_completed()); |
| 644 slider_delegate.Reset(); | 641 slider_delegate.Reset(); |
| 645 | 642 |
| 646 window.reset(); | 643 window.reset(); |
| 647 EXPECT_TRUE(slider_delegate.slider_destroyed()); | 644 EXPECT_TRUE(slider_delegate.slider_destroyed()); |
| 648 } | 645 } |
| 649 | 646 |
| 650 } // namespace content | 647 } // namespace content |
| OLD | NEW |