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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" | 8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" |
9 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 9 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
10 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 10 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 protected: | 94 protected: |
95 // Checks whether |tab| contains |point_in_tabstrip_coords|, where the point | 95 // Checks whether |tab| contains |point_in_tabstrip_coords|, where the point |
96 // is in |tab_strip_| coordinates. | 96 // is in |tab_strip_| coordinates. |
97 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords) { | 97 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords) { |
98 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 98 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
99 views::View::ConvertPointToTarget(tab_strip_, tab, &point_in_tab_coords); | 99 views::View::ConvertPointToTarget(tab_strip_, tab, &point_in_tab_coords); |
100 return tab->HitTestPoint(point_in_tab_coords); | 100 return tab->HitTestPoint(point_in_tab_coords); |
101 } | 101 } |
102 | 102 |
103 MessageLoopForUI ui_loop_; | 103 base::MessageLoopForUI ui_loop_; |
104 // Owned by TabStrip. | 104 // Owned by TabStrip. |
105 FakeBaseTabStripController* controller_; | 105 FakeBaseTabStripController* controller_; |
106 // Owns |tab_strip_|. | 106 // Owns |tab_strip_|. |
107 views::View parent_; | 107 views::View parent_; |
108 TabStrip* tab_strip_; | 108 TabStrip* tab_strip_; |
109 | 109 |
110 private: | 110 private: |
111 DISALLOW_COPY_AND_ASSIGN(TabStripTest); | 111 DISALLOW_COPY_AND_ASSIGN(TabStripTest); |
112 }; | 112 }; |
113 | 113 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ASSERT_TRUE(IsPointInTab(most_right_tab, unactive_overlap)); | 329 ASSERT_TRUE(IsPointInTab(most_right_tab, unactive_overlap)); |
330 | 330 |
331 EXPECT_EQ( | 331 EXPECT_EQ( |
332 right_tab, | 332 right_tab, |
333 FindTabView(tab_strip_->GetTooltipHandlerForPoint(unactive_overlap))); | 333 FindTabView(tab_strip_->GetTooltipHandlerForPoint(unactive_overlap))); |
334 | 334 |
335 // Confirm that tab strip doe not return tooltip handler for points that | 335 // Confirm that tab strip doe not return tooltip handler for points that |
336 // don't hit it. | 336 // don't hit it. |
337 EXPECT_FALSE(tab_strip_->GetTooltipHandlerForPoint(gfx::Point(-1, 2))); | 337 EXPECT_FALSE(tab_strip_->GetTooltipHandlerForPoint(gfx::Point(-1, 2))); |
338 } | 338 } |
OLD | NEW |