| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 GetFaviconForHistoryItem(&item); | 336 GetFaviconForHistoryItem(&item); |
| 337 | 337 |
| 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.allocN32Pixels(25, 25); |
| 347 bitmap.allocPixels(); | |
| 348 bitmap.eraseARGB(255, 255, 0, 0); | 347 bitmap.eraseARGB(255, 255, 0, 0); |
| 349 | 348 |
| 350 // Set up the HistoryItem. | 349 // Set up the HistoryItem. |
| 351 HistoryMenuBridge::HistoryItem item; | 350 HistoryMenuBridge::HistoryItem item; |
| 352 item.menu_item.reset([[NSMenuItem alloc] init]); | 351 item.menu_item.reset([[NSMenuItem alloc] init]); |
| 353 GetFaviconForHistoryItem(&item); | 352 GetFaviconForHistoryItem(&item); |
| 354 | 353 |
| 355 // Pretend to be called back. | 354 // Pretend to be called back. |
| 356 favicon_base::FaviconImageResult image_result; | 355 favicon_base::FaviconImageResult image_result; |
| 357 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); | 356 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); |
| 358 GotFaviconData(&item, image_result); | 357 GotFaviconData(&item, image_result); |
| 359 | 358 |
| 360 // Make sure the callback works. | 359 // Make sure the callback works. |
| 361 EXPECT_FALSE(item.icon_requested); | 360 EXPECT_FALSE(item.icon_requested); |
| 362 EXPECT_TRUE(item.icon.get()); | 361 EXPECT_TRUE(item.icon.get()); |
| 363 EXPECT_TRUE([item.menu_item image]); | 362 EXPECT_TRUE([item.menu_item image]); |
| 364 } | 363 } |
| 365 | 364 |
| 366 } // namespace | 365 } // namespace |
| OLD | NEW |