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

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: 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->SetLauncherViewBounds(
185 gfx::Rect(0, 0, total_width, shelf_size.height()));
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 I would do it like this: shelf_size.set_width(..);
Harry McCleave 2013/03/04 20:29:24 Done.
183 // No animation happens for LauncherView bounds change. 186 // No animation happens for LauncherView bounds change.
184 EXPECT_TRUE(observer()->change_notified()); 187 EXPECT_TRUE(observer()->change_notified());
185 observer()->Reset(); 188 observer()->Reset();
186 } 189 }
187 190
188 //////////////////////////////////////////////////////////////////////////////// 191 ////////////////////////////////////////////////////////////////////////////////
189 // LauncherView tests. 192 // LauncherView tests.
190 193
191 class LauncherViewTest : public AshTestBase { 194 class LauncherViewTest : public AshTestBase {
192 public: 195 public:
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 // All buttons should be visible. 857 // All buttons should be visible.
855 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, 858 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
856 test_api_->GetButtonCount()); 859 test_api_->GetButtonCount());
857 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); 860 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0);
858 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); 861 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1);
859 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); 862 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width());
860 } 863 }
861 864
862 } // namespace test 865 } // namespace test
863 } // namespace ash 866 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698