| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return CreateLayerForTest(); | 134 return CreateLayerForTest(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual ui::Layer* CreateFrontLayer() OVERRIDE { | 137 virtual ui::Layer* CreateFrontLayer() OVERRIDE { |
| 138 if (!can_create_layer_) | 138 if (!can_create_layer_) |
| 139 return NULL; | 139 return NULL; |
| 140 created_front_layer_ = true; | 140 created_front_layer_ = true; |
| 141 return CreateLayerForTest(); | 141 return CreateLayerForTest(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 virtual void OnWindowSlideCompleted() OVERRIDE { | 144 virtual void OnWindowSlideCompleted(scoped_ptr<ui::Layer> layer) OVERRIDE { |
| 145 slide_completed_ = true; | 145 slide_completed_ = true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 virtual void OnWindowSlideCompleting() OVERRIDE { | 148 virtual void OnWindowSlideCompleting() OVERRIDE { |
| 149 slide_completing_ = true; | 149 slide_completing_ = true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void OnWindowSlideAborted() OVERRIDE { | 152 virtual void OnWindowSlideAborted() OVERRIDE { |
| 153 slide_aborted_ = true; | 153 slide_aborted_ = true; |
| 154 } | 154 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // This delegate destroyes the owner window when a slide is completed. | 191 // This delegate destroyes the owner window when a slide is completed. |
| 192 class WindowSliderDeleteOwnerOnComplete : public WindowSliderDelegateTest { | 192 class WindowSliderDeleteOwnerOnComplete : public WindowSliderDelegateTest { |
| 193 public: | 193 public: |
| 194 explicit WindowSliderDeleteOwnerOnComplete(aura::Window* owner) | 194 explicit WindowSliderDeleteOwnerOnComplete(aura::Window* owner) |
| 195 : owner_(owner) { | 195 : owner_(owner) { |
| 196 } | 196 } |
| 197 virtual ~WindowSliderDeleteOwnerOnComplete() {} | 197 virtual ~WindowSliderDeleteOwnerOnComplete() {} |
| 198 | 198 |
| 199 private: | 199 private: |
| 200 // Overridden from WindowSlider::Delegate: | 200 // Overridden from WindowSlider::Delegate: |
| 201 virtual void OnWindowSlideCompleted() OVERRIDE { | 201 virtual void OnWindowSlideCompleted(scoped_ptr<ui::Layer> layer) OVERRIDE { |
| 202 WindowSliderDelegateTest::OnWindowSlideCompleted(); | 202 WindowSliderDelegateTest::OnWindowSlideCompleted(layer.Pass()); |
| 203 delete owner_; | 203 delete owner_; |
| 204 } | 204 } |
| 205 | 205 |
| 206 aura::Window* owner_; | 206 aura::Window* owner_; |
| 207 DISALLOW_COPY_AND_ASSIGN(WindowSliderDeleteOwnerOnComplete); | 207 DISALLOW_COPY_AND_ASSIGN(WindowSliderDeleteOwnerOnComplete); |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 typedef aura::test::AuraTestBase WindowSliderTest; | 210 typedef aura::test::AuraTestBase WindowSliderTest; |
| 211 | 211 |
| 212 TEST_F(WindowSliderTest, WindowSlideUsingGesture) { | 212 TEST_F(WindowSliderTest, WindowSlideUsingGesture) { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 element->Step(start_time2 + duration); | 643 element->Step(start_time2 + duration); |
| 644 // The animation for the second slide should now be completed. | 644 // The animation for the second slide should now be completed. |
| 645 EXPECT_TRUE(slider_delegate.slide_completed()); | 645 EXPECT_TRUE(slider_delegate.slide_completed()); |
| 646 slider_delegate.Reset(); | 646 slider_delegate.Reset(); |
| 647 | 647 |
| 648 window.reset(); | 648 window.reset(); |
| 649 EXPECT_TRUE(slider_delegate.slider_destroyed()); | 649 EXPECT_TRUE(slider_delegate.slider_destroyed()); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace content | 652 } // namespace content |
| OLD | NEW |