| 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 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
| 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // When testing the floating drawing, we need to have a source of theme data. | 26 // When testing the floating drawing, we need to have a source of theme data. |
| 27 class MockThemeProvider : public ui::ThemeProvider { | 27 class MockThemeProvider : public ui::ThemeProvider { |
| 28 public: | 28 public: |
| 29 // Cross platform methods | 29 // Cross platform methods |
| 30 MOCK_METHOD1(Init, void(Profile*)); | 30 MOCK_METHOD1(Init, void(Profile*)); |
| 31 MOCK_CONST_METHOD1(GetBitmapNamed, SkBitmap*(int)); | 31 MOCK_CONST_METHOD1(GetBitmapNamed, SkBitmap*(int)); |
| 32 MOCK_CONST_METHOD1(GetColor, SkColor(int)); | 32 MOCK_CONST_METHOD1(GetColor, SkColor(int)); |
| 33 MOCK_CONST_METHOD2(GetDisplayProperty, bool(int, int*)); | 33 MOCK_CONST_METHOD2(GetDisplayProperty, bool(int, int*)); |
| 34 MOCK_CONST_METHOD0(ShouldUseNativeFrame, bool()); | 34 MOCK_CONST_METHOD0(ShouldUseNativeFrame, bool()); |
| 35 MOCK_CONST_METHOD1(HasCustomImage, bool(int)); | 35 MOCK_CONST_METHOD1(HasCustomImage, bool(int)); |
| 36 MOCK_CONST_METHOD1(GetRawData, RefCountedMemory*(int)); | 36 MOCK_CONST_METHOD1(GetRawData, base::RefCountedMemory*(int)); |
| 37 | 37 |
| 38 // OSX stuff | 38 // OSX stuff |
| 39 MOCK_CONST_METHOD2(GetNSImageNamed, NSImage*(int, bool)); | 39 MOCK_CONST_METHOD2(GetNSImageNamed, NSImage*(int, bool)); |
| 40 MOCK_CONST_METHOD2(GetNSImageColorNamed, NSColor*(int, bool)); | 40 MOCK_CONST_METHOD2(GetNSImageColorNamed, NSColor*(int, bool)); |
| 41 MOCK_CONST_METHOD2(GetNSColor, NSColor*(int, bool)); | 41 MOCK_CONST_METHOD2(GetNSColor, NSColor*(int, bool)); |
| 42 MOCK_CONST_METHOD2(GetNSColorTint, NSColor*(int, bool)); | 42 MOCK_CONST_METHOD2(GetNSColorTint, NSColor*(int, bool)); |
| 43 MOCK_CONST_METHOD1(GetNSGradient, NSGradient*(int)); | 43 MOCK_CONST_METHOD1(GetNSGradient, NSGradient*(int)); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Allows us to inject our fake controller below. | 46 // Allows us to inject our fake controller below. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 EXPECT_CALL(provider, GetBitmapNamed(IDR_THEME_NTP_BACKGROUND)) | 183 EXPECT_CALL(provider, GetBitmapNamed(IDR_THEME_NTP_BACKGROUND)) |
| 184 .WillRepeatedly(Return(&fake_bg)); | 184 .WillRepeatedly(Return(&fake_bg)); |
| 185 | 185 |
| 186 [controller_.get() setThemeProvider:&provider]; | 186 [controller_.get() setThemeProvider:&provider]; |
| 187 [controller_.get() setCurrentTabContentsHeight:200]; | 187 [controller_.get() setCurrentTabContentsHeight:200]; |
| 188 | 188 |
| 189 [view_ display]; | 189 [view_ display]; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // TODO(viettrungluu): write more unit tests, especially after my refactoring. | 192 // TODO(viettrungluu): write more unit tests, especially after my refactoring. |
| OLD | NEW |