OLD | NEW |
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 "content/browser/web_contents/aura/overscroll_window_animation.h" | 5 #include "content/browser/web_contents/aura/overscroll_window_animation.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/aura/test/aura_test_base.h" | 9 #include "ui/aura/test/aura_test_base.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 private: | 87 private: |
88 // The overscroll window animation under test. | 88 // The overscroll window animation under test. |
89 scoped_ptr<OverscrollWindowAnimation> owa_; | 89 scoped_ptr<OverscrollWindowAnimation> owa_; |
90 | 90 |
91 scoped_ptr<aura::Window> CreateSlideWindow(const gfx::Rect& bounds) { | 91 scoped_ptr<aura::Window> CreateSlideWindow(const gfx::Rect& bounds) { |
92 overscroll_started_ = true; | 92 overscroll_started_ = true; |
93 if (create_window_) { | 93 if (create_window_) { |
94 scoped_ptr<aura::Window> window( | 94 scoped_ptr<aura::Window> window( |
95 CreateNormalWindow(++last_window_id_, root_window(), nullptr)); | 95 CreateNormalWindow(++last_window_id_, root_window(), nullptr)); |
96 window->SetBounds(bounds); | 96 window->SetBounds(bounds); |
97 return window.Pass(); | 97 return window; |
98 } | 98 } |
99 return nullptr; | 99 return nullptr; |
100 } | 100 } |
101 | 101 |
102 // Controls if we return a window for the window creation callbacks or not. | 102 // Controls if we return a window for the window creation callbacks or not. |
103 bool create_window_; | 103 bool create_window_; |
104 | 104 |
105 // State flags. | 105 // State flags. |
106 bool overscroll_started_; | 106 bool overscroll_started_; |
107 bool overscroll_completing_; | 107 bool overscroll_completing_; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // The animation has finished, OverscrollCompleted should have been fired. | 217 // The animation has finished, OverscrollCompleted should have been fired. |
218 animator->Step(start_time + duration); | 218 animator->Step(start_time + duration); |
219 EXPECT_FALSE(owa()->is_active()); | 219 EXPECT_FALSE(owa()->is_active()); |
220 EXPECT_FALSE(overscroll_started()); | 220 EXPECT_FALSE(overscroll_started()); |
221 EXPECT_TRUE(overscroll_completing()); | 221 EXPECT_TRUE(overscroll_completing()); |
222 EXPECT_TRUE(overscroll_completed()); | 222 EXPECT_TRUE(overscroll_completed()); |
223 EXPECT_FALSE(overscroll_aborted()); | 223 EXPECT_FALSE(overscroll_aborted()); |
224 } | 224 } |
225 | 225 |
226 } // namespace content | 226 } // namespace content |
OLD | NEW |