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

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

Issue 2835243002: views: don't look for layers in ToggleButtonTest when ripples are disabled (Closed)
Patch Set: Created 3 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 | « no previous file | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/toggle_button.h" 5 #include "ui/views/controls/button/toggle_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"
11 #include "ui/events/event_utils.h" 11 #include "ui/events/event_utils.h"
12 #include "ui/views/style/platform_style.h"
12 #include "ui/views/test/views_test_base.h" 13 #include "ui/views/test/views_test_base.h"
13 14
14 namespace views { 15 namespace views {
15 16
16 class TestToggleButton : public ToggleButton { 17 class TestToggleButton : public ToggleButton {
17 public: 18 public:
18 explicit TestToggleButton(int* counter) 19 explicit TestToggleButton(int* counter)
19 : ToggleButton(nullptr), counter_(counter) {} 20 : ToggleButton(nullptr), counter_(counter) {}
20 ~TestToggleButton() override { 21 ~TestToggleButton() override {
21 // Calling SetInkDropMode() in this subclass allows this class's 22 // Calling SetInkDropMode() in this subclass allows this class's
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 // Starts ink drop animation on a ToggleButton and destroys the button. 85 // Starts ink drop animation on a ToggleButton and destroys the button.
85 // The test verifies that the ink drop layer is removed properly when the 86 // The test verifies that the ink drop layer is removed properly when the
86 // ToggleButton gets destroyed. 87 // ToggleButton gets destroyed.
87 TEST_F(ToggleButtonTest, ToggleButtonDestroyed) { 88 TEST_F(ToggleButtonTest, ToggleButtonDestroyed) {
88 EXPECT_EQ(0, counter()); 89 EXPECT_EQ(0, counter());
89 gfx::Point center(10, 10); 90 gfx::Point center(10, 10);
90 button()->OnMousePressed(ui::MouseEvent( 91 button()->OnMousePressed(ui::MouseEvent(
91 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 92 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
92 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 93 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
93 EXPECT_EQ(1, counter()); 94 // On platforms with no ripples, there should never be an ink drop layer.
95 if (PlatformStyle::kUseRipples)
96 EXPECT_EQ(1, counter());
97 else
98 EXPECT_EQ(0, counter());
94 delete button(); 99 delete button();
95 EXPECT_EQ(0, counter()); 100 EXPECT_EQ(0, counter());
96 } 101 }
97 102
98 } // namespace views 103 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698