| 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" |
| 11 #include "ash/launcher/launcher_button.h" | 11 #include "ash/launcher/launcher_button.h" |
| 12 #include "ash/launcher/launcher_icon_observer.h" | 12 #include "ash/launcher/launcher_icon_observer.h" |
| 13 #include "ash/launcher/launcher_model.h" | 13 #include "ash/launcher/launcher_model.h" |
| 14 #include "ash/launcher/launcher_tooltip_manager.h" | 14 #include "ash/launcher/launcher_tooltip_manager.h" |
| 15 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
| 16 #include "ash/shelf/shelf_widget.h" |
| 16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 17 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 18 #include "ash/test/ash_test_base.h" | 19 #include "ash/test/ash_test_base.h" |
| 19 #include "ash/test/launcher_view_test_api.h" | 20 #include "ash/test/launcher_view_test_api.h" |
| 20 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
| 21 #include "ash/test/test_launcher_delegate.h" | 22 #include "ash/test/test_launcher_delegate.h" |
| 22 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
| 23 #include "base/compiler_specific.h" | 24 #include "base/compiler_specific.h" |
| 24 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
| 25 #include "grit/ash_resources.h" | 26 #include "grit/ash_resources.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 widget->GetNativeWindow()->parent()->RemoveChild(widget->GetNativeWindow()); | 168 widget->GetNativeWindow()->parent()->RemoveChild(widget->GetNativeWindow()); |
| 168 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); | 169 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 169 EXPECT_TRUE(observer()->change_notified()); | 170 EXPECT_TRUE(observer()->change_notified()); |
| 170 EXPECT_TRUE(second_observer.change_notified()); | 171 EXPECT_TRUE(second_observer.change_notified()); |
| 171 | 172 |
| 172 observer()->Reset(); | 173 observer()->Reset(); |
| 173 second_observer.Reset(); | 174 second_observer.Reset(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 TEST_F(LauncherViewIconObserverTest, BoundsChanged) { | 177 TEST_F(LauncherViewIconObserverTest, BoundsChanged) { |
| 178 ShelfWidget* shelf = Shell::GetPrimaryRootWindowController()->shelf(); |
| 177 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 179 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 178 gfx::Size launcher_size = | 180 gfx::Size shelf_size = |
| 179 launcher->widget()->GetWindowBoundsInScreen().size(); | 181 shelf->GetWindowBoundsInScreen().size(); |
| 180 int total_width = launcher_size.width() / 2; | 182 int total_width = shelf_size.width() / 2; |
| 181 ASSERT_GT(total_width, 0); | 183 ASSERT_GT(total_width, 0); |
| 182 launcher->SetStatusSize(gfx::Size(total_width, launcher_size.height())); | 184 launcher->SetViewBounds(gfx::Rect(0, 0, total_width, shelf_size.height())); |
| 183 // No animation happens for LauncherView bounds change. | 185 // No animation happens for LauncherView bounds change. |
| 184 EXPECT_TRUE(observer()->change_notified()); | 186 EXPECT_TRUE(observer()->change_notified()); |
| 185 observer()->Reset(); | 187 observer()->Reset(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 //////////////////////////////////////////////////////////////////////////////// | 190 //////////////////////////////////////////////////////////////////////////////// |
| 189 // LauncherView tests. | 191 // LauncherView tests. |
| 190 | 192 |
| 191 class LauncherViewTest : public AshTestBase { | 193 class LauncherViewTest : public AshTestBase { |
| 192 public: | 194 public: |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 // All buttons should be visible. | 856 // All buttons should be visible. |
| 855 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 857 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| 856 test_api_->GetButtonCount()); | 858 test_api_->GetButtonCount()); |
| 857 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); | 859 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); |
| 858 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); | 860 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); |
| 859 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); | 861 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); |
| 860 } | 862 } |
| 861 | 863 |
| 862 } // namespace test | 864 } // namespace test |
| 863 } // namespace ash | 865 } // namespace ash |
| OLD | NEW |