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

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

Issue 2070143003: Add MD ink drop ripple to app list button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b612539_shelf_button_ripple
Patch Set: Rebased Created 4 years, 5 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/controls/button/custom_button.cc ('k') | ui/views/controls/button/md_text_button.cc » ('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 "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void ShowContextMenuForView(View* source, 50 void ShowContextMenuForView(View* source,
51 const gfx::Point& point, 51 const gfx::Point& point,
52 ui::MenuSourceType source_type) override {} 52 ui::MenuSourceType source_type) override {}
53 53
54 private: 54 private:
55 DISALLOW_COPY_AND_ASSIGN(TestContextMenuController); 55 DISALLOW_COPY_AND_ASSIGN(TestContextMenuController);
56 }; 56 };
57 57
58 class TestCustomButton : public CustomButton, public ButtonListener { 58 class TestCustomButton : public CustomButton, public ButtonListener {
59 public: 59 public:
60 explicit TestCustomButton() 60 explicit TestCustomButton(bool has_ink_drop_action_on_click)
61 : CustomButton(this) { 61 : CustomButton(this) {
62 set_has_ink_drop_action_on_click(has_ink_drop_action_on_click);
62 } 63 }
63 64
64 ~TestCustomButton() override {} 65 ~TestCustomButton() override {}
65 66
66 void ButtonPressed(Button* sender, const ui::Event& event) override { 67 void ButtonPressed(Button* sender, const ui::Event& event) override {
67 pressed_ = true; 68 pressed_ = true;
68 } 69 }
69 70
70 void OnClickCanceled(const ui::Event& event) override { 71 void OnClickCanceled(const ui::Event& event) override {
71 canceled_ = true; 72 canceled_ = true;
(...skipping 29 matching lines...) Expand all
101 102
102 // Create a widget so that the CustomButton can query the hover state 103 // Create a widget so that the CustomButton can query the hover state
103 // correctly. 104 // correctly.
104 widget_.reset(new Widget); 105 widget_.reset(new Widget);
105 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); 106 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
106 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 107 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
107 params.bounds = gfx::Rect(0, 0, 650, 650); 108 params.bounds = gfx::Rect(0, 0, 650, 650);
108 widget_->Init(params); 109 widget_->Init(params);
109 widget_->Show(); 110 widget_->Show();
110 111
111 button_ = new TestCustomButton(); 112 button_ = new TestCustomButton(false);
112 widget_->SetContentsView(button_); 113 widget_->SetContentsView(button_);
113 } 114 }
114 115
115 void TearDown() override { 116 void TearDown() override {
116 widget_.reset(); 117 widget_.reset();
117 ViewsTestBase::TearDown(); 118 ViewsTestBase::TearDown();
118 } 119 }
119 120
120 void CreateButtonWithInkDrop(std::unique_ptr<InkDrop> ink_drop) { 121 void CreateButtonWithInkDrop(std::unique_ptr<InkDrop> ink_drop,
122 bool has_ink_drop_action_on_click) {
121 delete button_; 123 delete button_;
122 button_ = new TestCustomButton(); 124 button_ = new TestCustomButton(has_ink_drop_action_on_click);
123 InkDropHostViewTestApi(button_).SetInkDrop(std::move(ink_drop)); 125 InkDropHostViewTestApi(button_).SetInkDrop(std::move(ink_drop));
124 widget_->SetContentsView(button_); 126 widget_->SetContentsView(button_);
125 } 127 }
126 128
127 protected: 129 protected:
128 Widget* widget() { return widget_.get(); } 130 Widget* widget() { return widget_.get(); }
129 TestCustomButton* button() { return button_; } 131 TestCustomButton* button() { return button_; }
130 void SetDraggedView(View* dragged_view) { 132 void SetDraggedView(View* dragged_view) {
131 widget_->dragged_view_ = dragged_view; 133 widget_->dragged_view_ = dragged_view;
132 } 134 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Textfield textfield; 345 Textfield textfield;
344 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield)); 346 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield));
345 } 347 }
346 348
347 // Tests that pressing a button shows the ink drop and releasing the button 349 // Tests that pressing a button shows the ink drop and releasing the button
348 // does not hide the ink drop. 350 // does not hide the ink drop.
349 // Note: Ink drop is not hidden upon release because CustomButton descendants 351 // Note: Ink drop is not hidden upon release because CustomButton descendants
350 // may enter a different ink drop state. 352 // may enter a different ink drop state.
351 TEST_F(CustomButtonTest, ButtonClickTogglesInkDrop) { 353 TEST_F(CustomButtonTest, ButtonClickTogglesInkDrop) {
352 TestInkDrop* ink_drop = new TestInkDrop(); 354 TestInkDrop* ink_drop = new TestInkDrop();
353 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 355 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
354 356
355 ui::test::EventGenerator generator(widget()->GetNativeWindow()); 357 ui::test::EventGenerator generator(widget()->GetNativeWindow());
356 generator.set_current_location(gfx::Point(50, 50)); 358 generator.set_current_location(gfx::Point(50, 50));
357 generator.PressLeftButton(); 359 generator.PressLeftButton();
358 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 360 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
359 361
360 generator.ReleaseLeftButton(); 362 generator.ReleaseLeftButton();
361 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 363 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
362 } 364 }
363 365
364 // Tests that pressing a button shows and releasing capture hides ink drop. 366 // Tests that pressing a button shows and releasing capture hides ink drop.
365 // Releasing capture should also reset PRESSED button state to NORMAL. 367 // Releasing capture should also reset PRESSED button state to NORMAL.
366 TEST_F(CustomButtonTest, CaptureLossHidesInkDrop) { 368 TEST_F(CustomButtonTest, CaptureLossHidesInkDrop) {
367 TestInkDrop* ink_drop = new TestInkDrop(); 369 TestInkDrop* ink_drop = new TestInkDrop();
368 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 370 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
369 371
370 ui::test::EventGenerator generator(widget()->GetNativeWindow()); 372 ui::test::EventGenerator generator(widget()->GetNativeWindow());
371 generator.set_current_location(gfx::Point(50, 50)); 373 generator.set_current_location(gfx::Point(50, 50));
372 generator.PressLeftButton(); 374 generator.PressLeftButton();
373 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 375 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
374 376
375 EXPECT_EQ(Button::ButtonState::STATE_PRESSED, button()->state()); 377 EXPECT_EQ(Button::ButtonState::STATE_PRESSED, button()->state());
376 SetDraggedView(button()); 378 SetDraggedView(button());
377 widget()->SetCapture(button()); 379 widget()->SetCapture(button());
378 widget()->ReleaseCapture(); 380 widget()->ReleaseCapture();
379 SetDraggedView(nullptr); 381 SetDraggedView(nullptr);
380 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); 382 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState());
381 EXPECT_EQ(ui::MaterialDesignController::IsModeMaterial() 383 EXPECT_EQ(ui::MaterialDesignController::IsModeMaterial()
382 ? Button::ButtonState::STATE_NORMAL 384 ? Button::ButtonState::STATE_NORMAL
383 : Button::ButtonState::STATE_PRESSED, 385 : Button::ButtonState::STATE_PRESSED,
384 button()->state()); 386 button()->state());
385 } 387 }
386 388
387 TEST_F(CustomButtonTest, HideInkDropWhenShowingContextMenu) { 389 TEST_F(CustomButtonTest, HideInkDropWhenShowingContextMenu) {
388 TestInkDrop* ink_drop = new TestInkDrop(); 390 TestInkDrop* ink_drop = new TestInkDrop();
389 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 391 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
390 TestContextMenuController context_menu_controller; 392 TestContextMenuController context_menu_controller;
391 button()->set_context_menu_controller(&context_menu_controller); 393 button()->set_context_menu_controller(&context_menu_controller);
392 button()->set_hide_ink_drop_when_showing_context_menu(true); 394 button()->set_hide_ink_drop_when_showing_context_menu(true);
393 395
394 ink_drop->SetHovered(true); 396 ink_drop->SetHovered(true);
395 ink_drop->AnimateToState(InkDropState::ACTION_PENDING); 397 ink_drop->AnimateToState(InkDropState::ACTION_PENDING);
396 398
397 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); 399 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE);
398 400
399 EXPECT_FALSE(ink_drop->is_hovered()); 401 EXPECT_FALSE(ink_drop->is_hovered());
400 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); 402 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState());
401 } 403 }
402 404
403 TEST_F(CustomButtonTest, DontHideInkDropWhenShowingContextMenu) { 405 TEST_F(CustomButtonTest, DontHideInkDropWhenShowingContextMenu) {
404 TestInkDrop* ink_drop = new TestInkDrop(); 406 TestInkDrop* ink_drop = new TestInkDrop();
405 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 407 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
406 TestContextMenuController context_menu_controller; 408 TestContextMenuController context_menu_controller;
407 button()->set_context_menu_controller(&context_menu_controller); 409 button()->set_context_menu_controller(&context_menu_controller);
408 button()->set_hide_ink_drop_when_showing_context_menu(false); 410 button()->set_hide_ink_drop_when_showing_context_menu(false);
409 411
410 ink_drop->SetHovered(true); 412 ink_drop->SetHovered(true);
411 ink_drop->AnimateToState(InkDropState::ACTION_PENDING); 413 ink_drop->AnimateToState(InkDropState::ACTION_PENDING);
412 414
413 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); 415 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE);
414 416
415 EXPECT_TRUE(ink_drop->is_hovered()); 417 EXPECT_TRUE(ink_drop->is_hovered());
416 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 418 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
417 } 419 }
418 420
419 TEST_F(CustomButtonTest, HideInkDropOnBlur) { 421 TEST_F(CustomButtonTest, HideInkDropOnBlur) {
420 gfx::Point center(10, 10); 422 gfx::Point center(10, 10);
421 423
422 TestInkDrop* ink_drop = new TestInkDrop(); 424 TestInkDrop* ink_drop = new TestInkDrop();
423 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 425 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
424 426
425 button()->OnFocus(); 427 button()->OnFocus();
426 428
427 button()->OnMousePressed(ui::MouseEvent( 429 button()->OnMousePressed(ui::MouseEvent(
428 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 430 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
429 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 431 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
430 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 432 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
431 433
432 button()->OnBlur(); 434 button()->OnBlur();
433 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); 435 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState());
434 436
435 button()->OnMouseReleased(ui::MouseEvent( 437 button()->OnMouseReleased(ui::MouseEvent(
436 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 438 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
437 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 439 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
438 EXPECT_TRUE(button()->pressed()); 440 EXPECT_TRUE(button()->pressed());
439 } 441 }
440 442
441 TEST_F(CustomButtonTest, InkDropAfterTryingToShowContextMenu) { 443 TEST_F(CustomButtonTest, InkDropAfterTryingToShowContextMenu) {
442 TestInkDrop* ink_drop = new TestInkDrop(); 444 TestInkDrop* ink_drop = new TestInkDrop();
443 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 445 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
444 button()->set_context_menu_controller(nullptr); 446 button()->set_context_menu_controller(nullptr);
445 447
446 ink_drop->SetHovered(true); 448 ink_drop->SetHovered(true);
447 ink_drop->AnimateToState(InkDropState::ACTION_PENDING); 449 ink_drop->AnimateToState(InkDropState::ACTION_PENDING);
448 450
449 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); 451 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE);
450 452
451 EXPECT_TRUE(ink_drop->is_hovered()); 453 EXPECT_TRUE(ink_drop->is_hovered());
452 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 454 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
453 } 455 }
454 456
455 TEST_F(CustomButtonTest, InkDropShowHideOnMouseDragged) { 457 // Tests that when button is set to notify on release, dragging mouse out and
458 // back transitions ink drop states correctly.
459 TEST_F(CustomButtonTest, InkDropShowHideOnMouseDraggedNotifyOnRelease) {
456 gfx::Point center(10, 10); 460 gfx::Point center(10, 10);
457 gfx::Point oob(-1, -1); 461 gfx::Point oob(-1, -1);
458 462
459 TestInkDrop* ink_drop = new TestInkDrop(); 463 TestInkDrop* ink_drop = new TestInkDrop();
460 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 464 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
465 button()->set_notify_action(CustomButton::NOTIFY_ON_RELEASE);
461 466
462 button()->OnMousePressed(ui::MouseEvent( 467 button()->OnMousePressed(ui::MouseEvent(
463 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 468 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
464 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 469 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
465 470
466 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 471 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
467 472
468 button()->OnMouseDragged( 473 button()->OnMouseDragged(
469 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(), 474 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(),
470 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 475 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
(...skipping 12 matching lines...) Expand all
483 488
484 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); 489 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState());
485 490
486 button()->OnMouseReleased( 491 button()->OnMouseReleased(
487 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(), 492 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(),
488 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 493 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
489 494
490 EXPECT_FALSE(button()->pressed()); 495 EXPECT_FALSE(button()->pressed());
491 } 496 }
492 497
498 // Tests that when button is set to notify on press, dragging mouse out and back
499 // does not change the ink drop state.
500 TEST_F(CustomButtonTest, InkDropShowHideOnMouseDraggedNotifyOnPress) {
501 gfx::Point center(10, 10);
502 gfx::Point oob(-1, -1);
503
504 TestInkDrop* ink_drop = new TestInkDrop();
505 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), true);
506 button()->set_notify_action(CustomButton::NOTIFY_ON_PRESS);
507
508 button()->OnMousePressed(ui::MouseEvent(
509 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
510 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
511
512 EXPECT_EQ(InkDropState::ACTION_TRIGGERED, ink_drop->GetTargetInkDropState());
513 EXPECT_TRUE(button()->pressed());
514
515 button()->OnMouseDragged(
516 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(),
517 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
518
519 EXPECT_EQ(InkDropState::ACTION_TRIGGERED, ink_drop->GetTargetInkDropState());
520
521 button()->OnMouseDragged(ui::MouseEvent(
522 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
523 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
524
525 EXPECT_EQ(InkDropState::ACTION_TRIGGERED, ink_drop->GetTargetInkDropState());
526
527 button()->OnMouseDragged(
528 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(),
529 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
530
531 EXPECT_EQ(InkDropState::ACTION_TRIGGERED, ink_drop->GetTargetInkDropState());
532
533 button()->OnMouseReleased(
534 ui::MouseEvent(ui::ET_MOUSE_PRESSED, oob, oob, ui::EventTimeForNow(),
535 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
536
537 EXPECT_EQ(InkDropState::ACTION_TRIGGERED, ink_drop->GetTargetInkDropState());
538 }
539
493 TEST_F(CustomButtonTest, InkDropStaysHiddenWhileDragging) { 540 TEST_F(CustomButtonTest, InkDropStaysHiddenWhileDragging) {
494 gfx::Point center(10, 10); 541 gfx::Point center(10, 10);
495 gfx::Point oob(-1, -1); 542 gfx::Point oob(-1, -1);
496 543
497 TestInkDrop* ink_drop = new TestInkDrop(); 544 TestInkDrop* ink_drop = new TestInkDrop();
498 CreateButtonWithInkDrop(base::WrapUnique(ink_drop)); 545 CreateButtonWithInkDrop(base::WrapUnique(ink_drop), false);
499 546
500 button()->OnMousePressed(ui::MouseEvent( 547 button()->OnMousePressed(ui::MouseEvent(
501 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 548 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
502 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 549 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
503 550
504 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); 551 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState());
505 552
506 SetDraggedView(button()); 553 SetDraggedView(button());
507 widget()->SetCapture(button()); 554 widget()->SetCapture(button());
508 widget()->ReleaseCapture(); 555 widget()->ReleaseCapture();
(...skipping 29 matching lines...) Expand all
538 EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state()); 585 EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state());
539 EXPECT_FALSE(button()->pressed()); 586 EXPECT_FALSE(button()->pressed());
540 587
541 ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE); 588 ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE);
542 SimulateKeyEvent(&space_release); 589 SimulateKeyEvent(&space_release);
543 EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state()); 590 EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
544 EXPECT_TRUE(button()->pressed()); 591 EXPECT_TRUE(button()->pressed());
545 } 592 }
546 593
547 } // namespace views 594 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/md_text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698