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

Side by Side Diff: ui/views/controls/button/custom_button_unittest.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 years, 10 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 | « ui/views/cocoa/tooltip_manager_mac.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | 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 "ui/views/controls/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 Textfield textfield; 437 Textfield textfield;
438 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield)); 438 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield));
439 } 439 }
440 440
441 // Tests that pressing a button shows the ink drop and releasing the button 441 // Tests that pressing a button shows the ink drop and releasing the button
442 // does not hide the ink drop. 442 // does not hide the ink drop.
443 // Note: Ink drop is not hidden upon release because CustomButton descendants 443 // Note: Ink drop is not hidden upon release because CustomButton descendants
444 // may enter a different ink drop state. 444 // may enter a different ink drop state.
445 TEST_F(CustomButtonTest, ButtonClickTogglesInkDrop) { 445 TEST_F(CustomButtonTest, ButtonClickTogglesInkDrop) {
446 gfx::Point old_cursor = gfx::Screen::GetScreenFor( 446 gfx::Point old_cursor = gfx::Screen::GetScreen()->GetCursorScreenPoint();
447 widget()->GetNativeView())->GetCursorScreenPoint();
448 CreateButtonWithInkDrop(); 447 CreateButtonWithInkDrop();
449 448
450 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow()); 449 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow());
451 generator.set_current_location(gfx::Point(50, 50)); 450 generator.set_current_location(gfx::Point(50, 50));
452 generator.PressLeftButton(); 451 generator.PressLeftButton();
453 EXPECT_TRUE(ink_shown()); 452 EXPECT_TRUE(ink_shown());
454 EXPECT_FALSE(ink_hidden()); 453 EXPECT_FALSE(ink_hidden());
455 454
456 generator.ReleaseLeftButton(); 455 generator.ReleaseLeftButton();
457 EXPECT_FALSE(ink_hidden()); 456 EXPECT_FALSE(ink_hidden());
458 } 457 }
459 458
460 // Tests that pressing a button shows and releasing capture hides ink drop. 459 // Tests that pressing a button shows and releasing capture hides ink drop.
461 TEST_F(CustomButtonTest, CaptureLossHidesInkDrop) { 460 TEST_F(CustomButtonTest, CaptureLossHidesInkDrop) {
462 gfx::Point old_cursor = gfx::Screen::GetScreenFor( 461 gfx::Point old_cursor = gfx::Screen::GetScreen()->GetCursorScreenPoint();
463 widget()->GetNativeView())->GetCursorScreenPoint();
464 CreateButtonWithInkDrop(); 462 CreateButtonWithInkDrop();
465 463
466 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow()); 464 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow());
467 generator.set_current_location(gfx::Point(50, 50)); 465 generator.set_current_location(gfx::Point(50, 50));
468 generator.PressLeftButton(); 466 generator.PressLeftButton();
469 EXPECT_TRUE(ink_shown()); 467 EXPECT_TRUE(ink_shown());
470 EXPECT_FALSE(ink_hidden()); 468 EXPECT_FALSE(ink_hidden());
471 469
472 widget()->SetCapture(button()); 470 widget()->SetCapture(button());
473 widget()->ReleaseCapture(); 471 widget()->ReleaseCapture();
474 EXPECT_TRUE(ink_hidden()); 472 EXPECT_TRUE(ink_hidden());
475 } 473 }
476 474
477 } // namespace views 475 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/tooltip_manager_mac.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698