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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "chrome/browser/notifications/balloon_collection_impl.h" | 8 #include "chrome/browser/notifications/balloon_collection_impl.h" |
9 #include "chrome/browser/notifications/desktop_notification_service.h" | 9 #include "chrome/browser/notifications/desktop_notification_service.h" |
10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
11 #include "chrome/browser/notifications/notification_ui_manager.h" | 11 #include "chrome/browser/notifications/notification_ui_manager.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" | 14 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
15 #include "chrome/browser/ui/panels/panel.h" | 15 #include "chrome/browser/ui/panels/panel.h" |
16 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #include "chrome/browser/ui/panels/panel_manager.h" |
17 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 17 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "content/public/common/show_desktop_notification_params.h" | 19 #include "content/public/common/show_desktop_notification_params.h" |
20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
21 | 21 |
22 // Desktop notification code subscribes to various panel change notifications | 22 // Desktop notification code subscribes to various panel change notifications |
23 // so that it knows when to adjusts balloon positions. In order to give | 23 // so that it knows when to adjusts balloon positions. In order to give |
24 // desktop notification code a chance to process the change notifications, | 24 // desktop notification code a chance to process the change notifications, |
25 // we call MessageLoopForUI::current()->RunAllPending() after any panel change | 25 // we call MessageLoopForUI::current()->RunAllPending() after any panel change |
26 // has been made. | 26 // has been made. |
27 class OldPanelAndDesktopNotificationTest : public OldBasePanelBrowserTest { | 27 class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { |
28 public: | 28 public: |
29 OldPanelAndDesktopNotificationTest() : OldBasePanelBrowserTest() { | 29 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { |
30 } | 30 } |
31 | 31 |
32 virtual ~OldPanelAndDesktopNotificationTest() { | 32 virtual ~PanelAndDesktopNotificationTest() { |
33 } | 33 } |
34 | 34 |
35 virtual void SetUpOnMainThread() OVERRIDE { | 35 virtual void SetUpOnMainThread() OVERRIDE { |
36 // Do not use our own testing work area since desktop notification code | 36 // Do not use our own testing work area since desktop notification code |
37 // does not have the hook up for testing work area. | 37 // does not have the hook up for testing work area. |
38 disable_display_settings_mock(); | 38 disable_display_settings_mock(); |
39 | 39 |
40 OldBasePanelBrowserTest::SetUpOnMainThread(); | 40 BasePanelBrowserTest::SetUpOnMainThread(); |
41 | 41 |
42 g_browser_process->local_state()->SetInteger( | 42 g_browser_process->local_state()->SetInteger( |
43 prefs::kDesktopNotificationPosition, BalloonCollection::LOWER_RIGHT); | 43 prefs::kDesktopNotificationPosition, BalloonCollection::LOWER_RIGHT); |
44 balloons_ = new BalloonCollectionImpl(); | 44 balloons_ = new BalloonCollectionImpl(); |
45 ui_manager_.reset(NotificationUIManager::Create( | 45 ui_manager_.reset(NotificationUIManager::Create( |
46 g_browser_process->local_state(), balloons_)); | 46 g_browser_process->local_state(), balloons_)); |
47 service_.reset(new DesktopNotificationService(browser()->profile(), | 47 service_.reset(new DesktopNotificationService(browser()->profile(), |
48 ui_manager_.get())); | 48 ui_manager_.get())); |
49 } | 49 } |
50 | 50 |
51 virtual void CleanUpOnMainThread() OVERRIDE { | 51 virtual void CleanUpOnMainThread() OVERRIDE { |
52 balloons_->RemoveAll(); | 52 balloons_->RemoveAll(); |
53 MessageLoopForUI::current()->RunAllPending(); | 53 MessageLoopForUI::current()->RunAllPending(); |
54 | 54 |
55 service_.reset(); | 55 service_.reset(); |
56 ui_manager_.reset(); | 56 ui_manager_.reset(); |
57 | 57 |
58 OldBasePanelBrowserTest::CleanUpOnMainThread(); | 58 BasePanelBrowserTest::CleanUpOnMainThread(); |
59 } | 59 } |
60 | 60 |
61 content::ShowDesktopNotificationHostMsgParams StandardTestNotification() { | 61 content::ShowDesktopNotificationHostMsgParams StandardTestNotification() { |
62 content::ShowDesktopNotificationHostMsgParams params; | 62 content::ShowDesktopNotificationHostMsgParams params; |
63 params.notification_id = 0; | 63 params.notification_id = 0; |
64 params.origin = GURL("http://www.google.com"); | 64 params.origin = GURL("http://www.google.com"); |
65 params.is_html = false; | 65 params.is_html = false; |
66 params.icon_url = GURL("/icon.png"); | 66 params.icon_url = GURL("/icon.png"); |
67 params.title = ASCIIToUTF16("Title"); | 67 params.title = ASCIIToUTF16("Title"); |
68 params.body = ASCIIToUTF16("Text"); | 68 params.body = ASCIIToUTF16("Text"); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const BalloonCollection::Balloons& balloons() const { | 113 const BalloonCollection::Balloons& balloons() const { |
114 return balloons_->GetActiveBalloons(); | 114 return balloons_->GetActiveBalloons(); |
115 } | 115 } |
116 | 116 |
117 private: | 117 private: |
118 BalloonCollectionImpl* balloons_; // Owned by NotificationUIManager. | 118 BalloonCollectionImpl* balloons_; // Owned by NotificationUIManager. |
119 scoped_ptr<NotificationUIManager> ui_manager_; | 119 scoped_ptr<NotificationUIManager> ui_manager_; |
120 scoped_ptr<DesktopNotificationService> service_; | 120 scoped_ptr<DesktopNotificationService> service_; |
121 }; | 121 }; |
122 | 122 |
123 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, AddAndClosePanel) { | 123 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, AddAndClosePanel) { |
124 Balloon* balloon = CreateBalloon(); | 124 Balloon* balloon = CreateBalloon(); |
125 int original_balloon_bottom = GetBalloonBottomPosition(balloon); | 125 int original_balloon_bottom = GetBalloonBottomPosition(balloon); |
126 | 126 |
127 // Create a docked panel. Expect that the notification balloon moves up to be | 127 // Create a docked panel. Expect that the notification balloon moves up to be |
128 // above the panel. | 128 // above the panel. |
129 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 129 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
130 MessageLoopForUI::current()->RunAllPending(); | 130 MessageLoopForUI::current()->RunAllPending(); |
131 int balloon_bottom = GetBalloonBottomPosition(balloon); | 131 int balloon_bottom = GetBalloonBottomPosition(balloon); |
132 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); | 132 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); |
133 EXPECT_LT(balloon_bottom, original_balloon_bottom); | 133 EXPECT_LT(balloon_bottom, original_balloon_bottom); |
134 | 134 |
135 // Close the panel. Expect the notification balloon moves back to its original | 135 // Close the panel. Expect the notification balloon moves back to its original |
136 // position. | 136 // position. |
137 panel->Close(); | 137 panel->Close(); |
138 MessageLoopForUI::current()->RunAllPending(); | 138 MessageLoopForUI::current()->RunAllPending(); |
139 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 139 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
140 } | 140 } |
141 | 141 |
142 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, | 142 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, |
143 ExpandAndCollapsePanel) { | 143 ExpandAndCollapsePanel) { |
144 // Disable mouse watcher since we don't want mouse movements to affect panel | 144 // Disable mouse watcher since we don't want mouse movements to affect panel |
145 // testing for title-only state. | 145 // testing for title-only state. |
146 PanelManager* panel_manager = PanelManager::GetInstance(); | 146 PanelManager* panel_manager = PanelManager::GetInstance(); |
147 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | 147 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); |
148 panel_manager->SetMouseWatcherForTesting(mouse_watcher); | 148 panel_manager->SetMouseWatcherForTesting(mouse_watcher); |
149 | 149 |
150 Balloon* balloon = CreateBalloon(); | 150 Balloon* balloon = CreateBalloon(); |
151 | 151 |
152 // Create a docked panel. Expect that the notification balloon moves up to be | 152 // Create a docked panel. Expect that the notification balloon moves up to be |
(...skipping 23 matching lines...) Expand all Loading... |
176 | 176 |
177 // Expand the panel. Expect that the notification balloon moves up to go back | 177 // Expand the panel. Expect that the notification balloon moves up to go back |
178 // to the same position when the panel is expanded. | 178 // to the same position when the panel is expanded. |
179 panel->Restore(); | 179 panel->Restore(); |
180 MessageLoopForUI::current()->RunAllPending(); | 180 MessageLoopForUI::current()->RunAllPending(); |
181 EXPECT_EQ(balloon_bottom_on_expanded, GetBalloonBottomPosition(balloon)); | 181 EXPECT_EQ(balloon_bottom_on_expanded, GetBalloonBottomPosition(balloon)); |
182 | 182 |
183 PanelManager::GetInstance()->CloseAll(); | 183 PanelManager::GetInstance()->CloseAll(); |
184 } | 184 } |
185 | 185 |
186 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, DragNarrowPanel) { | 186 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, DragNarrowPanel) { |
187 Balloon* balloon = CreateBalloon(); | 187 Balloon* balloon = CreateBalloon(); |
188 | 188 |
189 // Let the panel width be smaller than the balloon width. | 189 // Let the panel width be smaller than the balloon width. |
190 int panel_width = balloon->GetViewSize().width() - 50; | 190 int panel_width = balloon->GetViewSize().width() - 50; |
191 | 191 |
192 // Create 2 docked panels. Expect that the notification balloon moves up to be | 192 // Create 2 docked panels. Expect that the notification balloon moves up to be |
193 // above the tall panel. | 193 // above the tall panel. |
194 Panel* tall_panel = CreateDockedPanel("1", gfx::Rect(0, 0, panel_width, 300)); | 194 Panel* tall_panel = CreateDockedPanel("1", gfx::Rect(0, 0, panel_width, 300)); |
195 Panel* short_panel = CreateDockedPanel( | 195 Panel* short_panel = CreateDockedPanel( |
196 "2", gfx::Rect(0, 0, panel_width, 200)); | 196 "2", gfx::Rect(0, 0, panel_width, 200)); |
197 MessageLoopForUI::current()->RunAllPending(); | 197 MessageLoopForUI::current()->RunAllPending(); |
198 int balloon_bottom = GetBalloonBottomPosition(balloon); | 198 int balloon_bottom = GetBalloonBottomPosition(balloon); |
199 EXPECT_LT(balloon_bottom, tall_panel->GetBounds().y()); | 199 EXPECT_LT(balloon_bottom, tall_panel->GetBounds().y()); |
200 | 200 |
201 // Swap 2 docked panels by dragging. Expect that the notificaition balloon | 201 // Swap 2 docked panels by dragging. Expect that the notificaition balloon |
202 // remains at the same position. | 202 // remains at the same position. |
203 DragPanelToMouseLocation(tall_panel, short_panel->GetBounds().origin()); | 203 DragPanelToMouseLocation(tall_panel, short_panel->GetBounds().origin()); |
204 MessageLoopForUI::current()->RunAllPending(); | 204 MessageLoopForUI::current()->RunAllPending(); |
205 EXPECT_EQ(balloon_bottom, GetBalloonBottomPosition(balloon)); | 205 EXPECT_EQ(balloon_bottom, GetBalloonBottomPosition(balloon)); |
206 | 206 |
207 PanelManager::GetInstance()->CloseAll(); | 207 PanelManager::GetInstance()->CloseAll(); |
208 } | 208 } |
209 | 209 |
210 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, DragWidePanel) { | 210 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, DragWidePanel) { |
211 Balloon* balloon = CreateBalloon(); | 211 Balloon* balloon = CreateBalloon(); |
212 | 212 |
213 // Let the panel width be greater than the balloon width. | 213 // Let the panel width be greater than the balloon width. |
214 int panel_width = balloon->GetViewSize().width() + 50; | 214 int panel_width = balloon->GetViewSize().width() + 50; |
215 | 215 |
216 // Create 2 docked panels. Expect that the notification balloon moves up to be | 216 // Create 2 docked panels. Expect that the notification balloon moves up to be |
217 // above the tall panel. | 217 // above the tall panel. |
218 Panel* tall_panel = CreateDockedPanel("1", gfx::Rect(0, 0, panel_width, 300)); | 218 Panel* tall_panel = CreateDockedPanel("1", gfx::Rect(0, 0, panel_width, 300)); |
219 Panel* short_panel = CreateDockedPanel( | 219 Panel* short_panel = CreateDockedPanel( |
220 "2", gfx::Rect(0, 0, panel_width, 200)); | 220 "2", gfx::Rect(0, 0, panel_width, 200)); |
221 MessageLoopForUI::current()->RunAllPending(); | 221 MessageLoopForUI::current()->RunAllPending(); |
222 int balloon_bottom_before_drag = GetBalloonBottomPosition(balloon); | 222 int balloon_bottom_before_drag = GetBalloonBottomPosition(balloon); |
223 EXPECT_LT(balloon_bottom_before_drag, tall_panel->GetBounds().y()); | 223 EXPECT_LT(balloon_bottom_before_drag, tall_panel->GetBounds().y()); |
224 | 224 |
225 // Swap 2 docked panels by dragging. Expect that the notificaiton balloon | 225 // Swap 2 docked panels by dragging. Expect that the notificaiton balloon |
226 // moves down to be just above the short panel. | 226 // moves down to be just above the short panel. |
227 DragPanelToMouseLocation(tall_panel, short_panel->GetBounds().origin()); | 227 DragPanelToMouseLocation(tall_panel, short_panel->GetBounds().origin()); |
228 MessageLoopForUI::current()->RunAllPending(); | 228 MessageLoopForUI::current()->RunAllPending(); |
229 int balloon_bottom_after_drag = GetBalloonBottomPosition(balloon); | 229 int balloon_bottom_after_drag = GetBalloonBottomPosition(balloon); |
230 EXPECT_LT(balloon_bottom_after_drag, short_panel->GetBounds().y()); | 230 EXPECT_LT(balloon_bottom_after_drag, short_panel->GetBounds().y()); |
231 EXPECT_LT(balloon_bottom_before_drag, balloon_bottom_after_drag); | 231 EXPECT_LT(balloon_bottom_before_drag, balloon_bottom_after_drag); |
232 | 232 |
233 PanelManager::GetInstance()->CloseAll(); | 233 PanelManager::GetInstance()->CloseAll(); |
234 } | 234 } |
235 | 235 |
236 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, | 236 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, DetachAndAttachPanel) { |
237 DetachAndAttachPanel) { | |
238 PanelManager* panel_manager = PanelManager::GetInstance(); | 237 PanelManager* panel_manager = PanelManager::GetInstance(); |
239 Balloon* balloon = CreateBalloon(); | 238 Balloon* balloon = CreateBalloon(); |
240 int original_balloon_bottom = GetBalloonBottomPosition(balloon); | 239 int original_balloon_bottom = GetBalloonBottomPosition(balloon); |
241 | 240 |
242 // Create a docked panel. Expect that the notification balloon moves up to be | 241 // Create a docked panel. Expect that the notification balloon moves up to be |
243 // above the panel. | 242 // above the panel. |
244 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 243 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
245 MessageLoopForUI::current()->RunAllPending(); | 244 MessageLoopForUI::current()->RunAllPending(); |
246 int balloon_bottom_after_panel_created = GetBalloonBottomPosition(balloon); | 245 int balloon_bottom_after_panel_created = GetBalloonBottomPosition(balloon); |
247 EXPECT_LT(balloon_bottom_after_panel_created, panel->GetBounds().y()); | 246 EXPECT_LT(balloon_bottom_after_panel_created, panel->GetBounds().y()); |
(...skipping 12 matching lines...) Expand all Loading... |
260 panel_manager->MovePanelToStrip( | 259 panel_manager->MovePanelToStrip( |
261 panel, PanelStrip::DOCKED, PanelStrip::DEFAULT_POSITION); | 260 panel, PanelStrip::DOCKED, PanelStrip::DEFAULT_POSITION); |
262 MessageLoopForUI::current()->RunAllPending(); | 261 MessageLoopForUI::current()->RunAllPending(); |
263 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); | 262 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); |
264 EXPECT_EQ(balloon_bottom_after_panel_created, | 263 EXPECT_EQ(balloon_bottom_after_panel_created, |
265 GetBalloonBottomPosition(balloon)); | 264 GetBalloonBottomPosition(balloon)); |
266 | 265 |
267 panel_manager->CloseAll(); | 266 panel_manager->CloseAll(); |
268 } | 267 } |
269 | 268 |
270 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, ResizePanel) { | 269 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, ResizePanel) { |
271 PanelManager* panel_manager = PanelManager::GetInstance(); | 270 PanelManager* panel_manager = PanelManager::GetInstance(); |
272 Balloon* balloon = CreateBalloon(); | 271 Balloon* balloon = CreateBalloon(); |
273 | 272 |
274 // Create a docked panel. Expect that the notification balloon moves up to be | 273 // Create a docked panel. Expect that the notification balloon moves up to be |
275 // above the panel. | 274 // above the panel. |
276 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 275 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
277 MessageLoopForUI::current()->RunAllPending(); | 276 MessageLoopForUI::current()->RunAllPending(); |
278 int balloon_bottom = GetBalloonBottomPosition(balloon); | 277 int balloon_bottom = GetBalloonBottomPosition(balloon); |
279 gfx::Rect original_bounds = panel->GetBounds(); | 278 gfx::Rect original_bounds = panel->GetBounds(); |
280 EXPECT_LT(balloon_bottom, original_bounds.y()); | 279 EXPECT_LT(balloon_bottom, original_bounds.y()); |
(...skipping 15 matching lines...) Expand all Loading... |
296 new_bounds.set_width(new_bounds.width() + resize_delta.x()); | 295 new_bounds.set_width(new_bounds.width() + resize_delta.x()); |
297 new_bounds.set_height(new_bounds.height() + resize_delta.y()); | 296 new_bounds.set_height(new_bounds.height() + resize_delta.y()); |
298 panel->SetBounds(new_bounds); | 297 panel->SetBounds(new_bounds); |
299 MessageLoopForUI::current()->RunAllPending(); | 298 MessageLoopForUI::current()->RunAllPending(); |
300 int balloon_bottom3 = GetBalloonBottomPosition(balloon); | 299 int balloon_bottom3 = GetBalloonBottomPosition(balloon); |
301 EXPECT_EQ(balloon_bottom2 - resize_delta.y(), balloon_bottom3); | 300 EXPECT_EQ(balloon_bottom2 - resize_delta.y(), balloon_bottom3); |
302 | 301 |
303 panel_manager->CloseAll(); | 302 panel_manager->CloseAll(); |
304 } | 303 } |
305 | 304 |
306 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, ResizePanelByMouse) { | 305 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, ResizePanelByMouse) { |
307 Balloon* balloon = CreateBalloon(); | 306 Balloon* balloon = CreateBalloon(); |
308 | 307 |
309 // Create a docked panel. Expect that the notification balloon moves up to be | 308 // Create a docked panel. Expect that the notification balloon moves up to be |
310 // above the panel. | 309 // above the panel. |
311 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 310 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
312 MessageLoopForUI::current()->RunAllPending(); | 311 MessageLoopForUI::current()->RunAllPending(); |
313 int balloon_bottom = GetBalloonBottomPosition(balloon); | 312 int balloon_bottom = GetBalloonBottomPosition(balloon); |
314 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); | 313 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); |
315 | 314 |
316 // Resize the panel to make it taller. Expect that the notification balloon | 315 // Resize the panel to make it taller. Expect that the notification balloon |
317 // moves further up by the amount of enlarge offset. | 316 // moves further up by the amount of enlarge offset. |
318 gfx::Point drag_delta(-50, -100); | 317 gfx::Point drag_delta(-50, -100); |
319 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP_LEFT, drag_delta); | 318 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP_LEFT, drag_delta); |
320 MessageLoopForUI::current()->RunAllPending(); | 319 MessageLoopForUI::current()->RunAllPending(); |
321 int balloon_bottom2 = GetBalloonBottomPosition(balloon); | 320 int balloon_bottom2 = GetBalloonBottomPosition(balloon); |
322 EXPECT_EQ(balloon_bottom + drag_delta.y(), balloon_bottom2); | 321 EXPECT_EQ(balloon_bottom + drag_delta.y(), balloon_bottom2); |
323 | 322 |
324 // Resize the panel to make it shorter. Expect that the notification balloon | 323 // Resize the panel to make it shorter. Expect that the notification balloon |
325 // moves down by the amount of shrink offset. | 324 // moves down by the amount of shrink offset. |
326 drag_delta = gfx::Point(0, 60); | 325 drag_delta = gfx::Point(0, 60); |
327 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP, drag_delta); | 326 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP, drag_delta); |
328 MessageLoopForUI::current()->RunAllPending(); | 327 MessageLoopForUI::current()->RunAllPending(); |
329 int balloon_bottom3 = GetBalloonBottomPosition(balloon); | 328 int balloon_bottom3 = GetBalloonBottomPosition(balloon); |
330 EXPECT_EQ(balloon_bottom2 + drag_delta.y(), balloon_bottom3); | 329 EXPECT_EQ(balloon_bottom2 + drag_delta.y(), balloon_bottom3); |
331 | 330 |
332 PanelManager::GetInstance()->CloseAll(); | 331 PanelManager::GetInstance()->CloseAll(); |
333 } | 332 } |
334 | 333 |
335 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, | 334 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, InteractWithTwoPanels) { |
336 InteractWithTwoPanels) { | |
337 Balloon* balloon = CreateBalloon(); | 335 Balloon* balloon = CreateBalloon(); |
338 int original_balloon_bottom = GetBalloonBottomPosition(balloon); | 336 int original_balloon_bottom = GetBalloonBottomPosition(balloon); |
339 | 337 |
340 // Let the panel width be smaller than the balloon width. | 338 // Let the panel width be smaller than the balloon width. |
341 int panel_width = balloon->GetViewSize().width() - 50; | 339 int panel_width = balloon->GetViewSize().width() - 50; |
342 | 340 |
343 // Create a short panel. Expect that the notification balloon moves up to be | 341 // Create a short panel. Expect that the notification balloon moves up to be |
344 // above the short panel. | 342 // above the short panel. |
345 Panel* short_panel = CreateDockedPanel( | 343 Panel* short_panel = CreateDockedPanel( |
346 "1", gfx::Rect(0, 0, panel_width, 150)); | 344 "1", gfx::Rect(0, 0, panel_width, 150)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 MessageLoopForUI::current()->RunAllPending(); | 399 MessageLoopForUI::current()->RunAllPending(); |
402 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 400 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
403 GetBalloonBottomPosition(balloon)); | 401 GetBalloonBottomPosition(balloon)); |
404 | 402 |
405 // Close short panel. Expect that the notification balloo moves back to its | 403 // Close short panel. Expect that the notification balloo moves back to its |
406 // original position. | 404 // original position. |
407 short_panel->Close(); | 405 short_panel->Close(); |
408 MessageLoopForUI::current()->RunAllPending(); | 406 MessageLoopForUI::current()->RunAllPending(); |
409 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 407 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
410 } | 408 } |
OLD | NEW |