| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "testing/gmock/include/gmock/gmock.h" | 6 #include "testing/gmock/include/gmock/gmock.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "views/controls/single_split_view.h" | 8 #include "views/controls/single_split_view.h" |
| 9 | 9 |
| 10 using ::testing::_; | 10 using ::testing::_; |
| 11 using ::testing::Return; | 11 using ::testing::Return; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 MouseEvent mouse_dragged_2( | 159 MouseEvent mouse_dragged_2( |
| 160 ui::ET_MOUSE_DRAGGED, 6, | 160 ui::ET_MOUSE_DRAGGED, 6, |
| 161 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); | 161 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); |
| 162 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_2)); | 162 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_2)); |
| 163 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, | 163 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, |
| 164 split.divider_offset()); | 164 split.divider_offset()); |
| 165 | 165 |
| 166 MouseEvent mouse_released( | 166 MouseEvent mouse_released( |
| 167 ui::ET_MOUSE_RELEASED, 7, | 167 ui::ET_MOUSE_RELEASED, 7, |
| 168 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); | 168 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); |
| 169 split.OnMouseReleased(mouse_released, false); | 169 split.OnMouseReleased(mouse_released); |
| 170 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, | 170 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, |
| 171 split.divider_offset()); | 171 split.divider_offset()); |
| 172 |
| 173 // Expect intial offset after a system/user gesture cancels the drag. |
| 174 // This shouldn't occur after mouse release, but it's sufficient for testing. |
| 175 split.OnMouseCaptureLost(); |
| 176 EXPECT_EQ(kInitialDividerOffset, split.divider_offset()); |
| 172 } | 177 } |
| 173 | 178 |
| 174 } // namespace views | 179 } // namespace views |
| OLD | NEW |