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

Side by Side Diff: ash/wm/workspace/workspace_event_handler_unittest.cc

Issue 2055273004: Remove unused variables, ash/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_event_handler.h" 5 #include "ash/wm/workspace/workspace_event_handler.h"
6 6
7 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm/wm_event.h" 8 #include "ash/common/wm/wm_event.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 TEST_F(WorkspaceEventHandlerTest, 254 TEST_F(WorkspaceEventHandlerTest,
255 DoubleClickSingleAxisDoesntResizeVerticalEdgeIfConstrained) { 255 DoubleClickSingleAxisDoesntResizeVerticalEdgeIfConstrained) {
256 gfx::Rect restored_bounds(10, 10, 50, 50); 256 gfx::Rect restored_bounds(10, 10, 50, 50);
257 aura::test::TestWindowDelegate delegate; 257 aura::test::TestWindowDelegate delegate;
258 std::unique_ptr<aura::Window> window( 258 std::unique_ptr<aura::Window> window(
259 CreateTestWindow(&delegate, restored_bounds)); 259 CreateTestWindow(&delegate, restored_bounds));
260 260
261 wm::ActivateWindow(window.get()); 261 wm::ActivateWindow(window.get());
262 262
263 gfx::Rect work_area = display::Screen::GetScreen()
264 ->GetDisplayNearestWindow(window.get())
265 .work_area();
266
267 delegate.set_maximum_size(gfx::Size(0, 100)); 263 delegate.set_maximum_size(gfx::Size(0, 100));
268 264
269 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 265 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
270 window.get()); 266 window.get());
271 // Double-click the top resize edge. 267 // Double-click the top resize edge.
272 delegate.set_window_component(HTTOP); 268 delegate.set_window_component(HTTOP);
273 generator.DoubleClickLeftButton(); 269 generator.DoubleClickLeftButton();
274 270
275 // The size of the window should be unchanged. 271 // The size of the window should be unchanged.
276 EXPECT_EQ(restored_bounds.y(), window->bounds().y()); 272 EXPECT_EQ(restored_bounds.y(), window->bounds().y());
277 EXPECT_EQ(restored_bounds.height(), window->bounds().height()); 273 EXPECT_EQ(restored_bounds.height(), window->bounds().height());
278 } 274 }
279 275
280 TEST_F(WorkspaceEventHandlerTest, 276 TEST_F(WorkspaceEventHandlerTest,
281 DoubleClickSingleAxisDoesntResizeHorizontalEdgeIfConstrained) { 277 DoubleClickSingleAxisDoesntResizeHorizontalEdgeIfConstrained) {
282 gfx::Rect restored_bounds(10, 10, 50, 50); 278 gfx::Rect restored_bounds(10, 10, 50, 50);
283 aura::test::TestWindowDelegate delegate; 279 aura::test::TestWindowDelegate delegate;
284 std::unique_ptr<aura::Window> window( 280 std::unique_ptr<aura::Window> window(
285 CreateTestWindow(&delegate, restored_bounds)); 281 CreateTestWindow(&delegate, restored_bounds));
286 282
287 wm::ActivateWindow(window.get()); 283 wm::ActivateWindow(window.get());
288 284
289 gfx::Rect work_area = display::Screen::GetScreen()
290 ->GetDisplayNearestWindow(window.get())
291 .work_area();
292
293 delegate.set_maximum_size(gfx::Size(100, 0)); 285 delegate.set_maximum_size(gfx::Size(100, 0));
294 286
295 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 287 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
296 window.get()); 288 window.get());
297 // Double-click the top resize edge. 289 // Double-click the top resize edge.
298 delegate.set_window_component(HTRIGHT); 290 delegate.set_window_component(HTRIGHT);
299 generator.DoubleClickLeftButton(); 291 generator.DoubleClickLeftButton();
300 292
301 // The size of the window should be unchanged. 293 // The size of the window should be unchanged.
302 EXPECT_EQ(restored_bounds.x(), window->bounds().x()); 294 EXPECT_EQ(restored_bounds.x(), window->bounds().x());
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // Verifies that double clicking in the header does not maximize if the target 465 // Verifies that double clicking in the header does not maximize if the target
474 // component has changed. 466 // component has changed.
475 TEST_F(WorkspaceEventHandlerTest, 467 TEST_F(WorkspaceEventHandlerTest,
476 DoubleClickTwoDifferentTargetsDoesntMaximize) { 468 DoubleClickTwoDifferentTargetsDoesntMaximize) {
477 aura::test::TestWindowDelegate delegate; 469 aura::test::TestWindowDelegate delegate;
478 std::unique_ptr<aura::Window> window( 470 std::unique_ptr<aura::Window> window(
479 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); 471 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40)));
480 window->SetProperty(aura::client::kCanMaximizeKey, true); 472 window->SetProperty(aura::client::kCanMaximizeKey, true);
481 473
482 wm::WindowState* window_state = wm::GetWindowState(window.get()); 474 wm::WindowState* window_state = wm::GetWindowState(window.get());
483 gfx::Rect restore_bounds = window->bounds();
484 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
485 window.get());
486
487 EXPECT_FALSE(window_state->IsMaximized()); 475 EXPECT_FALSE(window_state->IsMaximized());
488 476
489 // First click will go to a client 477 // First click will go to a client
490 delegate.set_window_component(HTCLIENT); 478 delegate.set_window_component(HTCLIENT);
491 aura::Window* root = Shell::GetPrimaryRootWindow(); 479 aura::Window* root = Shell::GetPrimaryRootWindow();
492 ui::test::EventGenerator generator(root, window.get()); 480 ui::test::EventGenerator generator(root, window.get());
493 generator.ClickLeftButton(); 481 generator.ClickLeftButton();
494 EXPECT_FALSE(window_state->IsMaximized()); 482 EXPECT_FALSE(window_state->IsMaximized());
495 483
496 // Second click will go to the header 484 // Second click will go to the header
497 delegate.set_window_component(HTCAPTION); 485 delegate.set_window_component(HTCAPTION);
498 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON, 486 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON,
499 ui::EF_IS_DOUBLE_CLICK); 487 ui::EF_IS_DOUBLE_CLICK);
500 EXPECT_FALSE(window_state->IsMaximized()); 488 EXPECT_FALSE(window_state->IsMaximized());
501 } 489 }
502 490
503 // Verifies that double tapping in the header does not maximize if the target 491 // Verifies that double tapping in the header does not maximize if the target
504 // component has changed. 492 // component has changed.
505 TEST_F(WorkspaceEventHandlerTest, DoubleTapTwoDifferentTargetsDoesntMaximize) { 493 TEST_F(WorkspaceEventHandlerTest, DoubleTapTwoDifferentTargetsDoesntMaximize) {
506 aura::test::TestWindowDelegate delegate; 494 aura::test::TestWindowDelegate delegate;
507 std::unique_ptr<aura::Window> window( 495 std::unique_ptr<aura::Window> window(
508 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); 496 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40)));
509 window->SetProperty(aura::client::kCanMaximizeKey, true); 497 window->SetProperty(aura::client::kCanMaximizeKey, true);
510 498
511 wm::WindowState* window_state = wm::GetWindowState(window.get()); 499 wm::WindowState* window_state = wm::GetWindowState(window.get());
512 gfx::Rect restore_bounds = window->bounds();
513 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
514 window.get());
515
516 EXPECT_FALSE(window_state->IsMaximized()); 500 EXPECT_FALSE(window_state->IsMaximized());
517 501
518 // First tap will go to a client 502 // First tap will go to a client
519 delegate.set_window_component(HTCLIENT); 503 delegate.set_window_component(HTCLIENT);
520 aura::Window* root = Shell::GetPrimaryRootWindow(); 504 aura::Window* root = Shell::GetPrimaryRootWindow();
521 ui::test::EventGenerator generator(root, window.get()); 505 ui::test::EventGenerator generator(root, window.get());
522 generator.GestureTapAt(gfx::Point(25, 25)); 506 generator.GestureTapAt(gfx::Point(25, 25));
523 EXPECT_FALSE(window_state->IsMaximized()); 507 EXPECT_FALSE(window_state->IsMaximized());
524 508
525 // Second tap will go to the header 509 // Second tap will go to the header
526 delegate.set_window_component(HTCAPTION); 510 delegate.set_window_component(HTCAPTION);
527 generator.GestureTapAt(gfx::Point(25, 25)); 511 generator.GestureTapAt(gfx::Point(25, 25));
528 EXPECT_FALSE(window_state->IsMaximized()); 512 EXPECT_FALSE(window_state->IsMaximized());
529 } 513 }
530 514
531 TEST_F(WorkspaceEventHandlerTest, 515 TEST_F(WorkspaceEventHandlerTest,
532 RightClickDuringDoubleClickDoesntMaximize) { 516 RightClickDuringDoubleClickDoesntMaximize) {
533 aura::test::TestWindowDelegate delegate; 517 aura::test::TestWindowDelegate delegate;
534 std::unique_ptr<aura::Window> window( 518 std::unique_ptr<aura::Window> window(
535 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); 519 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40)));
536 window->SetProperty(aura::client::kCanMaximizeKey, true); 520 window->SetProperty(aura::client::kCanMaximizeKey, true);
537 521
538 wm::WindowState* window_state = wm::GetWindowState(window.get()); 522 wm::WindowState* window_state = wm::GetWindowState(window.get());
539 gfx::Rect restore_bounds = window->bounds();
540 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
541 window.get());
542
543 EXPECT_FALSE(window_state->IsMaximized()); 523 EXPECT_FALSE(window_state->IsMaximized());
544 524
545 // First click will go to a client 525 // First click will go to a client
546 delegate.set_window_component(HTCLIENT); 526 delegate.set_window_component(HTCLIENT);
547 aura::Window* root = Shell::GetPrimaryRootWindow(); 527 aura::Window* root = Shell::GetPrimaryRootWindow();
548 ui::test::EventGenerator generator(root, window.get()); 528 ui::test::EventGenerator generator(root, window.get());
549 generator.ClickLeftButton(); 529 generator.ClickLeftButton();
550 EXPECT_FALSE(window_state->IsMaximized()); 530 EXPECT_FALSE(window_state->IsMaximized());
551 531
552 // Second click will go to the header 532 // Second click will go to the header
553 delegate.set_window_component(HTCAPTION); 533 delegate.set_window_component(HTCAPTION);
554 generator.PressRightButton(); 534 generator.PressRightButton();
555 generator.ReleaseRightButton(); 535 generator.ReleaseRightButton();
556 EXPECT_FALSE(window_state->IsMaximized()); 536 EXPECT_FALSE(window_state->IsMaximized());
557 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON, 537 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON,
558 ui::EF_IS_DOUBLE_CLICK); 538 ui::EF_IS_DOUBLE_CLICK);
559 EXPECT_FALSE(window_state->IsMaximized()); 539 EXPECT_FALSE(window_state->IsMaximized());
560 } 540 }
561 541
562 } // namespace ash 542 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698