OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 DISALLOW_COPY_AND_ASSIGN(TestLauncherIconObserver); | 67 DISALLOW_COPY_AND_ASSIGN(TestLauncherIconObserver); |
68 }; | 68 }; |
69 | 69 |
70 class LauncherViewIconObserverTest : public ash::test::AshTestBase { | 70 class LauncherViewIconObserverTest : public ash::test::AshTestBase { |
71 public: | 71 public: |
72 LauncherViewIconObserverTest() {} | 72 LauncherViewIconObserverTest() {} |
73 virtual ~LauncherViewIconObserverTest() {} | 73 virtual ~LauncherViewIconObserverTest() {} |
74 | 74 |
75 virtual void SetUp() OVERRIDE { | 75 virtual void SetUp() OVERRIDE { |
76 AshTestBase::SetUp(); | 76 AshTestBase::SetUp(); |
77 | 77 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
78 Launcher* launcher = Shell::GetInstance()->launcher(); | |
79 observer_.reset(new TestLauncherIconObserver(launcher)); | 78 observer_.reset(new TestLauncherIconObserver(launcher)); |
80 | 79 |
81 launcher_view_test_.reset(new LauncherViewTestAPI( | 80 launcher_view_test_.reset(new LauncherViewTestAPI( |
82 launcher->GetLauncherViewForTest())); | 81 launcher->GetLauncherViewForTest())); |
83 launcher_view_test_->SetAnimationDuration(1); | 82 launcher_view_test_->SetAnimationDuration(1); |
84 } | 83 } |
85 | 84 |
86 virtual void TearDown() OVERRIDE { | 85 virtual void TearDown() OVERRIDE { |
87 observer_.reset(); | 86 observer_.reset(); |
88 AshTestBase::TearDown(); | 87 AshTestBase::TearDown(); |
(...skipping 29 matching lines...) Expand all Loading... |
118 observer()->Reset(); | 117 observer()->Reset(); |
119 | 118 |
120 widget->Show(); | 119 widget->Show(); |
121 widget->GetNativeWindow()->parent()->RemoveChild(widget->GetNativeWindow()); | 120 widget->GetNativeWindow()->parent()->RemoveChild(widget->GetNativeWindow()); |
122 launcher_vew_test()->RunMessageLoopUntilAnimationsDone(); | 121 launcher_vew_test()->RunMessageLoopUntilAnimationsDone(); |
123 EXPECT_TRUE(observer()->change_notified()); | 122 EXPECT_TRUE(observer()->change_notified()); |
124 observer()->Reset(); | 123 observer()->Reset(); |
125 } | 124 } |
126 | 125 |
127 TEST_F(LauncherViewIconObserverTest, BoundsChanged) { | 126 TEST_F(LauncherViewIconObserverTest, BoundsChanged) { |
128 Launcher* launcher = Shell::GetInstance()->launcher(); | 127 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
129 gfx::Size launcher_size = | 128 gfx::Size launcher_size = |
130 launcher->widget()->GetWindowBoundsInScreen().size(); | 129 launcher->widget()->GetWindowBoundsInScreen().size(); |
131 int total_width = launcher_size.width() / 2; | 130 int total_width = launcher_size.width() / 2; |
132 ASSERT_GT(total_width, 0); | 131 ASSERT_GT(total_width, 0); |
133 launcher->SetStatusSize(gfx::Size(total_width, launcher_size.height())); | 132 launcher->SetStatusSize(gfx::Size(total_width, launcher_size.height())); |
134 // No animation happens for LauncherView bounds change. | 133 // No animation happens for LauncherView bounds change. |
135 EXPECT_TRUE(observer()->change_notified()); | 134 EXPECT_TRUE(observer()->change_notified()); |
136 observer()->Reset(); | 135 observer()->Reset(); |
137 } | 136 } |
138 | 137 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 725 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
727 const gfx::Rect& app_list_ideal_bounds = | 726 const gfx::Rect& app_list_ideal_bounds = |
728 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 727 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
729 const gfx::Rect& app_list_bounds = | 728 const gfx::Rect& app_list_bounds = |
730 test_api_->GetBoundsByIndex(app_list_button_index); | 729 test_api_->GetBoundsByIndex(app_list_button_index); |
731 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 730 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
732 } | 731 } |
733 | 732 |
734 } // namespace test | 733 } // namespace test |
735 } // namespace ash | 734 } // namespace ash |
OLD | NEW |