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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 item_model->SetIcon(gfx::ImageSkia(), false); |
458 NSSize icon_size = [[button image] size]; | 458 NSSize icon_size = [[button image] size]; |
459 EXPECT_EQ(0, icon_size.width); | 459 EXPECT_EQ(0, icon_size.width); |
460 EXPECT_EQ(0, icon_size.height); | 460 EXPECT_EQ(0, icon_size.height); |
461 | 461 |
462 SkBitmap bitmap; | 462 SkBitmap bitmap; |
463 const int kTestImageSize = 10; | 463 const int kTestImageSize = 10; |
464 const int kTargetImageSize = 48; | 464 const int kTargetImageSize = 48; |
465 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kTestImageSize, kTestImageSize); | 465 bitmap.setInfo(SkImageInfo::MakeN32Premul(kTestImageSize, kTestImageSize)); |
466 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false); | 466 item_model->SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false); |
467 icon_size = [[button image] size]; | 467 icon_size = [[button image] size]; |
468 // Icon should always be resized to 48x48. | 468 // Icon should always be resized to 48x48. |
469 EXPECT_EQ(kTargetImageSize, icon_size.width); | 469 EXPECT_EQ(kTargetImageSize, icon_size.width); |
470 EXPECT_EQ(kTargetImageSize, icon_size.height); | 470 EXPECT_EQ(kTargetImageSize, icon_size.height); |
471 } | 471 } |
472 | 472 |
473 TEST_F(AppsGridControllerTest, ModelAdd) { | 473 TEST_F(AppsGridControllerTest, ModelAdd) { |
474 model()->PopulateApps(2); | 474 model()->PopulateApps(2); |
475 EXPECT_EQ(2u, [[GetPageAt(0) content] count]); | 475 EXPECT_EQ(2u, [[GetPageAt(0) content] count]); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 // 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 |
990 // a context menu. | 990 // a context menu. |
991 [GetItemViewAt(0) highlight:YES]; | 991 [GetItemViewAt(0) highlight:YES]; |
992 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]); | 992 EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]); |
993 [GetItemViewAt(0) highlight:NO]; | 993 [GetItemViewAt(0) highlight:NO]; |
994 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]); | 994 EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]); |
995 } | 995 } |
996 | 996 |
997 } // namespace test | 997 } // namespace test |
998 } // namespace app_list | 998 } // namespace app_list |
OLD | NEW |