Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: ash/launcher/launcher_view_unittest.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting and moved a couple unit tests Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 const int app_list_button_index = test_api_->GetButtonCount() - 1; 845 const int app_list_button_index = test_api_->GetButtonCount() - 1;
844 const gfx::Rect& app_list_ideal_bounds = 846 const gfx::Rect& app_list_ideal_bounds =
845 test_api_->GetIdealBoundsByIndex(app_list_button_index); 847 test_api_->GetIdealBoundsByIndex(app_list_button_index);
846 const gfx::Rect& app_list_bounds = 848 const gfx::Rect& app_list_bounds =
847 test_api_->GetBoundsByIndex(app_list_button_index); 849 test_api_->GetBoundsByIndex(app_list_button_index);
848 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); 850 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds);
849 } 851 }
850 852
851 } // namespace test 853 } // namespace test
852 } // namespace ash 854 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698