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

Unified Diff: ui/views/corewm/tooltip_controller_unittest.cc

Issue 2556083002: Don't subtract border from max size for display rect. (Closed)
Patch Set: RenderTextTestApi Created 4 years 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 side-by-side diff with in-line comments
Download patch
« ui/gfx/test/render_text_test_api.h ('K') | « ui/views/corewm/tooltip_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54aa14f8ad6c3e970472504d156c2a5c7519ea5f..d8f14803cf510ca7689073604bdd33c41bf2aab9 100644
--- a/ui/views/corewm/tooltip_controller_unittest.cc
+++ b/ui/views/corewm/tooltip_controller_unittest.cc
@@ -93,9 +93,9 @@ class TooltipControllerTest : public ViewsTestBase {
new wm::DefaultActivationClient(root_window);
#if defined(OS_CHROMEOS)
- controller_.reset(
- new TooltipController(std::unique_ptr<views::corewm::Tooltip>(
- new views::corewm::TooltipAura)));
+ tooltip_aura_ = new views::corewm::TooltipAura();
+ controller_.reset(new TooltipController(
+ std::unique_ptr<views::corewm::Tooltip>(tooltip_aura_)));
root_window->AddPreTargetHandler(controller_.get());
SetTooltipClient(root_window, controller_.get());
#endif
@@ -161,6 +161,11 @@ class TooltipControllerTest : public ViewsTestBase {
std::unique_ptr<TooltipControllerTestHelper> helper_;
std::unique_ptr<ui::test::EventGenerator> generator_;
+ protected:
+#if defined(OS_CHROMEOS)
+ TooltipAura* tooltip_aura_; // not owned.
+#endif
+
private:
std::unique_ptr<TooltipController> controller_;
@@ -199,7 +204,31 @@ TEST_F(TooltipControllerTest, ViewTooltip) {
EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow()));
EXPECT_EQ(expected_tooltip, helper_->GetTooltipText());
EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow());
+ EXPECT_EQ(1u, tooltip_aura_->GetLineSizeForTest());
+}
+
+#if defined(OS_CHROMEOS)
+// crbug.com/664370.
+TEST_F(TooltipControllerTest, MaxWidth) {
+ base::string16 text = base::ASCIIToUTF16(
+ "List of law clerks of the Supreme Court of the United States - "
+ "Wikipedia\n");
+ text += gfx::kEllipsisUTF16 + base::ASCIIToUTF16("wikipedia.org/") +
+ gfx::kEllipsisUTF16 +
+ base::ASCIIToUTF16(
+ "/List_of_law_clerks_of_the_Supreme_Court_of_the_Unite") +
+ +gfx::kEllipsisUTF16;
+
+ view_->set_tooltip_text(text);
+ generator_->MoveMouseToCenterOf(GetWindow());
+
+ // Fire tooltip timer so tooltip becomes visible.
+ helper_->FireTooltipTimer();
+
+ EXPECT_TRUE(helper_->IsTooltipVisible());
+ EXPECT_EQ(2u, tooltip_aura_->GetLineSizeForTest());
}
+#endif
TEST_F(TooltipControllerTest, TooltipsInMultipleViews) {
// TODO: these tests use GetContext(). That should go away for aura-mus
« ui/gfx/test/render_text_test_api.h ('K') | « ui/views/corewm/tooltip_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698