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

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

Issue 2001843002: Use ink drop hover for focus states on toolbar buttons and location (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout Created 4 years, 7 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/label_button.cc ('k') | ui/views/controls/button/md_text_button.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/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool is_hovered_; 422 bool is_hovered_;
423 423
424 DISALLOW_COPY_AND_ASSIGN(TestButtonInkDropDelegate); 424 DISALLOW_COPY_AND_ASSIGN(TestButtonInkDropDelegate);
425 }; 425 };
426 426
427 // A generic LabelButton configured with an |InkDropDelegate|. 427 // A generic LabelButton configured with an |InkDropDelegate|.
428 class InkDropLabelButton : public LabelButton { 428 class InkDropLabelButton : public LabelButton {
429 public: 429 public:
430 InkDropLabelButton() 430 InkDropLabelButton()
431 : LabelButton(nullptr, base::string16()), 431 : LabelButton(nullptr, base::string16()),
432 test_ink_drop_delegate_(this, this) { 432 test_ink_drop_delegate_(new TestButtonInkDropDelegate(this, this)) {
433 set_ink_drop_delegate(&test_ink_drop_delegate_); 433 set_ink_drop_delegate(base::WrapUnique(test_ink_drop_delegate_));
434 } 434 }
435 435
436 ~InkDropLabelButton() override {} 436 ~InkDropLabelButton() override {}
437 437
438 TestButtonInkDropDelegate* test_ink_drop_delegate() { 438 TestButtonInkDropDelegate* test_ink_drop_delegate() {
439 return &test_ink_drop_delegate_; 439 return test_ink_drop_delegate_;
440 } 440 }
441 441
442 private: 442 private:
443 TestButtonInkDropDelegate test_ink_drop_delegate_; 443 // Weak pointer.
444 TestButtonInkDropDelegate* test_ink_drop_delegate_;
444 445
445 DISALLOW_COPY_AND_ASSIGN(InkDropLabelButton); 446 DISALLOW_COPY_AND_ASSIGN(InkDropLabelButton);
446 }; 447 };
447 448
448 // Test fixture for a LabelButton that has an ink drop configured. 449 // Test fixture for a LabelButton that has an ink drop configured.
449 class InkDropLabelButtonTest : public ViewsTestBase { 450 class InkDropLabelButtonTest : public ViewsTestBase {
450 public: 451 public:
451 InkDropLabelButtonTest() {} 452 InkDropLabelButtonTest() {}
452 453
453 // ViewsTestBase: 454 // ViewsTestBase:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 506
506 // Verifies the target event handler View is the |LabelButton| and not any of 507 // Verifies the target event handler View is the |LabelButton| and not any of
507 // the child Views. 508 // the child Views.
508 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { 509 TEST_F(InkDropLabelButtonTest, TargetEventHandler) {
509 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( 510 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint(
510 button_->bounds().CenterPoint()); 511 button_->bounds().CenterPoint());
511 EXPECT_EQ(button_, target_view); 512 EXPECT_EQ(button_, target_view);
512 } 513 }
513 514
514 } // namespace views 515 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698