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/base_panel_browser_test.h" | 14 #include "chrome/browser/ui/panels/old_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 PanelAndDesktopNotificationTest : public BasePanelBrowserTest { | 27 class OldPanelAndDesktopNotificationTest : public OldBasePanelBrowserTest { |
28 public: | 28 public: |
29 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { | 29 OldPanelAndDesktopNotificationTest() : OldBasePanelBrowserTest() { |
30 } | 30 } |
31 | 31 |
32 virtual ~PanelAndDesktopNotificationTest() { | 32 virtual ~OldPanelAndDesktopNotificationTest() { |
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 BasePanelBrowserTest::SetUpOnMainThread(); | 40 OldBasePanelBrowserTest::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 BasePanelBrowserTest::CleanUpOnMainThread(); | 58 OldBasePanelBrowserTest::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(PanelAndDesktopNotificationTest, AddAndClosePanel) { | 123 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, 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(PanelAndDesktopNotificationTest, | 142 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, |
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(PanelAndDesktopNotificationTest, DragNarrowPanel) { | 186 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, 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(PanelAndDesktopNotificationTest, DragWidePanel) { | 210 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, 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(PanelAndDesktopNotificationTest, DetachAndAttachPanel) { | 236 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, |
| 237 DetachAndAttachPanel) { |
237 PanelManager* panel_manager = PanelManager::GetInstance(); | 238 PanelManager* panel_manager = PanelManager::GetInstance(); |
238 Balloon* balloon = CreateBalloon(); | 239 Balloon* balloon = CreateBalloon(); |
239 int original_balloon_bottom = GetBalloonBottomPosition(balloon); | 240 int original_balloon_bottom = GetBalloonBottomPosition(balloon); |
240 | 241 |
241 // Create a docked panel. Expect that the notification balloon moves up to be | 242 // Create a docked panel. Expect that the notification balloon moves up to be |
242 // above the panel. | 243 // above the panel. |
243 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 244 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
244 MessageLoopForUI::current()->RunAllPending(); | 245 MessageLoopForUI::current()->RunAllPending(); |
245 int balloon_bottom_after_panel_created = GetBalloonBottomPosition(balloon); | 246 int balloon_bottom_after_panel_created = GetBalloonBottomPosition(balloon); |
246 EXPECT_LT(balloon_bottom_after_panel_created, panel->GetBounds().y()); | 247 EXPECT_LT(balloon_bottom_after_panel_created, panel->GetBounds().y()); |
(...skipping 12 matching lines...) Expand all Loading... |
259 panel_manager->MovePanelToStrip( | 260 panel_manager->MovePanelToStrip( |
260 panel, PanelStrip::DOCKED, PanelStrip::DEFAULT_POSITION); | 261 panel, PanelStrip::DOCKED, PanelStrip::DEFAULT_POSITION); |
261 MessageLoopForUI::current()->RunAllPending(); | 262 MessageLoopForUI::current()->RunAllPending(); |
262 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); | 263 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); |
263 EXPECT_EQ(balloon_bottom_after_panel_created, | 264 EXPECT_EQ(balloon_bottom_after_panel_created, |
264 GetBalloonBottomPosition(balloon)); | 265 GetBalloonBottomPosition(balloon)); |
265 | 266 |
266 panel_manager->CloseAll(); | 267 panel_manager->CloseAll(); |
267 } | 268 } |
268 | 269 |
269 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, ResizePanel) { | 270 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, ResizePanel) { |
270 PanelManager* panel_manager = PanelManager::GetInstance(); | 271 PanelManager* panel_manager = PanelManager::GetInstance(); |
271 Balloon* balloon = CreateBalloon(); | 272 Balloon* balloon = CreateBalloon(); |
272 | 273 |
273 // Create a docked panel. Expect that the notification balloon moves up to be | 274 // Create a docked panel. Expect that the notification balloon moves up to be |
274 // above the panel. | 275 // above the panel. |
275 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 276 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
276 MessageLoopForUI::current()->RunAllPending(); | 277 MessageLoopForUI::current()->RunAllPending(); |
277 int balloon_bottom = GetBalloonBottomPosition(balloon); | 278 int balloon_bottom = GetBalloonBottomPosition(balloon); |
278 gfx::Rect original_bounds = panel->GetBounds(); | 279 gfx::Rect original_bounds = panel->GetBounds(); |
279 EXPECT_LT(balloon_bottom, original_bounds.y()); | 280 EXPECT_LT(balloon_bottom, original_bounds.y()); |
(...skipping 15 matching lines...) Expand all Loading... |
295 new_bounds.set_width(new_bounds.width() + resize_delta.x()); | 296 new_bounds.set_width(new_bounds.width() + resize_delta.x()); |
296 new_bounds.set_height(new_bounds.height() + resize_delta.y()); | 297 new_bounds.set_height(new_bounds.height() + resize_delta.y()); |
297 panel->SetBounds(new_bounds); | 298 panel->SetBounds(new_bounds); |
298 MessageLoopForUI::current()->RunAllPending(); | 299 MessageLoopForUI::current()->RunAllPending(); |
299 int balloon_bottom3 = GetBalloonBottomPosition(balloon); | 300 int balloon_bottom3 = GetBalloonBottomPosition(balloon); |
300 EXPECT_EQ(balloon_bottom2 - resize_delta.y(), balloon_bottom3); | 301 EXPECT_EQ(balloon_bottom2 - resize_delta.y(), balloon_bottom3); |
301 | 302 |
302 panel_manager->CloseAll(); | 303 panel_manager->CloseAll(); |
303 } | 304 } |
304 | 305 |
305 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, ResizePanelByMouse) { | 306 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, ResizePanelByMouse) { |
306 Balloon* balloon = CreateBalloon(); | 307 Balloon* balloon = CreateBalloon(); |
307 | 308 |
308 // Create a docked panel. Expect that the notification balloon moves up to be | 309 // Create a docked panel. Expect that the notification balloon moves up to be |
309 // above the panel. | 310 // above the panel. |
310 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 311 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
311 MessageLoopForUI::current()->RunAllPending(); | 312 MessageLoopForUI::current()->RunAllPending(); |
312 int balloon_bottom = GetBalloonBottomPosition(balloon); | 313 int balloon_bottom = GetBalloonBottomPosition(balloon); |
313 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); | 314 EXPECT_LT(balloon_bottom, panel->GetBounds().y()); |
314 | 315 |
315 // Resize the panel to make it taller. Expect that the notification balloon | 316 // Resize the panel to make it taller. Expect that the notification balloon |
316 // moves further up by the amount of enlarge offset. | 317 // moves further up by the amount of enlarge offset. |
317 gfx::Point drag_delta(-50, -100); | 318 gfx::Point drag_delta(-50, -100); |
318 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP_LEFT, drag_delta); | 319 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP_LEFT, drag_delta); |
319 MessageLoopForUI::current()->RunAllPending(); | 320 MessageLoopForUI::current()->RunAllPending(); |
320 int balloon_bottom2 = GetBalloonBottomPosition(balloon); | 321 int balloon_bottom2 = GetBalloonBottomPosition(balloon); |
321 EXPECT_EQ(balloon_bottom + drag_delta.y(), balloon_bottom2); | 322 EXPECT_EQ(balloon_bottom + drag_delta.y(), balloon_bottom2); |
322 | 323 |
323 // Resize the panel to make it shorter. Expect that the notification balloon | 324 // Resize the panel to make it shorter. Expect that the notification balloon |
324 // moves down by the amount of shrink offset. | 325 // moves down by the amount of shrink offset. |
325 drag_delta = gfx::Point(0, 60); | 326 drag_delta = gfx::Point(0, 60); |
326 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP, drag_delta); | 327 ResizePanelByMouseWithDelta(panel, panel::RESIZE_TOP, drag_delta); |
327 MessageLoopForUI::current()->RunAllPending(); | 328 MessageLoopForUI::current()->RunAllPending(); |
328 int balloon_bottom3 = GetBalloonBottomPosition(balloon); | 329 int balloon_bottom3 = GetBalloonBottomPosition(balloon); |
329 EXPECT_EQ(balloon_bottom2 + drag_delta.y(), balloon_bottom3); | 330 EXPECT_EQ(balloon_bottom2 + drag_delta.y(), balloon_bottom3); |
330 | 331 |
331 PanelManager::GetInstance()->CloseAll(); | 332 PanelManager::GetInstance()->CloseAll(); |
332 } | 333 } |
333 | 334 |
334 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, InteractWithTwoPanels) { | 335 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, |
| 336 InteractWithTwoPanels) { |
335 Balloon* balloon = CreateBalloon(); | 337 Balloon* balloon = CreateBalloon(); |
336 int original_balloon_bottom = GetBalloonBottomPosition(balloon); | 338 int original_balloon_bottom = GetBalloonBottomPosition(balloon); |
337 | 339 |
338 // Let the panel width be smaller than the balloon width. | 340 // Let the panel width be smaller than the balloon width. |
339 int panel_width = balloon->GetViewSize().width() - 50; | 341 int panel_width = balloon->GetViewSize().width() - 50; |
340 | 342 |
341 // Create a short panel. Expect that the notification balloon moves up to be | 343 // Create a short panel. Expect that the notification balloon moves up to be |
342 // above the short panel. | 344 // above the short panel. |
343 Panel* short_panel = CreateDockedPanel( | 345 Panel* short_panel = CreateDockedPanel( |
344 "1", gfx::Rect(0, 0, panel_width, 150)); | 346 "1", gfx::Rect(0, 0, panel_width, 150)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 MessageLoopForUI::current()->RunAllPending(); | 401 MessageLoopForUI::current()->RunAllPending(); |
400 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 402 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
401 GetBalloonBottomPosition(balloon)); | 403 GetBalloonBottomPosition(balloon)); |
402 | 404 |
403 // Close short panel. Expect that the notification balloo moves back to its | 405 // Close short panel. Expect that the notification balloo moves back to its |
404 // original position. | 406 // original position. |
405 short_panel->Close(); | 407 short_panel->Close(); |
406 MessageLoopForUI::current()->RunAllPending(); | 408 MessageLoopForUI::current()->RunAllPending(); |
407 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 409 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
408 } | 410 } |
OLD | NEW |