| Index: ui/views/corewm/tooltip_controller_unittest.cc
|
| diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc
|
| index 4764fc7115e675f398c0832b629b287897846388..9b60cb819891e9ad9eb62b85b011c77b9e6222f4 100644
|
| --- a/ui/views/corewm/tooltip_controller_unittest.cc
|
| +++ b/ui/views/corewm/tooltip_controller_unittest.cc
|
| @@ -391,6 +391,42 @@ TEST_F(TooltipControllerTest, ReshowOnClickAfterEnterExit) {
|
| EXPECT_EQ(v1_tt, helper_->GetTooltipText());
|
| }
|
|
|
| +TEST_F(TooltipControllerTest, TooltipPositionChangesOnTwoViewsWithSameLabel) {
|
| + // Owned by |view_|.
|
| + TooltipTestView* v1 = new TooltipTestView;
|
| + TooltipTestView* v2 = new TooltipTestView;
|
| + view_->AddChildView(v1);
|
| + view_->AddChildView(v2);
|
| + const base::string16 reference_string(base::ASCIIToUTF16(
|
| + "Identical Tooltip Text"));
|
| + v1->set_tooltip_text(reference_string);
|
| + v2->set_tooltip_text(reference_string);
|
| +
|
| + gfx::Rect view_bounds(view_->GetLocalBounds());
|
| + view_bounds.set_height(view_bounds.height() / 2);
|
| + v1->SetBoundsRect(view_bounds);
|
| + view_bounds.set_y(view_bounds.height());
|
| + v2->SetBoundsRect(view_bounds);
|
| +
|
| + gfx::Point center = v1->bounds().CenterPoint();
|
| + generator_->MoveMouseRelativeTo(GetWindow(), center);
|
| + helper_->FireTooltipTimer();
|
| + EXPECT_TRUE(helper_->IsTooltipVisible());
|
| + EXPECT_EQ(reference_string, helper_->GetTooltipText());
|
| + gfx::Point tooltip_bounds1 = helper_->GetTooltipPosition();
|
| +
|
| + center = v2->bounds().CenterPoint();
|
| + generator_->MoveMouseRelativeTo(GetWindow(), center);
|
| + helper_->FireTooltipTimer();
|
| + EXPECT_TRUE(helper_->IsTooltipVisible());
|
| + EXPECT_EQ(reference_string, helper_->GetTooltipText());
|
| + gfx::Point tooltip_bounds2 = helper_->GetTooltipPosition();
|
| +
|
| + EXPECT_NE(tooltip_bounds1, gfx::Point());
|
| + EXPECT_NE(tooltip_bounds2, gfx::Point());
|
| + EXPECT_NE(tooltip_bounds1, tooltip_bounds2);
|
| +}
|
| +
|
| namespace {
|
|
|
| // Returns the index of |window| in its parent's children.
|
| @@ -679,6 +715,9 @@ class TestTooltip : public Tooltip {
|
| virtual bool IsVisible() OVERRIDE {
|
| return is_visible_;
|
| }
|
| + virtual gfx::Point GetTooltipPosition() OVERRIDE {
|
| + return gfx::Point();
|
| + }
|
|
|
| private:
|
| bool is_visible_;
|
|
|