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 "ui/app_list/views/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 first_index_on_page2))); | 428 first_index_on_page2))); |
429 } | 429 } |
430 | 430 |
431 TEST_F(AppsGridViewTest, ItemLabelShortNameOverride) { | 431 TEST_F(AppsGridViewTest, ItemLabelShortNameOverride) { |
432 // If the app's full name and short name differ, the title label's tooltip | 432 // If the app's full name and short name differ, the title label's tooltip |
433 // should always be the full name of the app. | 433 // should always be the full name of the app. |
434 std::string expected_text("xyz"); | 434 std::string expected_text("xyz"); |
435 std::string expected_tooltip("tooltip"); | 435 std::string expected_tooltip("tooltip"); |
436 model_->CreateAndAddItem(expected_text, expected_tooltip); | 436 model_->CreateAndAddItem(expected_text, expected_tooltip); |
437 | 437 |
438 string16 actual_tooltip; | 438 base::string16 actual_tooltip; |
439 AppListItemView* item_view = GetItemViewAt(0); | 439 AppListItemView* item_view = GetItemViewAt(0); |
440 ASSERT_TRUE(item_view); | 440 ASSERT_TRUE(item_view); |
441 const views::Label* title_label = item_view->title(); | 441 const views::Label* title_label = item_view->title(); |
442 EXPECT_TRUE(title_label->GetTooltipText( | 442 EXPECT_TRUE(title_label->GetTooltipText( |
443 title_label->bounds().CenterPoint(), &actual_tooltip)); | 443 title_label->bounds().CenterPoint(), &actual_tooltip)); |
444 EXPECT_EQ(expected_tooltip, UTF16ToUTF8(actual_tooltip)); | 444 EXPECT_EQ(expected_tooltip, UTF16ToUTF8(actual_tooltip)); |
445 EXPECT_EQ(expected_text, UTF16ToUTF8(title_label->text())); | 445 EXPECT_EQ(expected_text, UTF16ToUTF8(title_label->text())); |
446 } | 446 } |
447 | 447 |
448 TEST_F(AppsGridViewTest, ItemLabelNoShortName) { | 448 TEST_F(AppsGridViewTest, ItemLabelNoShortName) { |
449 // If the app's full name and short name are the same, use the default tooltip | 449 // If the app's full name and short name are the same, use the default tooltip |
450 // behavior of the label (only show a tooltip if the title is truncated). | 450 // behavior of the label (only show a tooltip if the title is truncated). |
451 std::string title("a"); | 451 std::string title("a"); |
452 model_->CreateAndAddItem(title, title); | 452 model_->CreateAndAddItem(title, title); |
453 | 453 |
454 string16 actual_tooltip; | 454 base::string16 actual_tooltip; |
455 AppListItemView* item_view = GetItemViewAt(0); | 455 AppListItemView* item_view = GetItemViewAt(0); |
456 ASSERT_TRUE(item_view); | 456 ASSERT_TRUE(item_view); |
457 const views::Label* title_label = item_view->title(); | 457 const views::Label* title_label = item_view->title(); |
458 EXPECT_FALSE(title_label->GetTooltipText( | 458 EXPECT_FALSE(title_label->GetTooltipText( |
459 title_label->bounds().CenterPoint(), &actual_tooltip)); | 459 title_label->bounds().CenterPoint(), &actual_tooltip)); |
460 EXPECT_EQ(title, UTF16ToUTF8(title_label->text())); | 460 EXPECT_EQ(title, UTF16ToUTF8(title_label->text())); |
461 } | 461 } |
462 | 462 |
463 } // namespace test | 463 } // namespace test |
464 } // namespace app_list | 464 } // namespace app_list |
OLD | NEW |