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

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 10830190: Fix status area tray spacing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/system/status_area_widget.h" 9 #include "ash/system/status_area_widget.h"
10 #include "ash/system/tray/system_tray_item.h" 10 #include "ash/system/tray/system_tray_item.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 131 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
132 RunAllPendingInMessageLoop(); 132 RunAllPendingInMessageLoop();
133 ASSERT_TRUE(test_item->default_view() != NULL); 133 ASSERT_TRUE(test_item->default_view() != NULL);
134 ASSERT_TRUE(detailed_item->detailed_view() == NULL); 134 ASSERT_TRUE(detailed_item->detailed_view() == NULL);
135 } 135 }
136 136
137 TEST_F(SystemTrayTest, TrayWidgetAutoResizes) { 137 TEST_F(SystemTrayTest, TrayWidgetAutoResizes) {
138 SystemTray* tray = GetSystemTray(); 138 SystemTray* tray = GetSystemTray();
139 ASSERT_TRUE(tray->GetWidget()); 139 ASSERT_TRUE(tray->GetWidget());
140 140
141 gfx::Size widget_size = tray->GetWidget()->GetWindowBoundsInScreen().size(); 141 // Add an initial tray item so that the tray gets laid out correctly.
142 TestItem* initial_item = new TestItem;
143 tray->AddTrayItem(initial_item);
142 144
143 TestItem* test_item = new TestItem; 145 gfx::Size initial_size = tray->GetWidget()->GetWindowBoundsInScreen().size();
144 tray->AddTrayItem(test_item); 146
147 TestItem* new_item = new TestItem;
148 tray->AddTrayItem(new_item);
145 149
146 gfx::Size new_size = tray->GetWidget()->GetWindowBoundsInScreen().size(); 150 gfx::Size new_size = tray->GetWidget()->GetWindowBoundsInScreen().size();
147 151
148 // Adding the new item should change the size of the tray. 152 // Adding the new item should change the size of the tray.
149 EXPECT_NE(widget_size.ToString(), new_size.ToString()); 153 EXPECT_NE(initial_size.ToString(), new_size.ToString());
150 154
151 // Hiding the tray view of the new item should also change the size of the 155 // Hiding the tray view of the new item should also change the size of the
152 // tray. 156 // tray.
153 test_item->tray_view()->SetVisible(false); 157 new_item->tray_view()->SetVisible(false);
154 EXPECT_EQ(widget_size.ToString(), 158 EXPECT_EQ(initial_size.ToString(),
155 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); 159 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString());
156 160
157 test_item->tray_view()->SetVisible(true); 161 new_item->tray_view()->SetVisible(true);
158 EXPECT_EQ(new_size.ToString(), 162 EXPECT_EQ(new_size.ToString(),
159 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); 163 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString());
160 } 164 }
161 165
162 TEST_F(SystemTrayTest, SystemTrayNotifications) { 166 TEST_F(SystemTrayTest, SystemTrayNotifications) {
163 SystemTray* tray = GetSystemTray(); 167 SystemTray* tray = GetSystemTray();
164 ASSERT_TRUE(tray->GetWidget()); 168 ASSERT_TRUE(tray->GetWidget());
165 169
166 TestItem* test_item = new TestItem; 170 TestItem* test_item = new TestItem;
167 TestItem* detailed_item = new TestItem; 171 TestItem* detailed_item = new TestItem;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 tray->ShowDefaultView(BUBBLE_USE_EXISTING); 227 tray->ShowDefaultView(BUBBLE_USE_EXISTING);
224 RunAllPendingInMessageLoop(); 228 RunAllPendingInMessageLoop();
225 229
226 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> 230 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()->
227 GetWindowBoundsInScreen().ToString()); 231 GetWindowBoundsInScreen().ToString());
228 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); 232 EXPECT_EQ(widget, test_item->default_view()->GetWidget());
229 } 233 }
230 234
231 } // namespace test 235 } // namespace test
232 } // namespace ash 236 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698