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

Unified Diff: ui/app_list/views/apps_grid_view_unittest.cc

Issue 23709003: Display an app's short name in the app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation errors in app list unit tests on mac Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_item_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/apps_grid_view_unittest.cc
diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc
index 2abb76f0dc7fc5108dbd907eb4f72b70bdc47e58..9e0cc5c0340ea4622927a471ef9f78d4f7116844 100644
--- a/ui/app_list/views/apps_grid_view_unittest.cc
+++ b/ui/app_list/views/apps_grid_view_unittest.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/app_list/app_list_item_model.h"
@@ -424,5 +425,37 @@ TEST_F(AppsGridViewTest, HighlightWithKeyboard) {
first_index_on_page2)));
}
+TEST_F(AppsGridViewTest, ItemLabelShortNameOverride) {
+ // If the app's full name and short name differ, the title label's tooltip
+ // should always be the full name of the app.
+ std::string expected_text("xyz");
+ std::string expected_tooltip("tooltip");
+ model_->AddItem(expected_text, expected_tooltip);
+
+ string16 actual_tooltip;
+ AppListItemView* item_view = GetItemViewAt(0);
+ ASSERT_TRUE(item_view);
+ const views::Label* title_label = item_view->title();
+ EXPECT_TRUE(title_label->GetTooltipText(
+ title_label->bounds().CenterPoint(), &actual_tooltip));
+ EXPECT_EQ(expected_tooltip, UTF16ToUTF8(actual_tooltip));
+ EXPECT_EQ(expected_text, UTF16ToUTF8(title_label->text()));
+}
+
+TEST_F(AppsGridViewTest, ItemLabelNoShortName) {
+ // If the app's full name and short name are the same, use the default tooltip
+ // behavior of the label (only show a tooltip if the title is truncated).
+ std::string title("a");
+ model_->AddItem(title, title);
+
+ string16 actual_tooltip;
+ AppListItemView* item_view = GetItemViewAt(0);
+ ASSERT_TRUE(item_view);
+ const views::Label* title_label = item_view->title();
+ EXPECT_FALSE(title_label->GetTooltipText(
+ title_label->bounds().CenterPoint(), &actual_tooltip));
+ EXPECT_EQ(title, UTF16ToUTF8(title_label->text()));
+}
+
} // namespace test
} // namespace app_list
« no previous file with comments | « ui/app_list/views/app_list_item_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698