OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/mac/foundation_util.h" | 5 #include "base/mac/foundation_util.h" |
6 #include "base/mac/scoped_nsobject.h" | 6 #include "base/mac/scoped_nsobject.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "skia/ext/skia_utils_mac.h" | 8 #include "skia/ext/skia_utils_mac.h" |
9 #import "testing/gtest_mac.h" | 9 #import "testing/gtest_mac.h" |
10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 EXPECT_NSEQ(@"Item 2", [button title]); | 447 EXPECT_NSEQ(@"Item 2", [button title]); |
448 EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent()); | 448 EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent()); |
449 | 449 |
450 // Update the title via the ItemModelObserver. | 450 // Update the title via the ItemModelObserver. |
451 app_list::AppListItem* item_model = | 451 app_list::AppListItem* item_model = |
452 model()->top_level_item_list()->item_at(2); | 452 model()->top_level_item_list()->item_at(2); |
453 model()->SetItemName(item_model, "UpdatedItem"); | 453 model()->SetItemName(item_model, "UpdatedItem"); |
454 EXPECT_NSEQ(@"UpdatedItem", [button title]); | 454 EXPECT_NSEQ(@"UpdatedItem", [button title]); |
455 | 455 |
456 // Test icon updates through the model observer by ensuring the icon changes. | 456 // Test icon updates through the model observer by ensuring the icon changes. |
| 457 item_model->SetIcon(gfx::ImageSkia(), false); |
457 NSSize icon_size = [[button image] size]; | 458 NSSize icon_size = [[button image] size]; |
458 EXPECT_EQ(0, icon_size.width); | 459 EXPECT_EQ(0, icon_size.width); |
459 EXPECT_EQ(0, icon_size.height); | 460 EXPECT_EQ(0, icon_size.height); |
460 | 461 |
461 SkBitmap bitmap; | 462 SkBitmap bitmap; |
462 const int kTestImageSize = 10; | 463 const int kTestImageSize = 10; |
463 const int kTargetImageSize = 48; | 464 const int kTargetImageSize = 48; |
464 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kTestImageSize, kTestImageSize); | 465 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kTestImageSize, kTestImageSize); |
465 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false); | 466 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false); |
466 icon_size = [[button image] size]; | 467 icon_size = [[button image] size]; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 // Test that a button being held down with the left button does not also show | 989 // Test that a button being held down with the left button does not also show |
989 // a context menu. | 990 // a context menu. |
990 [GetItemViewAt(0) highlight:YES]; | 991 [GetItemViewAt(0) highlight:YES]; |
991 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]); | 992 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]); |
992 [GetItemViewAt(0) highlight:NO]; | 993 [GetItemViewAt(0) highlight:NO]; |
993 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]); | 994 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]); |
994 } | 995 } |
995 | 996 |
996 } // namespace test | 997 } // namespace test |
997 } // namespace app_list | 998 } // namespace app_list |
OLD | NEW |