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

Side by Side Diff: ash/wm/panels/panel_window_resizer_unittest.cc

Issue 16539005: Skip mulitple-dispay tests on win8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, and comment Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/panels/panel_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) { 259 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) {
260 ash::Shell* shell = ash::Shell::GetInstance(); 260 ash::Shell* shell = ash::Shell::GetInstance();
261 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow()); 261 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow());
262 scoped_ptr<aura::Window> window( 262 scoped_ptr<aura::Window> window(
263 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 263 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
264 DetachReattachTest(window.get(), 0, 1); 264 DetachReattachTest(window.get(), 0, 1);
265 } 265 }
266 266
267 #if defined(OS_WIN) 267 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) {
268 // Multiple displays aren't supported on Windows Metro/Ash. 268 RETURN_IF_WIN8;
269 // http://crbug.com/165962
270 #define MAYBE_PanelDetachReattachMultipleDisplays \
271 DISABLED_PanelDetachReattachMultipleDisplays
272 #define MAYBE_DetachThenDragAcrossDisplays DISABLED_DetachThenDragAcrossDisplays
273 #define MAYBE_DetachAcrossDisplays DISABLED_DetachAcrossDisplays
274 #define MAYBE_DetachThenAttachToSecondDisplay \
275 DISABLED_DetachThenAttachToSecondDisplay
276 #define MAYBE_AttachToSecondDisplay DISABLED_AttachToSecondDisplay
277 #else
278 #define MAYBE_PanelDetachReattachMultipleDisplays \
279 PanelDetachReattachMultipleDisplays
280 #define MAYBE_DetachThenDragAcrossDisplays DetachThenDragAcrossDisplays
281 #define MAYBE_DetachAcrossDisplays DetachAcrossDisplays
282 #define MAYBE_DetachThenAttachToSecondDisplay DetachThenAttachToSecondDisplay
283 #define MAYBE_AttachToSecondDisplay AttachToSecondDisplay
284 #endif
285 269
286 TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachMultipleDisplays) {
287 UpdateDisplay("600x400,600x400"); 270 UpdateDisplay("600x400,600x400");
288 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 271 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
289 scoped_ptr<aura::Window> window( 272 scoped_ptr<aura::Window> window(
290 CreatePanelWindow(gfx::Rect(600, 0, 201, 201))); 273 CreatePanelWindow(gfx::Rect(600, 0, 201, 201)));
291 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 274 EXPECT_EQ(root_windows[1], window->GetRootWindow());
292 DetachReattachTest(window.get(), 0, -1); 275 DetachReattachTest(window.get(), 0, -1);
293 } 276 }
294 277
295 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenDragAcrossDisplays) { 278 TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) {
279 RETURN_IF_WIN8;
280
296 UpdateDisplay("600x400,600x400"); 281 UpdateDisplay("600x400,600x400");
297 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 282 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
298 scoped_ptr<aura::Window> window( 283 scoped_ptr<aura::Window> window(
299 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 284 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
300 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 285 gfx::Rect initial_bounds = window->GetBoundsInScreen();
301 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 286 EXPECT_EQ(root_windows[0], window->GetRootWindow());
302 DragStart(window.get()); 287 DragStart(window.get());
303 DragMove(0, -100); 288 DragMove(0, -100);
304 DragEnd(); 289 DragEnd();
305 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 290 EXPECT_EQ(root_windows[0], window->GetRootWindow());
306 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); 291 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
307 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 292 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
308 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 293 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
309 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 294 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
310 window->parent()->id()); 295 window->parent()->id());
311 296
312 DragStart(window.get()); 297 DragStart(window.get());
313 DragMove(500, 0); 298 DragMove(500, 0);
314 DragEnd(); 299 DragEnd();
315 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 300 EXPECT_EQ(root_windows[1], window->GetRootWindow());
316 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 301 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
317 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 302 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
318 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 303 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
319 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 304 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
320 window->parent()->id()); 305 window->parent()->id());
321 } 306 }
322 307
323 TEST_F(PanelWindowResizerTest, MAYBE_DetachAcrossDisplays) { 308 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) {
309 RETURN_IF_WIN8;
310
324 UpdateDisplay("600x400,600x400"); 311 UpdateDisplay("600x400,600x400");
325 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 312 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
326 scoped_ptr<aura::Window> window( 313 scoped_ptr<aura::Window> window(
327 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 314 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
328 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 315 gfx::Rect initial_bounds = window->GetBoundsInScreen();
329 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 316 EXPECT_EQ(root_windows[0], window->GetRootWindow());
330 DragStart(window.get()); 317 DragStart(window.get());
331 DragMove(500, -100); 318 DragMove(500, -100);
332 DragEnd(); 319 DragEnd();
333 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 320 EXPECT_EQ(root_windows[1], window->GetRootWindow());
334 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 321 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
335 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 322 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
336 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 323 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
337 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 324 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
338 window->parent()->id()); 325 window->parent()->id());
339 } 326 }
340 327
341 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenAttachToSecondDisplay) { 328 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) {
329 RETURN_IF_WIN8;
330
342 UpdateDisplay("600x400,600x600"); 331 UpdateDisplay("600x400,600x600");
343 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 332 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
344 scoped_ptr<aura::Window> window( 333 scoped_ptr<aura::Window> window(
345 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 334 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
346 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 335 gfx::Rect initial_bounds = window->GetBoundsInScreen();
347 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 336 EXPECT_EQ(root_windows[0], window->GetRootWindow());
348 337
349 // Detach the window. 338 // Detach the window.
350 DragStart(window.get()); 339 DragStart(window.get());
351 DragMove(0, -100); 340 DragMove(0, -100);
352 DragEnd(); 341 DragEnd();
353 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 342 EXPECT_EQ(root_windows[0], window->GetRootWindow());
354 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 343 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
355 344
356 // Drag the window just above the other display's launcher. 345 // Drag the window just above the other display's launcher.
357 DragStart(window.get()); 346 DragStart(window.get());
358 DragMove(500, 295); 347 DragMove(500, 295);
359 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 348 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
360 349
361 // Should stick to other launcher. 350 // Should stick to other launcher.
362 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); 351 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y());
363 DragEnd(); 352 DragEnd();
364 353
365 // When dropped should move to second display's panel container. 354 // When dropped should move to second display's panel container.
366 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 355 EXPECT_EQ(root_windows[1], window->GetRootWindow());
367 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); 356 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
368 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); 357 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
369 } 358 }
370 359
371 TEST_F(PanelWindowResizerTest, MAYBE_AttachToSecondDisplay) { 360 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) {
361 RETURN_IF_WIN8;
362
372 UpdateDisplay("600x400,600x600"); 363 UpdateDisplay("600x400,600x600");
373 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 364 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
374 scoped_ptr<aura::Window> window( 365 scoped_ptr<aura::Window> window(
375 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 366 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
376 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 367 gfx::Rect initial_bounds = window->GetBoundsInScreen();
377 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 368 EXPECT_EQ(root_windows[0], window->GetRootWindow());
378 369
379 // Drag the window just above the other display's launcher. 370 // Drag the window just above the other display's launcher.
380 DragStart(window.get()); 371 DragStart(window.get());
381 DragMove(500, 195); 372 DragMove(500, 195);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ash::Shell* shell = ash::Shell::GetInstance(); 439 ash::Shell* shell = ash::Shell::GetInstance();
449 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); 440 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow());
450 DragAlongShelfReorder(0, -1); 441 DragAlongShelfReorder(0, -1);
451 } 442 }
452 443
453 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, 444 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest,
454 testing::Bool()); 445 testing::Bool());
455 446
456 } // namespace internal 447 } // namespace internal
457 } // namespace ash 448 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698