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

Side by Side Diff: ui/views/view_unittest.cc

Issue 327843002: Views which cannot process events cannot be tooltip targets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test coverage added Created 6 years, 6 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 | Annotate | Revision Log
« ui/views/view.cc ('K') | « ui/views/view.cc ('k') | 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) 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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 result_view = NULL; 1304 result_view = NULL;
1305 result_view = root_view->GetTooltipHandlerForPoint(point_in_v_child); 1305 result_view = root_view->GetTooltipHandlerForPoint(point_in_v_child);
1306 EXPECT_EQ(v_child, result_view); 1306 EXPECT_EQ(v_child, result_view);
1307 result_view = NULL; 1307 result_view = NULL;
1308 1308
1309 result_view = root_view->GetEventHandlerForRect(rect_in_v); 1309 result_view = root_view->GetEventHandlerForRect(rect_in_v);
1310 EXPECT_EQ(v, result_view); 1310 EXPECT_EQ(v, result_view);
1311 result_view = NULL; 1311 result_view = NULL;
1312 result_view = root_view->GetTooltipHandlerForPoint(point_in_v); 1312 result_view = root_view->GetTooltipHandlerForPoint(point_in_v);
1313 EXPECT_EQ(v, result_view); 1313 EXPECT_EQ(v, result_view);
1314
1315 // When |v_grandchild| returns false when CanProcessEventsWithinSubtree()
1316 // is called, then NULL should be returned as a target if we call
1317 // GetTooltipHandlerForPoint() with |v_grandchild| as the root of the
1318 // views tree. Note that the location must be in the coordinate space
1319 // of the root view (|v_grandchild| in this case), so use (1, 1).
1320
1321 result_view = v_grandchild;
1322 result_view = v_grandchild->GetTooltipHandlerForPoint(gfx::Point(1, 1));
1323 EXPECT_EQ(NULL, result_view);
1314 result_view = NULL; 1324 result_view = NULL;
1315 1325
1316 // When |v_child| returns false when CanProcessEventsWithinSubtree() 1326 // When |v_child| returns false when CanProcessEventsWithinSubtree()
1317 // is called, then neither |v_child| nor |v_grandchild| can be returned 1327 // is called, then neither |v_child| nor |v_grandchild| can be returned
1318 // as a target (|v| should be returned as the target for each case). 1328 // as a target (|v| should be returned as the target for each case).
1319 1329
1320 v_grandchild->Reset(); 1330 v_grandchild->Reset();
1321 v_child->set_can_process_events_within_subtree(false); 1331 v_child->set_can_process_events_within_subtree(false);
1322 1332
1323 result_view = root_view->GetEventHandlerForRect(rect_in_v_grandchild); 1333 result_view = root_view->GetEventHandlerForRect(rect_in_v_grandchild);
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
3955 // notification. 3965 // notification.
3956 TestView* test_view_child_2 = new TestView(); 3966 TestView* test_view_child_2 = new TestView();
3957 test_view->AddChildView(test_view_child_2); 3967 test_view->AddChildView(test_view_child_2);
3958 EXPECT_TRUE(test_view_child_2->native_theme_); 3968 EXPECT_TRUE(test_view_child_2->native_theme_);
3959 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_); 3969 EXPECT_EQ(widget->GetNativeTheme(), test_view_child_2->native_theme_);
3960 3970
3961 widget->CloseNow(); 3971 widget->CloseNow();
3962 } 3972 }
3963 3973
3964 } // namespace views 3974 } // namespace views
OLDNEW
« ui/views/view.cc ('K') | « ui/views/view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698