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

Side by Side Diff: ui/views/corewm/tooltip_controller_unittest.cc

Issue 2652353003: Fix regression: empty tooltip appears in Linux and Chrome OS (Closed)
Patch Set: More accurate timer API. Created 3 years, 10 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
« no previous file with comments | « ui/views/corewm/tooltip_controller.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/views/corewm/tooltip_controller.h" 5 #include "ui/views/corewm/tooltip_controller.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 EXPECT_TRUE(helper_->IsTooltipVisible()); 200 EXPECT_TRUE(helper_->IsTooltipVisible());
201 generator_->MoveMouseBy(1, 0); 201 generator_->MoveMouseBy(1, 0);
202 202
203 EXPECT_TRUE(helper_->IsTooltipVisible()); 203 EXPECT_TRUE(helper_->IsTooltipVisible());
204 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); 204 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow()));
205 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); 205 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText());
206 EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); 206 EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow());
207 } 207 }
208 208
209 TEST_F(TooltipControllerTest, HideEmptyTooltip) {
210 // TODO: these tests use GetContext(). That should go away for aura-mus
211 // client. http://crbug.com/663781.
212 if (IsMus())
213 return;
214
215 view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text"));
216 EXPECT_EQ(base::string16(), helper_->GetTooltipText());
217 EXPECT_EQ(NULL, helper_->GetTooltipWindow());
218
219 generator_->MoveMouseToCenterOf(GetWindow());
220 generator_->MoveMouseBy(1, 0);
221 EXPECT_TRUE(helper_->IsTooltipVisible());
222
223 view_->set_tooltip_text(ASCIIToUTF16(" "));
224 generator_->MoveMouseBy(1, 0);
225 EXPECT_FALSE(helper_->IsTooltipVisible());
226 }
227
209 #if defined(OS_CHROMEOS) 228 #if defined(OS_CHROMEOS)
210 // crbug.com/664370. 229 // crbug.com/664370.
211 TEST_F(TooltipControllerTest, MaxWidth) { 230 TEST_F(TooltipControllerTest, MaxWidth) {
212 // TODO: these tests use GetContext(). That should go away for mus client. 231 // TODO: these tests use GetContext(). That should go away for mus client.
213 // http://crbug.com/663781. 232 // http://crbug.com/663781.
214 if (IsMus()) 233 if (IsMus())
215 return; 234 return;
216 235
217 base::string16 text = base::ASCIIToUTF16( 236 base::string16 text = base::ASCIIToUTF16(
218 "Really really realy long long long long long tooltips that exceeds max " 237 "Really really realy long long long long long tooltips that exceeds max "
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 generator_->MoveMouseRelativeTo(GetWindow(), center); 884 generator_->MoveMouseRelativeTo(GetWindow(), center);
866 tooltip_bounds1 = test_tooltip_->location(); 885 tooltip_bounds1 = test_tooltip_->location();
867 886
868 EXPECT_NE(tooltip_bounds1_1, tooltip_bounds1); 887 EXPECT_NE(tooltip_bounds1_1, tooltip_bounds1);
869 EXPECT_EQ(reference_string, helper_->GetTooltipText()); 888 EXPECT_EQ(reference_string, helper_->GetTooltipText());
870 } 889 }
871 890
872 } // namespace test 891 } // namespace test
873 } // namespace corewm 892 } // namespace corewm
874 } // namespace views 893 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698