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

Side by Side Diff: ui/app_list/cocoa/apps_grid_controller_unittest.mm

Issue 1154323002: Use app list item shadow for app list folders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_arrow_keys_crash
Patch Set: fix mac compile Created 5 years, 6 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/app_list/app_list_item.cc ('k') | ui/app_list/cocoa/apps_grid_view_item.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 EXPECT_NSEQ(@"Item 2", [button title]); 431 EXPECT_NSEQ(@"Item 2", [button title]);
432 EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent()); 432 EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent());
433 433
434 // Update the title via the ItemModelObserver. 434 // Update the title via the ItemModelObserver.
435 app_list::AppListItem* item_model = 435 app_list::AppListItem* item_model =
436 model()->top_level_item_list()->item_at(2); 436 model()->top_level_item_list()->item_at(2);
437 model()->SetItemName(item_model, "UpdatedItem"); 437 model()->SetItemName(item_model, "UpdatedItem");
438 EXPECT_NSEQ(@"UpdatedItem", [button title]); 438 EXPECT_NSEQ(@"UpdatedItem", [button title]);
439 439
440 // Test icon updates through the model observer by ensuring the icon changes. 440 // Test icon updates through the model observer by ensuring the icon changes.
441 item_model->SetIcon(gfx::ImageSkia(), false); 441 item_model->SetIcon(gfx::ImageSkia());
442 NSSize icon_size = [[button image] size]; 442 NSSize icon_size = [[button image] size];
443 EXPECT_EQ(0, icon_size.width); 443 EXPECT_EQ(0, icon_size.width);
444 EXPECT_EQ(0, icon_size.height); 444 EXPECT_EQ(0, icon_size.height);
445 445
446 SkBitmap bitmap; 446 SkBitmap bitmap;
447 const int kTestImageSize = 10; 447 const int kTestImageSize = 10;
448 const int kTargetImageSize = 48; 448 const int kTargetImageSize = 48;
449 bitmap.setInfo(SkImageInfo::MakeN32Premul(kTestImageSize, kTestImageSize)); 449 bitmap.setInfo(SkImageInfo::MakeN32Premul(kTestImageSize, kTestImageSize));
450 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false); 450 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap));
451 icon_size = [[button image] size]; 451 icon_size = [[button image] size];
452 // Icon should always be resized to 48x48. 452 // Icon should always be resized to 48x48.
453 EXPECT_EQ(kTargetImageSize, icon_size.width); 453 EXPECT_EQ(kTargetImageSize, icon_size.width);
454 EXPECT_EQ(kTargetImageSize, icon_size.height); 454 EXPECT_EQ(kTargetImageSize, icon_size.height);
455 } 455 }
456 456
457 TEST_F(AppsGridControllerTest, ModelAdd) { 457 TEST_F(AppsGridControllerTest, ModelAdd) {
458 model()->PopulateApps(2); 458 model()->PopulateApps(2);
459 EXPECT_EQ(2u, [[GetPageAt(0) content] count]); 459 EXPECT_EQ(2u, [[GetPageAt(0) content] count]);
460 EXPECT_EQ(std::string("|Item 0,Item 1|"), GetViewContent()); 460 EXPECT_EQ(std::string("|Item 0,Item 1|"), GetViewContent());
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 // Test that a button being held down with the left button does not also show 966 // Test that a button being held down with the left button does not also show
967 // a context menu. 967 // a context menu.
968 [GetItemViewAt(0) highlight:YES]; 968 [GetItemViewAt(0) highlight:YES];
969 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]); 969 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]);
970 [GetItemViewAt(0) highlight:NO]; 970 [GetItemViewAt(0) highlight:NO];
971 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]); 971 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]);
972 } 972 }
973 973
974 } // namespace test 974 } // namespace test
975 } // namespace app_list 975 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_item.cc ('k') | ui/app_list/cocoa/apps_grid_view_item.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698