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/sys_string_conversions.h" | 11 #include "base/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" | 16 #include "chrome/browser/sessions/session_types_test_helper.h" |
17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
18 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" | 18 #include "chrome/browser/ui/cocoa/history_menu_bridge.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: |
29 MockTRS(Profile* profile) : PersistentTabRestoreService(profile, NULL) {} | 29 explicit MockTRS(Profile* profile) |
| 30 : PersistentTabRestoreService(profile, NULL) {} |
30 MOCK_CONST_METHOD0(entries, const TabRestoreService::Entries&()); | 31 MOCK_CONST_METHOD0(entries, const TabRestoreService::Entries&()); |
31 }; | 32 }; |
32 | 33 |
33 class MockBridge : public HistoryMenuBridge { | 34 class MockBridge : public HistoryMenuBridge { |
34 public: | 35 public: |
35 MockBridge(Profile* profile) | 36 explicit MockBridge(Profile* profile) |
36 : HistoryMenuBridge(profile), | 37 : HistoryMenuBridge(profile), |
37 menu_([[NSMenu alloc] initWithTitle:@"History"]) {} | 38 menu_([[NSMenu alloc] initWithTitle:@"History"]) {} |
38 | 39 |
39 virtual NSMenu* HistoryMenu() { | 40 virtual NSMenu* HistoryMenu() { |
40 return menu_.get(); | 41 return menu_.get(); |
41 } | 42 } |
42 | 43 |
43 private: | 44 private: |
44 scoped_nsobject<NSMenu> menu_; | 45 scoped_nsobject<NSMenu> menu_; |
45 }; | 46 }; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 image_result.image = gfx::Image(bitmap); | 355 image_result.image = gfx::Image(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 |