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/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/common/cancelable_request.h" | 14 #include "chrome/browser/common/cancelable_request.h" |
15 #include "chrome/browser/sessions/persistent_tab_restore_service.h" | 15 #include "chrome/browser/sessions/persistent_tab_restore_service.h" |
16 #include "chrome/browser/sessions/session_types_test_helper.h" | |
17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
18 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" | 17 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 18 #include "components/sessions/serialized_navigation_entry_test_helper.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #import "testing/gtest_mac.h" | 21 #import "testing/gtest_mac.h" |
22 #include "third_party/skia/include/core/SkBitmap.h" | 22 #include "third_party/skia/include/core/SkBitmap.h" |
23 #include "ui/gfx/codec/png_codec.h" | 23 #include "ui/gfx/codec/png_codec.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 class MockTRS : public PersistentTabRestoreService { | 27 class MockTRS : public PersistentTabRestoreService { |
28 public: | 28 public: |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 item->title = title; | 89 item->title = title; |
90 item->url = GURL(title); | 90 item->url = GURL(title); |
91 return item; | 91 return item; |
92 } | 92 } |
93 | 93 |
94 MockTRS::Tab CreateSessionTab(const std::string& url, | 94 MockTRS::Tab CreateSessionTab(const std::string& url, |
95 const std::string& title) { | 95 const std::string& title) { |
96 MockTRS::Tab tab; | 96 MockTRS::Tab tab; |
97 tab.current_navigation_index = 0; | 97 tab.current_navigation_index = 0; |
98 tab.navigations.push_back( | 98 tab.navigations.push_back( |
99 SessionTypesTestHelper::CreateNavigation(url, title)); | 99 sessions::SerializedNavigationEntryTestHelper::CreateNavigation( |
| 100 url, title)); |
100 return tab; | 101 return tab; |
101 } | 102 } |
102 | 103 |
103 void GetFaviconForHistoryItem(HistoryMenuBridge::HistoryItem* item) { | 104 void GetFaviconForHistoryItem(HistoryMenuBridge::HistoryItem* item) { |
104 bridge_->GetFaviconForHistoryItem(item); | 105 bridge_->GetFaviconForHistoryItem(item); |
105 } | 106 } |
106 | 107 |
107 void GotFaviconData( | 108 void GotFaviconData( |
108 HistoryMenuBridge::HistoryItem* item, | 109 HistoryMenuBridge::HistoryItem* item, |
109 const history::FaviconImageResult& image_result) { | 110 const history::FaviconImageResult& image_result) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); | 355 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); |
355 GotFaviconData(&item, image_result); | 356 GotFaviconData(&item, image_result); |
356 | 357 |
357 // Make sure the callback works. | 358 // Make sure the callback works. |
358 EXPECT_FALSE(item.icon_requested); | 359 EXPECT_FALSE(item.icon_requested); |
359 EXPECT_TRUE(item.icon.get()); | 360 EXPECT_TRUE(item.icon.get()); |
360 EXPECT_TRUE([item.menu_item image]); | 361 EXPECT_TRUE([item.menu_item image]); |
361 } | 362 } |
362 | 363 |
363 } // namespace | 364 } // namespace |
OLD | NEW |