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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // Make sure the item was modified properly. | 338 // Make sure the item was modified properly. |
339 EXPECT_TRUE(item.icon_requested); | 339 EXPECT_TRUE(item.icon_requested); |
340 EXPECT_NE(base::CancelableTaskTracker::kBadTaskId, item.icon_task_id); | 340 EXPECT_NE(base::CancelableTaskTracker::kBadTaskId, item.icon_task_id); |
341 } | 341 } |
342 | 342 |
343 TEST_F(HistoryMenuBridgeTest, GotFaviconData) { | 343 TEST_F(HistoryMenuBridgeTest, GotFaviconData) { |
344 // Create a dummy bitmap. | 344 // Create a dummy bitmap. |
345 SkBitmap bitmap; | 345 SkBitmap bitmap; |
346 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 25, 25); | 346 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 25, 25); |
347 bitmap.allocPixels(); | 347 bitmap.allocPixels(); |
348 bitmap.eraseRGB(255, 0, 0); | 348 bitmap.eraseARGB(255, 255, 0, 0); |
349 | 349 |
350 // Set up the HistoryItem. | 350 // Set up the HistoryItem. |
351 HistoryMenuBridge::HistoryItem item; | 351 HistoryMenuBridge::HistoryItem item; |
352 item.menu_item.reset([[NSMenuItem alloc] init]); | 352 item.menu_item.reset([[NSMenuItem alloc] init]); |
353 GetFaviconForHistoryItem(&item); | 353 GetFaviconForHistoryItem(&item); |
354 | 354 |
355 // Pretend to be called back. | 355 // Pretend to be called back. |
356 favicon_base::FaviconImageResult image_result; | 356 favicon_base::FaviconImageResult image_result; |
357 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); | 357 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); |
358 GotFaviconData(&item, image_result); | 358 GotFaviconData(&item, image_result); |
359 | 359 |
360 // Make sure the callback works. | 360 // Make sure the callback works. |
361 EXPECT_FALSE(item.icon_requested); | 361 EXPECT_FALSE(item.icon_requested); |
362 EXPECT_TRUE(item.icon.get()); | 362 EXPECT_TRUE(item.icon.get()); |
363 EXPECT_TRUE([item.menu_item image]); | 363 EXPECT_TRUE([item.menu_item image]); |
364 } | 364 } |
365 | 365 |
366 } // namespace | 366 } // namespace |
OLD | NEW |