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

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

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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/tray/system_tray_bubble.cc ('k') | ash/system/tray/tray_bubble_view.cc » ('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()->GetWindowScreenBounds().size(); 141 gfx::Size widget_size = tray->GetWidget()->GetWindowBoundsInScreen().size();
142 142
143 TestItem* test_item = new TestItem; 143 TestItem* test_item = new TestItem;
144 tray->AddTrayItem(test_item); 144 tray->AddTrayItem(test_item);
145 145
146 gfx::Size new_size = tray->GetWidget()->GetWindowScreenBounds().size(); 146 gfx::Size new_size = tray->GetWidget()->GetWindowBoundsInScreen().size();
147 147
148 // Adding the new item should change the size of the tray. 148 // Adding the new item should change the size of the tray.
149 EXPECT_NE(widget_size.ToString(), new_size.ToString()); 149 EXPECT_NE(widget_size.ToString(), new_size.ToString());
150 150
151 // Hiding the tray view of the new item should also change the size of the 151 // Hiding the tray view of the new item should also change the size of the
152 // tray. 152 // tray.
153 test_item->tray_view()->SetVisible(false); 153 test_item->tray_view()->SetVisible(false);
154 EXPECT_EQ(widget_size.ToString(), 154 EXPECT_EQ(widget_size.ToString(),
155 tray->GetWidget()->GetWindowScreenBounds().size().ToString()); 155 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString());
156 156
157 test_item->tray_view()->SetVisible(true); 157 test_item->tray_view()->SetVisible(true);
158 EXPECT_EQ(new_size.ToString(), 158 EXPECT_EQ(new_size.ToString(),
159 tray->GetWidget()->GetWindowScreenBounds().size().ToString()); 159 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString());
160 } 160 }
161 161
162 TEST_F(SystemTrayTest, SystemTrayNotifications) { 162 TEST_F(SystemTrayTest, SystemTrayNotifications) {
163 SystemTray* tray = GetSystemTray(); 163 SystemTray* tray = GetSystemTray();
164 ASSERT_TRUE(tray->GetWidget()); 164 ASSERT_TRUE(tray->GetWidget());
165 165
166 TestItem* test_item = new TestItem; 166 TestItem* test_item = new TestItem;
167 TestItem* detailed_item = new TestItem; 167 TestItem* detailed_item = new TestItem;
168 tray->AddTrayItem(test_item); 168 tray->AddTrayItem(test_item);
169 tray->AddTrayItem(detailed_item); 169 tray->AddTrayItem(detailed_item);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 tray->AddTrayItem(test_item); 202 tray->AddTrayItem(test_item);
203 203
204 // Ensure the tray views are created. 204 // Ensure the tray views are created.
205 ASSERT_TRUE(test_item->tray_view() != NULL); 205 ASSERT_TRUE(test_item->tray_view() != NULL);
206 206
207 // Show the default view, ensure the notification view is destroyed. 207 // Show the default view, ensure the notification view is destroyed.
208 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 208 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
209 RunAllPendingInMessageLoop(); 209 RunAllPendingInMessageLoop();
210 210
211 views::Widget* widget = test_item->default_view()->GetWidget(); 211 views::Widget* widget = test_item->default_view()->GetWidget();
212 gfx::Rect bubble_bounds = widget->GetWindowScreenBounds(); 212 gfx::Rect bubble_bounds = widget->GetWindowBoundsInScreen();
213 213
214 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); 214 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
215 RunAllPendingInMessageLoop(); 215 RunAllPendingInMessageLoop();
216 216
217 EXPECT_FALSE(test_item->default_view()); 217 EXPECT_FALSE(test_item->default_view());
218 218
219 EXPECT_EQ(bubble_bounds.ToString(), test_item->detailed_view()->GetWidget()-> 219 EXPECT_EQ(bubble_bounds.ToString(), test_item->detailed_view()->GetWidget()->
220 GetWindowScreenBounds().ToString()); 220 GetWindowBoundsInScreen().ToString());
221 EXPECT_EQ(widget, test_item->detailed_view()->GetWidget()); 221 EXPECT_EQ(widget, test_item->detailed_view()->GetWidget());
222 222
223 tray->ShowDefaultView(BUBBLE_USE_EXISTING); 223 tray->ShowDefaultView(BUBBLE_USE_EXISTING);
224 RunAllPendingInMessageLoop(); 224 RunAllPendingInMessageLoop();
225 225
226 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> 226 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()->
227 GetWindowScreenBounds().ToString()); 227 GetWindowBoundsInScreen().ToString());
228 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); 228 EXPECT_EQ(widget, test_item->default_view()->GetWidget());
229 } 229 }
230 230
231 } // namespace test 231 } // namespace test
232 } // namespace ash 232 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/tray_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698