OLD | NEW |
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/slider.h" | 5 #include "ui/views/controls/slider.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
18 #include "ui/events/gesture_event_details.h" | 18 #include "ui/events/gesture_event_details.h" |
19 #include "ui/events/test/event_generator.h" | 19 #include "ui/events/test/event_generator.h" |
20 #include "ui/views/test/slider_test_api.h" | 20 #include "ui/views/test/slider_test_api.h" |
21 #include "ui/views/test/views_test_base.h" | 21 #include "ui/views/test/views_test_base.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Stores the default locale at test setup so it can be restored | 162 // Stores the default locale at test setup so it can be restored |
163 // during test teardown. | 163 // during test teardown. |
164 std::string default_locale_; | 164 std::string default_locale_; |
165 // The maximum x value within the bounds of the slider. | 165 // The maximum x value within the bounds of the slider. |
166 int max_x_; | 166 int max_x_; |
167 // The maximum y value within the bounds of the slider. | 167 // The maximum y value within the bounds of the slider. |
168 int max_y_; | 168 int max_y_; |
169 // The widget container for the slider being tested. | 169 // The widget container for the slider being tested. |
170 views::Widget* widget_; | 170 views::Widget* widget_; |
171 // An event generator. | 171 // An event generator. |
172 scoped_ptr<ui::test::EventGenerator> event_generator_; | 172 std::unique_ptr<ui::test::EventGenerator> event_generator_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(SliderTest); | 174 DISALLOW_COPY_AND_ASSIGN(SliderTest); |
175 }; | 175 }; |
176 | 176 |
177 SliderTest::SliderTest(Slider::Orientation orientation) | 177 SliderTest::SliderTest(Slider::Orientation orientation) |
178 : orientation_(orientation), | 178 : orientation_(orientation), |
179 slider_(NULL), | 179 slider_(NULL), |
180 default_locale_(""), | 180 default_locale_(""), |
181 max_x_(0), | 181 max_x_(0), |
182 max_y_(0) { | 182 max_y_(0) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 EXPECT_EQ(1, slider_listener().last_drag_started_epoch()); | 380 EXPECT_EQ(1, slider_listener().last_drag_started_epoch()); |
381 EXPECT_GT(slider_listener().last_drag_ended_epoch(), | 381 EXPECT_GT(slider_listener().last_drag_ended_epoch(), |
382 slider_listener().last_drag_started_epoch()); | 382 slider_listener().last_drag_started_epoch()); |
383 EXPECT_EQ(slider(), slider_listener().last_drag_started_sender()); | 383 EXPECT_EQ(slider(), slider_listener().last_drag_started_sender()); |
384 EXPECT_EQ(slider(), slider_listener().last_drag_ended_sender()); | 384 EXPECT_EQ(slider(), slider_listener().last_drag_ended_sender()); |
385 } | 385 } |
386 | 386 |
387 #endif // !defined(OS_MACOSX) || defined(USE_AURA) | 387 #endif // !defined(OS_MACOSX) || defined(USE_AURA) |
388 | 388 |
389 } // namespace views | 389 } // namespace views |
OLD | NEW |