| 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" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h" | 14 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h" |
| 15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 16 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" | 16 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 18 #include "components/favicon_base/favicon_types.h" | 18 #include "components/favicon_base/favicon_types.h" |
| 19 #include "components/sessions/core/persistent_tab_restore_service.h" | 19 #include "components/sessions/core/persistent_tab_restore_service.h" |
| 20 #include "components/sessions/serialized_navigation_entry_test_helper.h" | 20 #include "components/sessions/serialized_navigation_entry_test_helper.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #import "testing/gtest_mac.h" | 23 #import "testing/gtest_mac.h" |
| 24 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 25 #include "ui/gfx/codec/png_codec.h" | 25 #include "ui/gfx/codec/png_codec.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 class MockTRS : public PersistentTabRestoreService { | 29 class MockTRS : public sessions::PersistentTabRestoreService { |
| 30 public: | 30 public: |
| 31 MockTRS(Profile* profile) | 31 MockTRS(Profile* profile) |
| 32 : PersistentTabRestoreService( | 32 : sessions::PersistentTabRestoreService( |
| 33 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile)), | 33 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile)), |
| 34 nullptr) {} | 34 nullptr) {} |
| 35 MOCK_CONST_METHOD0(entries, const TabRestoreService::Entries&()); | 35 MOCK_CONST_METHOD0(entries, const sessions::TabRestoreService::Entries&()); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 class MockBridge : public HistoryMenuBridge { | 38 class MockBridge : public HistoryMenuBridge { |
| 39 public: | 39 public: |
| 40 MockBridge(Profile* profile) | 40 MockBridge(Profile* profile) |
| 41 : HistoryMenuBridge(profile), | 41 : HistoryMenuBridge(profile), |
| 42 menu_([[NSMenu alloc] initWithTitle:@"History"]) {} | 42 menu_([[NSMenu alloc] initWithTitle:@"History"]) {} |
| 43 | 43 |
| 44 NSMenu* HistoryMenu() override { return menu_.get(); } | 44 NSMenu* HistoryMenu() override { return menu_.get(); } |
| 45 | 45 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); | 351 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); |
| 352 GotFaviconData(&item, image_result); | 352 GotFaviconData(&item, image_result); |
| 353 | 353 |
| 354 // Make sure the callback works. | 354 // Make sure the callback works. |
| 355 EXPECT_FALSE(item.icon_requested); | 355 EXPECT_FALSE(item.icon_requested); |
| 356 EXPECT_TRUE(item.icon.get()); | 356 EXPECT_TRUE(item.icon.get()); |
| 357 EXPECT_TRUE([item.menu_item image]); | 357 EXPECT_TRUE([item.menu_item image]); |
| 358 } | 358 } |
| 359 | 359 |
| 360 } // namespace | 360 } // namespace |
| OLD | NEW |