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

Side by Side Diff: views/controls/single_split_view_unittest.cc

Issue 8351007: views: Factor out SingleSplitView Observer into SingleSplitViewListener. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « views/controls/single_split_view_listener.h ('k') | views/views.gyp » ('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) 2011 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 #include "views/controls/single_split_view_listener.h"
9 10
10 using ::testing::_; 11 using ::testing::_;
11 using ::testing::Return; 12 using ::testing::Return;
12 13
13 namespace { 14 namespace {
14 15
15 static void VerifySplitViewLayout(const views::SingleSplitView& split) { 16 static void VerifySplitViewLayout(const views::SingleSplitView& split) {
16 ASSERT_EQ(2, split.child_count()); 17 ASSERT_EQ(2, split.child_count());
17 18
18 const views::View* leading = split.child_at(0); 19 const views::View* leading = split.child_at(0);
(...skipping 17 matching lines...) Expand all
36 } else if (split.orientation() == views::SingleSplitView::VERTICAL_SPLIT) { 37 } else if (split.orientation() == views::SingleSplitView::VERTICAL_SPLIT) {
37 EXPECT_EQ(leading->bounds().width(), split.bounds().width()); 38 EXPECT_EQ(leading->bounds().width(), split.bounds().width());
38 EXPECT_EQ(trailing->bounds().width(), split.bounds().width()); 39 EXPECT_EQ(trailing->bounds().width(), split.bounds().width());
39 EXPECT_LT(leading->bounds().height() + trailing->bounds().height(), 40 EXPECT_LT(leading->bounds().height() + trailing->bounds().height(),
40 split.bounds().height()); 41 split.bounds().height());
41 } else { 42 } else {
42 NOTREACHED(); 43 NOTREACHED();
43 } 44 }
44 } 45 }
45 46
46 class MockObserver : public views::SingleSplitView::Observer { 47 class MockObserver : public views::SingleSplitViewListener {
47 public: 48 public:
48 MOCK_METHOD1(SplitHandleMoved, bool(views::SingleSplitView*)); 49 MOCK_METHOD1(SplitHandleMoved, bool(views::SingleSplitView*));
49 }; 50 };
50 51
51 } // namespace 52 } // namespace
52 53
53 namespace views { 54 namespace views {
54 55
55 TEST(SingleSplitViewTest, Resize) { 56 TEST(SingleSplitViewTest, Resize) {
56 // Test cases to iterate through for horizontal and vertical split views. 57 // Test cases to iterate through for horizontal and vertical split views.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, 171 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2,
171 split.divider_offset()); 172 split.divider_offset());
172 173
173 // Expect intial offset after a system/user gesture cancels the drag. 174 // 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 // This shouldn't occur after mouse release, but it's sufficient for testing.
175 split.OnMouseCaptureLost(); 176 split.OnMouseCaptureLost();
176 EXPECT_EQ(kInitialDividerOffset, split.divider_offset()); 177 EXPECT_EQ(kInitialDividerOffset, split.divider_offset());
177 } 178 }
178 179
179 } // namespace views 180 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/single_split_view_listener.h ('k') | views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698