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

Side by Side Diff: chrome/browser/ui/panels/panel_drag_browsertest.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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
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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
7 #include "chrome/browser/ui/panels/detached_panel_strip.h" 7 #include "chrome/browser/ui/panels/detached_panel_strip.h"
8 #include "chrome/browser/ui/panels/docked_panel_strip.h" 8 #include "chrome/browser/ui/panels/docked_panel_strip.h"
9 #include "chrome/browser/ui/panels/native_panel.h" 9 #include "chrome/browser/ui/panels/native_panel.h"
10 #include "chrome/browser/ui/panels/panel.h" 10 #include "chrome/browser/ui/panels/panel.h"
(...skipping 17 matching lines...) Expand all
28 28
29 // All the tests here assume using mocked 800x600 screen area for the 29 // All the tests here assume using mocked 800x600 screen area for the
30 // primary monitor. Do the check now. 30 // primary monitor. Do the check now.
31 gfx::Rect primary_screen_area = PanelManager::GetInstance()-> 31 gfx::Rect primary_screen_area = PanelManager::GetInstance()->
32 display_settings_provider()->GetPrimaryScreenArea(); 32 display_settings_provider()->GetPrimaryScreenArea();
33 DCHECK(primary_screen_area.width() == 800); 33 DCHECK(primary_screen_area.width() == 800);
34 DCHECK(primary_screen_area.height() == 600); 34 DCHECK(primary_screen_area.height() == 600);
35 } 35 }
36 36
37 // Drag |panel| from its origin by the offset |delta|. 37 // Drag |panel| from its origin by the offset |delta|.
38 void DragPanelByDelta(Panel* panel, const gfx::Point& delta) { 38 void DragPanelByDelta(Panel* panel, const gfx::Vector2d& delta) {
39 scoped_ptr<NativePanelTesting> panel_testing( 39 scoped_ptr<NativePanelTesting> panel_testing(
40 CreateNativePanelTesting(panel)); 40 CreateNativePanelTesting(panel));
41 gfx::Point mouse_location(panel->GetBounds().origin()); 41 gfx::Point mouse_location(panel->GetBounds().origin());
42 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 42 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
43 panel_testing->DragTitlebar(mouse_location.Add(delta)); 43 panel_testing->DragTitlebar(mouse_location.Add(delta));
44 panel_testing->FinishDragTitlebar(); 44 panel_testing->FinishDragTitlebar();
45 } 45 }
46 46
47 // Drag |panel| from its origin to |new_mouse_location|. 47 // Drag |panel| from its origin to |new_mouse_location|.
48 void DragPanelToMouseLocation(Panel* panel, 48 void DragPanelToMouseLocation(Panel* panel,
49 const gfx::Point& new_mouse_location) { 49 const gfx::Point& new_mouse_location) {
50 scoped_ptr<NativePanelTesting> panel_testing( 50 scoped_ptr<NativePanelTesting> panel_testing(
51 CreateNativePanelTesting(panel)); 51 CreateNativePanelTesting(panel));
52 gfx::Point mouse_location(panel->GetBounds().origin()); 52 gfx::Point mouse_location(panel->GetBounds().origin());
53 panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); 53 panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin());
54 panel_testing->DragTitlebar(new_mouse_location); 54 panel_testing->DragTitlebar(new_mouse_location);
55 panel_testing->FinishDragTitlebar(); 55 panel_testing->FinishDragTitlebar();
56 } 56 }
57 57
58 static gfx::Point GetDragDeltaToRemainDocked() { 58 static gfx::Vector2d GetDragDeltaToRemainDocked() {
59 return gfx::Point( 59 return gfx::Vector2d(
60 -5, 60 -5,
61 -(PanelDragController::GetDetachDockedPanelThreshold() / 2)); 61 -(PanelDragController::GetDetachDockedPanelThreshold() / 2));
62 } 62 }
63 63
64 static gfx::Point GetDragDeltaToDetach() { 64 static gfx::Vector2d GetDragDeltaToDetach() {
65 return gfx::Point( 65 return gfx::Vector2d(
66 -20, 66 -20,
67 -(PanelDragController::GetDetachDockedPanelThreshold() + 20)); 67 -(PanelDragController::GetDetachDockedPanelThreshold() + 20));
68 } 68 }
69 69
70 static gfx::Point GetDragDeltaToRemainDetached(Panel* panel) { 70 static gfx::Vector2d GetDragDeltaToRemainDetached(Panel* panel) {
71 int distance = panel->manager()->docked_strip()->display_area().bottom() - 71 int distance = panel->manager()->docked_strip()->display_area().bottom() -
72 panel->GetBounds().bottom(); 72 panel->GetBounds().bottom();
73 return gfx::Point( 73 return gfx::Vector2d(
74 -5, 74 -5,
75 distance - PanelDragController::GetDockDetachedPanelThreshold() * 2); 75 distance - PanelDragController::GetDockDetachedPanelThreshold() * 2);
76 } 76 }
77 77
78 static gfx::Point GetDragDeltaToAttach(Panel* panel) { 78 static gfx::Vector2d GetDragDeltaToAttach(Panel* panel) {
79 int distance = panel->manager()->docked_strip()->display_area().bottom() - 79 int distance = panel->manager()->docked_strip()->display_area().bottom() -
80 panel->GetBounds().bottom(); 80 panel->GetBounds().bottom();
81 return gfx::Point( 81 return gfx::Vector2d(
82 -20, 82 -20,
83 distance - PanelDragController::GetDockDetachedPanelThreshold() / 2); 83 distance - PanelDragController::GetDockDetachedPanelThreshold() / 2);
84 } 84 }
85 }; 85 };
86 86
87 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragOneDockedPanel) { 87 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragOneDockedPanel) {
88 static const int big_delta_x = 70; 88 static const int big_delta_x = 70;
89 static const int big_delta_y = 30; // Do not exceed the threshold to detach. 89 static const int big_delta_y = 30; // Do not exceed the threshold to detach.
90 90
91 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); 91 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 panel_testing->DragTitlebar(mouse_location); 170 panel_testing->DragTitlebar(mouse_location);
171 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); 171 EXPECT_EQ(panel_old_bounds, panel->GetBounds());
172 172
173 panel_testing->FinishDragTitlebar(); 173 panel_testing->FinishDragTitlebar();
174 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); 174 EXPECT_EQ(panel_old_bounds, panel->GetBounds());
175 175
176 PanelManager::GetInstance()->CloseAll(); 176 PanelManager::GetInstance()->CloseAll();
177 } 177 }
178 178
179 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) { 179 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) {
180 static const gfx::Point small_delta(10, 0); 180 static const gfx::Vector2d small_delta(10, 0);
181 181
182 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); 182 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100));
183 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100)); 183 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100));
184 scoped_ptr<NativePanelTesting> panel1_testing( 184 scoped_ptr<NativePanelTesting> panel1_testing(
185 CreateNativePanelTesting(panel1)); 185 CreateNativePanelTesting(panel1));
186 scoped_ptr<NativePanelTesting> panel2_testing( 186 scoped_ptr<NativePanelTesting> panel2_testing(
187 CreateNativePanelTesting(panel2)); 187 CreateNativePanelTesting(panel2));
188 gfx::Point position1 = panel1->GetBounds().origin(); 188 gfx::Point position1 = panel1->GetBounds().origin();
189 gfx::Point position2 = panel2->GetBounds().origin(); 189 gfx::Point position2 = panel2->GetBounds().origin();
190 190
(...skipping 13 matching lines...) Expand all
204 EXPECT_EQ(position1, panel1->GetBounds().origin()); 204 EXPECT_EQ(position1, panel1->GetBounds().origin());
205 EXPECT_EQ(position2, panel2->GetBounds().origin()); 205 EXPECT_EQ(position2, panel2->GetBounds().origin());
206 206
207 // Drag right panel towards left with big delta. 207 // Drag right panel towards left with big delta.
208 // Expect shuffle: P2 P1 208 // Expect shuffle: P2 P1
209 mouse_location = position1; 209 mouse_location = position1;
210 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location); 210 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location);
211 EXPECT_EQ(position1, panel1->GetBounds().origin()); 211 EXPECT_EQ(position1, panel1->GetBounds().origin());
212 EXPECT_EQ(position2, panel2->GetBounds().origin()); 212 EXPECT_EQ(position2, panel2->GetBounds().origin());
213 213
214 mouse_location = position2.Add(gfx::Point(1, 0)); 214 mouse_location = position2.Add(gfx::Vector2d(1, 0));
215 panel1_testing->DragTitlebar(mouse_location); 215 panel1_testing->DragTitlebar(mouse_location);
216 EXPECT_EQ(mouse_location, panel1->GetBounds().origin()); 216 EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
217 EXPECT_EQ(position1, panel2->GetBounds().origin()); 217 EXPECT_EQ(position1, panel2->GetBounds().origin());
218 218
219 panel1_testing->FinishDragTitlebar(); 219 panel1_testing->FinishDragTitlebar();
220 EXPECT_EQ(position2, panel1->GetBounds().origin()); 220 EXPECT_EQ(position2, panel1->GetBounds().origin());
221 EXPECT_EQ(position1, panel2->GetBounds().origin()); 221 EXPECT_EQ(position1, panel2->GetBounds().origin());
222 222
223 // Drag left panel towards right with small delta. 223 // Drag left panel towards right with small delta.
224 // Expect no shuffle: P2 P1 224 // Expect no shuffle: P2 P1
(...skipping 11 matching lines...) Expand all
236 EXPECT_EQ(position2, panel1->GetBounds().origin()); 236 EXPECT_EQ(position2, panel1->GetBounds().origin());
237 EXPECT_EQ(position1, panel2->GetBounds().origin()); 237 EXPECT_EQ(position1, panel2->GetBounds().origin());
238 238
239 // Drag left panel towards right with big delta. 239 // Drag left panel towards right with big delta.
240 // Expect shuffle: P1 P2 240 // Expect shuffle: P1 P2
241 mouse_location = position2; 241 mouse_location = position2;
242 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location); 242 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location);
243 EXPECT_EQ(position2, panel1->GetBounds().origin()); 243 EXPECT_EQ(position2, panel1->GetBounds().origin());
244 EXPECT_EQ(position1, panel2->GetBounds().origin()); 244 EXPECT_EQ(position1, panel2->GetBounds().origin());
245 245
246 mouse_location = position1.Add(gfx::Point(1, 0)); 246 mouse_location = position1.Add(gfx::Vector2d(1, 0));
247 panel1_testing->DragTitlebar(mouse_location); 247 panel1_testing->DragTitlebar(mouse_location);
248 EXPECT_EQ(mouse_location, panel1->GetBounds().origin()); 248 EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
249 EXPECT_EQ(position2, panel2->GetBounds().origin()); 249 EXPECT_EQ(position2, panel2->GetBounds().origin());
250 250
251 panel1_testing->FinishDragTitlebar(); 251 panel1_testing->FinishDragTitlebar();
252 EXPECT_EQ(position1, panel1->GetBounds().origin()); 252 EXPECT_EQ(position1, panel1->GetBounds().origin());
253 EXPECT_EQ(position2, panel2->GetBounds().origin()); 253 EXPECT_EQ(position2, panel2->GetBounds().origin());
254 254
255 // Drag right panel towards left with big delta and then cancel the drag. 255 // Drag right panel towards left with big delta and then cancel the drag.
256 // Expect shuffle after drag: P2 P1 256 // Expect shuffle after drag: P2 P1
257 // Expect shuffle after cancel: P1 P2 257 // Expect shuffle after cancel: P1 P2
258 mouse_location = position1; 258 mouse_location = position1;
259 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location); 259 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location);
260 EXPECT_EQ(position1, panel1->GetBounds().origin()); 260 EXPECT_EQ(position1, panel1->GetBounds().origin());
261 EXPECT_EQ(position2, panel2->GetBounds().origin()); 261 EXPECT_EQ(position2, panel2->GetBounds().origin());
262 262
263 mouse_location = position2.Add(gfx::Point(1, 0)); 263 mouse_location = position2.Add(gfx::Vector2d(1, 0));
264 panel1_testing->DragTitlebar(mouse_location); 264 panel1_testing->DragTitlebar(mouse_location);
265 EXPECT_EQ(mouse_location, panel1->GetBounds().origin()); 265 EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
266 EXPECT_EQ(position1, panel2->GetBounds().origin()); 266 EXPECT_EQ(position1, panel2->GetBounds().origin());
267 267
268 panel1_testing->CancelDragTitlebar(); 268 panel1_testing->CancelDragTitlebar();
269 EXPECT_EQ(position1, panel1->GetBounds().origin()); 269 EXPECT_EQ(position1, panel1->GetBounds().origin());
270 EXPECT_EQ(position2, panel2->GetBounds().origin()); 270 EXPECT_EQ(position2, panel2->GetBounds().origin());
271 271
272 PanelManager::GetInstance()->CloseAll(); 272 PanelManager::GetInstance()->CloseAll();
273 } 273 }
(...skipping 13 matching lines...) Expand all
287 // Drag leftmost panel to become the rightmost in 2 drags. Each drag will 287 // Drag leftmost panel to become the rightmost in 2 drags. Each drag will
288 // shuffle one panel. 288 // shuffle one panel.
289 // Expect shuffle after 1st drag: P1 P3 P2 289 // Expect shuffle after 1st drag: P1 P3 P2
290 // Expect shuffle after 2nd drag: P3 P1 P2 290 // Expect shuffle after 2nd drag: P3 P1 P2
291 gfx::Point mouse_location = position3; 291 gfx::Point mouse_location = position3;
292 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location); 292 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location);
293 EXPECT_EQ(position1, panel1->GetBounds().origin()); 293 EXPECT_EQ(position1, panel1->GetBounds().origin());
294 EXPECT_EQ(position2, panel2->GetBounds().origin()); 294 EXPECT_EQ(position2, panel2->GetBounds().origin());
295 EXPECT_EQ(position3, panel3->GetBounds().origin()); 295 EXPECT_EQ(position3, panel3->GetBounds().origin());
296 296
297 mouse_location = position2.Add(gfx::Point(1, 0)); 297 mouse_location = position2.Add(gfx::Vector2d(1, 0));
298 panel3_testing->DragTitlebar(mouse_location); 298 panel3_testing->DragTitlebar(mouse_location);
299 EXPECT_EQ(position1, panel1->GetBounds().origin()); 299 EXPECT_EQ(position1, panel1->GetBounds().origin());
300 EXPECT_EQ(position3, panel2->GetBounds().origin()); 300 EXPECT_EQ(position3, panel2->GetBounds().origin());
301 EXPECT_EQ(mouse_location, panel3->GetBounds().origin()); 301 EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
302 302
303 mouse_location = position1.Add(gfx::Point(1, 0)); 303 mouse_location = position1.Add(gfx::Vector2d(1, 0));
304 panel3_testing->DragTitlebar(mouse_location); 304 panel3_testing->DragTitlebar(mouse_location);
305 EXPECT_EQ(position2, panel1->GetBounds().origin()); 305 EXPECT_EQ(position2, panel1->GetBounds().origin());
306 EXPECT_EQ(position3, panel2->GetBounds().origin()); 306 EXPECT_EQ(position3, panel2->GetBounds().origin());
307 EXPECT_EQ(mouse_location, panel3->GetBounds().origin()); 307 EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
308 308
309 panel3_testing->FinishDragTitlebar(); 309 panel3_testing->FinishDragTitlebar();
310 EXPECT_EQ(position2, panel1->GetBounds().origin()); 310 EXPECT_EQ(position2, panel1->GetBounds().origin());
311 EXPECT_EQ(position3, panel2->GetBounds().origin()); 311 EXPECT_EQ(position3, panel2->GetBounds().origin());
312 EXPECT_EQ(position1, panel3->GetBounds().origin()); 312 EXPECT_EQ(position1, panel3->GetBounds().origin());
313 313
314 // Drag rightmost panel to become the leftmost in 2 drags and then cancel the 314 // Drag rightmost panel to become the leftmost in 2 drags and then cancel the
315 // drag. Each drag will shuffle one panel and the cancellation will restore 315 // drag. Each drag will shuffle one panel and the cancellation will restore
316 // all panels. 316 // all panels.
317 // Expect shuffle after 1st drag: P1 P3 P2 317 // Expect shuffle after 1st drag: P1 P3 P2
318 // Expect shuffle after 2nd drag: P1 P2 P3 318 // Expect shuffle after 2nd drag: P1 P2 P3
319 // Expect shuffle after cancel: P3 P1 P2 319 // Expect shuffle after cancel: P3 P1 P2
320 mouse_location = position1; 320 mouse_location = position1;
321 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location); 321 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location);
322 EXPECT_EQ(position2, panel1->GetBounds().origin()); 322 EXPECT_EQ(position2, panel1->GetBounds().origin());
323 EXPECT_EQ(position3, panel2->GetBounds().origin()); 323 EXPECT_EQ(position3, panel2->GetBounds().origin());
324 EXPECT_EQ(position1, panel3->GetBounds().origin()); 324 EXPECT_EQ(position1, panel3->GetBounds().origin());
325 325
326 mouse_location = position2.Add(gfx::Point(1, 0)); 326 mouse_location = position2.Add(gfx::Vector2d(1, 0));
327 panel3_testing->DragTitlebar(mouse_location); 327 panel3_testing->DragTitlebar(mouse_location);
328 EXPECT_EQ(position1, panel1->GetBounds().origin()); 328 EXPECT_EQ(position1, panel1->GetBounds().origin());
329 EXPECT_EQ(position3, panel2->GetBounds().origin()); 329 EXPECT_EQ(position3, panel2->GetBounds().origin());
330 EXPECT_EQ(mouse_location, panel3->GetBounds().origin()); 330 EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
331 331
332 mouse_location = position3.Add(gfx::Point(1, 0)); 332 mouse_location = position3.Add(gfx::Vector2d(1, 0));
333 panel3_testing->DragTitlebar(mouse_location); 333 panel3_testing->DragTitlebar(mouse_location);
334 EXPECT_EQ(position1, panel1->GetBounds().origin()); 334 EXPECT_EQ(position1, panel1->GetBounds().origin());
335 EXPECT_EQ(position2, panel2->GetBounds().origin()); 335 EXPECT_EQ(position2, panel2->GetBounds().origin());
336 EXPECT_EQ(mouse_location, panel3->GetBounds().origin()); 336 EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
337 337
338 panel3_testing->CancelDragTitlebar(); 338 panel3_testing->CancelDragTitlebar();
339 EXPECT_EQ(position2, panel1->GetBounds().origin()); 339 EXPECT_EQ(position2, panel1->GetBounds().origin());
340 EXPECT_EQ(position3, panel2->GetBounds().origin()); 340 EXPECT_EQ(position3, panel2->GetBounds().origin());
341 EXPECT_EQ(position1, panel3->GetBounds().origin()); 341 EXPECT_EQ(position1, panel3->GetBounds().origin());
342 342
343 // Drag leftmost panel to become the rightmost in a single drag. The drag will 343 // Drag leftmost panel to become the rightmost in a single drag. The drag will
344 // shuffle 2 panels at a time. 344 // shuffle 2 panels at a time.
345 // Expect shuffle: P2 P3 P1 345 // Expect shuffle: P2 P3 P1
346 mouse_location = position3; 346 mouse_location = position3;
347 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); 347 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location);
348 EXPECT_EQ(position2, panel1->GetBounds().origin()); 348 EXPECT_EQ(position2, panel1->GetBounds().origin());
349 EXPECT_EQ(position3, panel2->GetBounds().origin()); 349 EXPECT_EQ(position3, panel2->GetBounds().origin());
350 EXPECT_EQ(position1, panel3->GetBounds().origin()); 350 EXPECT_EQ(position1, panel3->GetBounds().origin());
351 351
352 mouse_location = position1.Add(gfx::Point(1, 0)); 352 mouse_location = position1.Add(gfx::Vector2d(1, 0));
353 panel2_testing->DragTitlebar(mouse_location); 353 panel2_testing->DragTitlebar(mouse_location);
354 EXPECT_EQ(position3, panel1->GetBounds().origin()); 354 EXPECT_EQ(position3, panel1->GetBounds().origin());
355 EXPECT_EQ(mouse_location, panel2->GetBounds().origin()); 355 EXPECT_EQ(mouse_location, panel2->GetBounds().origin());
356 EXPECT_EQ(position2, panel3->GetBounds().origin()); 356 EXPECT_EQ(position2, panel3->GetBounds().origin());
357 357
358 panel2_testing->FinishDragTitlebar(); 358 panel2_testing->FinishDragTitlebar();
359 EXPECT_EQ(position3, panel1->GetBounds().origin()); 359 EXPECT_EQ(position3, panel1->GetBounds().origin());
360 EXPECT_EQ(position1, panel2->GetBounds().origin()); 360 EXPECT_EQ(position1, panel2->GetBounds().origin());
361 EXPECT_EQ(position2, panel3->GetBounds().origin()); 361 EXPECT_EQ(position2, panel3->GetBounds().origin());
362 362
363 // Drag rightmost panel to become the leftmost in a single drag. The drag will 363 // Drag rightmost panel to become the leftmost in a single drag. The drag will
364 // shuffle 2 panels at a time. 364 // shuffle 2 panels at a time.
365 // Expect shuffle: P3 P1 P2 365 // Expect shuffle: P3 P1 P2
366 mouse_location = position1; 366 mouse_location = position1;
367 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); 367 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location);
368 EXPECT_EQ(position3, panel1->GetBounds().origin()); 368 EXPECT_EQ(position3, panel1->GetBounds().origin());
369 EXPECT_EQ(position1, panel2->GetBounds().origin()); 369 EXPECT_EQ(position1, panel2->GetBounds().origin());
370 EXPECT_EQ(position2, panel3->GetBounds().origin()); 370 EXPECT_EQ(position2, panel3->GetBounds().origin());
371 371
372 mouse_location = position3.Add(gfx::Point(1, 0)); 372 mouse_location = position3.Add(gfx::Vector2d(1, 0));
373 panel2_testing->DragTitlebar(mouse_location); 373 panel2_testing->DragTitlebar(mouse_location);
374 EXPECT_EQ(position2, panel1->GetBounds().origin()); 374 EXPECT_EQ(position2, panel1->GetBounds().origin());
375 EXPECT_EQ(mouse_location, panel2->GetBounds().origin()); 375 EXPECT_EQ(mouse_location, panel2->GetBounds().origin());
376 EXPECT_EQ(position1, panel3->GetBounds().origin()); 376 EXPECT_EQ(position1, panel3->GetBounds().origin());
377 377
378 panel2_testing->FinishDragTitlebar(); 378 panel2_testing->FinishDragTitlebar();
379 EXPECT_EQ(position2, panel1->GetBounds().origin()); 379 EXPECT_EQ(position2, panel1->GetBounds().origin());
380 EXPECT_EQ(position3, panel2->GetBounds().origin()); 380 EXPECT_EQ(position3, panel2->GetBounds().origin());
381 EXPECT_EQ(position1, panel3->GetBounds().origin()); 381 EXPECT_EQ(position1, panel3->GetBounds().origin());
382 382
383 // Drag rightmost panel to become the leftmost in a single drag and then 383 // Drag rightmost panel to become the leftmost in a single drag and then
384 // cancel the drag. The drag will shuffle 2 panels and the cancellation will 384 // cancel the drag. The drag will shuffle 2 panels and the cancellation will
385 // restore all panels. 385 // restore all panels.
386 // Expect shuffle after drag: P1 P2 P3 386 // Expect shuffle after drag: P1 P2 P3
387 // Expect shuffle after cancel: P3 P1 P2 387 // Expect shuffle after cancel: P3 P1 P2
388 mouse_location = position1; 388 mouse_location = position1;
389 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location); 389 panel3_testing->PressLeftMouseButtonTitlebar(mouse_location);
390 EXPECT_EQ(position2, panel1->GetBounds().origin()); 390 EXPECT_EQ(position2, panel1->GetBounds().origin());
391 EXPECT_EQ(position3, panel2->GetBounds().origin()); 391 EXPECT_EQ(position3, panel2->GetBounds().origin());
392 EXPECT_EQ(position1, panel3->GetBounds().origin()); 392 EXPECT_EQ(position1, panel3->GetBounds().origin());
393 393
394 mouse_location = position3.Add(gfx::Point(1, 0)); 394 mouse_location = position3.Add(gfx::Vector2d(1, 0));
395 panel3_testing->DragTitlebar(mouse_location); 395 panel3_testing->DragTitlebar(mouse_location);
396 EXPECT_EQ(position1, panel1->GetBounds().origin()); 396 EXPECT_EQ(position1, panel1->GetBounds().origin());
397 EXPECT_EQ(position2, panel2->GetBounds().origin()); 397 EXPECT_EQ(position2, panel2->GetBounds().origin());
398 EXPECT_EQ(mouse_location, panel3->GetBounds().origin()); 398 EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
399 399
400 panel3_testing->CancelDragTitlebar(); 400 panel3_testing->CancelDragTitlebar();
401 EXPECT_EQ(position2, panel1->GetBounds().origin()); 401 EXPECT_EQ(position2, panel1->GetBounds().origin());
402 EXPECT_EQ(position3, panel2->GetBounds().origin()); 402 EXPECT_EQ(position3, panel2->GetBounds().origin());
403 EXPECT_EQ(position1, panel3->GetBounds().origin()); 403 EXPECT_EQ(position1, panel3->GetBounds().origin());
404 404
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 855
856 // Press on title-bar. 856 // Press on title-bar.
857 scoped_ptr<NativePanelTesting> panel_testing( 857 scoped_ptr<NativePanelTesting> panel_testing(
858 CreateNativePanelTesting(panel)); 858 CreateNativePanelTesting(panel));
859 gfx::Point mouse_location(panel->GetBounds().origin()); 859 gfx::Point mouse_location(panel->GetBounds().origin());
860 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 860 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
861 861
862 // Drag up the panel in a small offset that does not trigger the detach. 862 // Drag up the panel in a small offset that does not trigger the detach.
863 // Expect that the panel is still docked and only x coordinate of its position 863 // Expect that the panel is still docked and only x coordinate of its position
864 // is changed. 864 // is changed.
865 gfx::Point drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); 865 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
866 mouse_location = mouse_location.Add(drag_delta_to_remain_docked); 866 mouse_location = mouse_location.Add(drag_delta_to_remain_docked);
867 panel_testing->DragTitlebar(mouse_location); 867 panel_testing->DragTitlebar(mouse_location);
868 ASSERT_EQ(1, docked_strip->num_panels()); 868 ASSERT_EQ(1, docked_strip->num_panels());
869 ASSERT_EQ(0, detached_strip->num_panels()); 869 ASSERT_EQ(0, detached_strip->num_panels());
870 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 870 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
871 gfx::Rect panel_new_bounds = panel_old_bounds; 871 gfx::Rect panel_new_bounds = panel_old_bounds;
872 panel_new_bounds.Offset(drag_delta_to_remain_docked.x(), 0); 872 panel_new_bounds.Offset(drag_delta_to_remain_docked.x(), 0);
873 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 873 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
874 874
875 // Continue dragging up the panel in big offset that triggers the detach. 875 // Continue dragging up the panel in big offset that triggers the detach.
876 // Expect that the panel is previewed as detached. 876 // Expect that the panel is previewed as detached.
877 gfx::Point drag_delta_to_detach = GetDragDeltaToDetach(); 877 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
878 mouse_location = mouse_location.Add(drag_delta_to_detach); 878 mouse_location = mouse_location.Add(drag_delta_to_detach);
879 panel_testing->DragTitlebar(mouse_location); 879 panel_testing->DragTitlebar(mouse_location);
880 ASSERT_EQ(0, docked_strip->num_panels()); 880 ASSERT_EQ(0, docked_strip->num_panels());
881 ASSERT_EQ(1, detached_strip->num_panels()); 881 ASSERT_EQ(1, detached_strip->num_panels());
882 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 882 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
883 panel_new_bounds.Offset( 883 panel_new_bounds.Offset(
884 drag_delta_to_detach.x(), 884 drag_delta_to_detach.x(),
885 drag_delta_to_detach.y() + drag_delta_to_remain_docked.y()); 885 drag_delta_to_detach.y() + drag_delta_to_remain_docked.y());
886 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 886 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
887 887
(...skipping 22 matching lines...) Expand all
910 910
911 // Press on title-bar. 911 // Press on title-bar.
912 scoped_ptr<NativePanelTesting> panel_testing( 912 scoped_ptr<NativePanelTesting> panel_testing(
913 CreateNativePanelTesting(panel)); 913 CreateNativePanelTesting(panel));
914 gfx::Point mouse_location(panel->GetBounds().origin()); 914 gfx::Point mouse_location(panel->GetBounds().origin());
915 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 915 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
916 916
917 // Drag up the panel in a small offset that does not trigger the detach. 917 // Drag up the panel in a small offset that does not trigger the detach.
918 // Expect that the panel is still docked and only x coordinate of its position 918 // Expect that the panel is still docked and only x coordinate of its position
919 // is changed. 919 // is changed.
920 gfx::Point drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); 920 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
921 mouse_location = mouse_location.Add(drag_delta_to_remain_docked); 921 mouse_location = mouse_location.Add(drag_delta_to_remain_docked);
922 panel_testing->DragTitlebar(mouse_location); 922 panel_testing->DragTitlebar(mouse_location);
923 ASSERT_EQ(1, docked_strip->num_panels()); 923 ASSERT_EQ(1, docked_strip->num_panels());
924 ASSERT_EQ(0, detached_strip->num_panels()); 924 ASSERT_EQ(0, detached_strip->num_panels());
925 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 925 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
926 gfx::Rect panel_new_bounds = panel_old_bounds; 926 gfx::Rect panel_new_bounds = panel_old_bounds;
927 panel_new_bounds.Offset(drag_delta_to_remain_docked.x(), 0); 927 panel_new_bounds.Offset(drag_delta_to_remain_docked.x(), 0);
928 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 928 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
929 929
930 // Continue dragging up the panel in big offset that triggers the detach. 930 // Continue dragging up the panel in big offset that triggers the detach.
931 // Expect that the panel is previewed as detached. 931 // Expect that the panel is previewed as detached.
932 gfx::Point drag_delta_to_detach = GetDragDeltaToDetach(); 932 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
933 mouse_location = mouse_location.Add(drag_delta_to_detach); 933 mouse_location = mouse_location.Add(drag_delta_to_detach);
934 panel_testing->DragTitlebar(mouse_location); 934 panel_testing->DragTitlebar(mouse_location);
935 ASSERT_EQ(0, docked_strip->num_panels()); 935 ASSERT_EQ(0, docked_strip->num_panels());
936 ASSERT_EQ(1, detached_strip->num_panels()); 936 ASSERT_EQ(1, detached_strip->num_panels());
937 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 937 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
938 panel_new_bounds.Offset( 938 panel_new_bounds.Offset(
939 drag_delta_to_detach.x(), 939 drag_delta_to_detach.x(),
940 drag_delta_to_detach.y() + drag_delta_to_remain_docked.y()); 940 drag_delta_to_detach.y() + drag_delta_to_remain_docked.y());
941 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 941 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
942 942
(...skipping 22 matching lines...) Expand all
965 gfx::Rect panel_old_bounds = panel->GetBounds(); 965 gfx::Rect panel_old_bounds = panel->GetBounds();
966 966
967 // Press on title-bar. 967 // Press on title-bar.
968 scoped_ptr<NativePanelTesting> panel_testing( 968 scoped_ptr<NativePanelTesting> panel_testing(
969 CreateNativePanelTesting(panel)); 969 CreateNativePanelTesting(panel));
970 gfx::Point mouse_location(panel->GetBounds().origin()); 970 gfx::Point mouse_location(panel->GetBounds().origin());
971 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 971 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
972 972
973 // Drag down the panel but not close enough to the bottom of work area. 973 // Drag down the panel but not close enough to the bottom of work area.
974 // Expect that the panel is still detached. 974 // Expect that the panel is still detached.
975 gfx::Point drag_delta_to_remain_detached = 975 gfx::Vector2d drag_delta_to_remain_detached =
976 GetDragDeltaToRemainDetached(panel); 976 GetDragDeltaToRemainDetached(panel);
977 mouse_location = mouse_location.Add(drag_delta_to_remain_detached); 977 mouse_location = mouse_location.Add(drag_delta_to_remain_detached);
978 panel_testing->DragTitlebar(mouse_location); 978 panel_testing->DragTitlebar(mouse_location);
979 ASSERT_EQ(0, docked_strip->num_panels()); 979 ASSERT_EQ(0, docked_strip->num_panels());
980 ASSERT_EQ(1, detached_strip->num_panels()); 980 ASSERT_EQ(1, detached_strip->num_panels());
981 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 981 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
982 gfx::Rect panel_new_bounds = panel_old_bounds; 982 gfx::Rect panel_new_bounds = panel_old_bounds;
983 panel_new_bounds.Offset(drag_delta_to_remain_detached); 983 panel_new_bounds.Offset(drag_delta_to_remain_detached);
984 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 984 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
985 985
986 // Continue dragging down the panel to make it close enough to the bottom of 986 // Continue dragging down the panel to make it close enough to the bottom of
987 // work area. 987 // work area.
988 // Expect that the panel is previewed as docked. 988 // Expect that the panel is previewed as docked.
989 gfx::Point drag_delta_to_attach = GetDragDeltaToAttach(panel); 989 gfx::Vector2d drag_delta_to_attach = GetDragDeltaToAttach(panel);
990 mouse_location = mouse_location.Add(drag_delta_to_attach); 990 mouse_location = mouse_location.Add(drag_delta_to_attach);
991 panel_testing->DragTitlebar(mouse_location); 991 panel_testing->DragTitlebar(mouse_location);
992 ASSERT_EQ(1, docked_strip->num_panels()); 992 ASSERT_EQ(1, docked_strip->num_panels());
993 ASSERT_EQ(0, detached_strip->num_panels()); 993 ASSERT_EQ(0, detached_strip->num_panels());
994 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 994 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
995 panel_new_bounds.Offset(drag_delta_to_attach); 995 panel_new_bounds.Offset(drag_delta_to_attach);
996 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 996 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
997 997
998 // Finish the drag. 998 // Finish the drag.
999 // Expect that the panel stays as docked and moves to the final position. 999 // Expect that the panel stays as docked and moves to the final position.
(...skipping 24 matching lines...) Expand all
1024 gfx::Rect panel_old_bounds = panel->GetBounds(); 1024 gfx::Rect panel_old_bounds = panel->GetBounds();
1025 1025
1026 // Press on title-bar. 1026 // Press on title-bar.
1027 scoped_ptr<NativePanelTesting> panel_testing( 1027 scoped_ptr<NativePanelTesting> panel_testing(
1028 CreateNativePanelTesting(panel)); 1028 CreateNativePanelTesting(panel));
1029 gfx::Point mouse_location(panel->GetBounds().origin()); 1029 gfx::Point mouse_location(panel->GetBounds().origin());
1030 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 1030 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
1031 1031
1032 // Drag down the panel but not close enough to the bottom of work area. 1032 // Drag down the panel but not close enough to the bottom of work area.
1033 // Expect that the panel is still detached. 1033 // Expect that the panel is still detached.
1034 gfx::Point drag_delta_to_remain_detached = 1034 gfx::Vector2d drag_delta_to_remain_detached =
1035 GetDragDeltaToRemainDetached(panel); 1035 GetDragDeltaToRemainDetached(panel);
1036 mouse_location = mouse_location.Add(drag_delta_to_remain_detached); 1036 mouse_location = mouse_location.Add(drag_delta_to_remain_detached);
1037 panel_testing->DragTitlebar(mouse_location); 1037 panel_testing->DragTitlebar(mouse_location);
1038 ASSERT_EQ(0, docked_strip->num_panels()); 1038 ASSERT_EQ(0, docked_strip->num_panels());
1039 ASSERT_EQ(1, detached_strip->num_panels()); 1039 ASSERT_EQ(1, detached_strip->num_panels());
1040 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 1040 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
1041 gfx::Rect panel_new_bounds = panel_old_bounds; 1041 gfx::Rect panel_new_bounds = panel_old_bounds;
1042 panel_new_bounds.Offset(drag_delta_to_remain_detached); 1042 panel_new_bounds.Offset(drag_delta_to_remain_detached);
1043 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 1043 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
1044 1044
1045 // Continue dragging down the panel to make it close enough to the bottom of 1045 // Continue dragging down the panel to make it close enough to the bottom of
1046 // work area. 1046 // work area.
1047 // Expect that the panel is previewed as docked. 1047 // Expect that the panel is previewed as docked.
1048 gfx::Point drag_delta_to_attach = GetDragDeltaToAttach(panel); 1048 gfx::Vector2d drag_delta_to_attach = GetDragDeltaToAttach(panel);
1049 mouse_location = mouse_location.Add(drag_delta_to_attach); 1049 mouse_location = mouse_location.Add(drag_delta_to_attach);
1050 panel_testing->DragTitlebar(mouse_location); 1050 panel_testing->DragTitlebar(mouse_location);
1051 ASSERT_EQ(1, docked_strip->num_panels()); 1051 ASSERT_EQ(1, docked_strip->num_panels());
1052 ASSERT_EQ(0, detached_strip->num_panels()); 1052 ASSERT_EQ(0, detached_strip->num_panels());
1053 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 1053 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
1054 panel_new_bounds.Offset(drag_delta_to_attach); 1054 panel_new_bounds.Offset(drag_delta_to_attach);
1055 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 1055 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
1056 1056
1057 // Cancel the drag. 1057 // Cancel the drag.
1058 // Expect that the panel is back as detached. 1058 // Expect that the panel is back as detached.
(...skipping 19 matching lines...) Expand all
1078 gfx::Rect panel_old_bounds = panel->GetBounds(); 1078 gfx::Rect panel_old_bounds = panel->GetBounds();
1079 1079
1080 // Press on title-bar. 1080 // Press on title-bar.
1081 scoped_ptr<NativePanelTesting> panel_testing( 1081 scoped_ptr<NativePanelTesting> panel_testing(
1082 CreateNativePanelTesting(panel)); 1082 CreateNativePanelTesting(panel));
1083 gfx::Point mouse_location(panel->GetBounds().origin()); 1083 gfx::Point mouse_location(panel->GetBounds().origin());
1084 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 1084 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
1085 1085
1086 // Drag up the panel to trigger the detach. 1086 // Drag up the panel to trigger the detach.
1087 // Expect that the panel is previewed as detached. 1087 // Expect that the panel is previewed as detached.
1088 gfx::Point drag_delta_to_detach = GetDragDeltaToDetach(); 1088 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
1089 mouse_location = mouse_location.Add(drag_delta_to_detach); 1089 mouse_location = mouse_location.Add(drag_delta_to_detach);
1090 panel_testing->DragTitlebar(mouse_location); 1090 panel_testing->DragTitlebar(mouse_location);
1091 ASSERT_EQ(0, docked_strip->num_panels()); 1091 ASSERT_EQ(0, docked_strip->num_panels());
1092 ASSERT_EQ(1, detached_strip->num_panels()); 1092 ASSERT_EQ(1, detached_strip->num_panels());
1093 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 1093 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
1094 gfx::Rect panel_new_bounds = panel_old_bounds; 1094 gfx::Rect panel_new_bounds = panel_old_bounds;
1095 panel_new_bounds.Offset(drag_delta_to_detach); 1095 panel_new_bounds.Offset(drag_delta_to_detach);
1096 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 1096 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
1097 1097
1098 // Continue dragging down the panel to trigger the re-attach. 1098 // Continue dragging down the panel to trigger the re-attach.
1099 gfx::Point drag_delta_to_reattach = GetDragDeltaToAttach(panel); 1099 gfx::Vector2d drag_delta_to_reattach = GetDragDeltaToAttach(panel);
1100 mouse_location = mouse_location.Add(drag_delta_to_reattach); 1100 mouse_location = mouse_location.Add(drag_delta_to_reattach);
1101 panel_testing->DragTitlebar(mouse_location); 1101 panel_testing->DragTitlebar(mouse_location);
1102 ASSERT_EQ(1, docked_strip->num_panels()); 1102 ASSERT_EQ(1, docked_strip->num_panels());
1103 ASSERT_EQ(0, detached_strip->num_panels()); 1103 ASSERT_EQ(0, detached_strip->num_panels());
1104 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 1104 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
1105 panel_new_bounds.Offset(drag_delta_to_reattach); 1105 panel_new_bounds.Offset(drag_delta_to_reattach);
1106 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 1106 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
1107 1107
1108 // Continue dragging up the panel to trigger the detach again. 1108 // Continue dragging up the panel to trigger the detach again.
1109 gfx::Point drag_delta_to_detach_again = GetDragDeltaToDetach(); 1109 gfx::Vector2d drag_delta_to_detach_again = GetDragDeltaToDetach();
1110 mouse_location = mouse_location.Add(drag_delta_to_detach_again); 1110 mouse_location = mouse_location.Add(drag_delta_to_detach_again);
1111 panel_testing->DragTitlebar(mouse_location); 1111 panel_testing->DragTitlebar(mouse_location);
1112 ASSERT_EQ(0, docked_strip->num_panels()); 1112 ASSERT_EQ(0, docked_strip->num_panels());
1113 ASSERT_EQ(1, detached_strip->num_panels()); 1113 ASSERT_EQ(1, detached_strip->num_panels());
1114 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 1114 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
1115 panel_new_bounds.Offset(drag_delta_to_detach_again); 1115 panel_new_bounds.Offset(drag_delta_to_detach_again);
1116 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); 1116 EXPECT_EQ(panel_new_bounds, panel->GetBounds());
1117 1117
1118 // Cancel the drag. 1118 // Cancel the drag.
1119 // Expect that the panel stays as docked. 1119 // Expect that the panel stays as docked.
1120 panel_testing->CancelDragTitlebar(); 1120 panel_testing->CancelDragTitlebar();
1121 ASSERT_EQ(1, docked_strip->num_panels()); 1121 ASSERT_EQ(1, docked_strip->num_panels());
1122 ASSERT_EQ(0, detached_strip->num_panels()); 1122 ASSERT_EQ(0, detached_strip->num_panels());
1123 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); 1123 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type());
1124 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); 1124 EXPECT_EQ(panel_old_bounds, panel->GetBounds());
1125 1125
1126 panel_manager->CloseAll(); 1126 panel_manager->CloseAll();
1127 } 1127 }
1128 1128
1129 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachWithSqueeze) { 1129 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachWithSqueeze) {
1130 PanelManager* panel_manager = PanelManager::GetInstance(); 1130 PanelManager* panel_manager = PanelManager::GetInstance();
1131 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); 1131 DockedPanelStrip* docked_strip = panel_manager->docked_strip();
1132 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); 1132 DetachedPanelStrip* detached_strip = panel_manager->detached_strip();
1133 1133
1134 gfx::Point drag_delta_to_detach = GetDragDeltaToDetach(); 1134 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
1135 1135
1136 // Create some docked panels. 1136 // Create some docked panels.
1137 // docked: P1 P2 P3 P4 P5 1137 // docked: P1 P2 P3 P4 P5
1138 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); 1138 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100));
1139 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); 1139 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100));
1140 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); 1140 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100));
1141 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); 1141 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100));
1142 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); 1142 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100));
1143 ASSERT_EQ(0, detached_strip->num_panels()); 1143 ASSERT_EQ(0, detached_strip->num_panels());
1144 ASSERT_EQ(5, docked_strip->num_panels()); 1144 ASSERT_EQ(5, docked_strip->num_panels());
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 1339
1340 // Drag down the panel. Expect that the panel can be dragged without 1340 // Drag down the panel. Expect that the panel can be dragged without
1341 // constraint. 1341 // constraint.
1342 drag_to_location = gfx::Point(280, 150); 1342 drag_to_location = gfx::Point(280, 150);
1343 DragPanelToMouseLocation(panel, drag_to_location); 1343 DragPanelToMouseLocation(panel, drag_to_location);
1344 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); 1344 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type());
1345 EXPECT_EQ(drag_to_location, panel->GetBounds().origin()); 1345 EXPECT_EQ(drag_to_location, panel->GetBounds().origin());
1346 1346
1347 panel_manager->CloseAll(); 1347 panel_manager->CloseAll();
1348 } 1348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698