Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view_unittest.mm

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes? Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
9 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h"
12 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 13 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/platform_test.h" 16 #include "testing/platform_test.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/base/theme_provider.h"
19 #include "ui/gfx/image/image_skia.h" 19 #include "ui/gfx/image/image_skia.h"
20 20
21 using ::testing::_; 21 using ::testing::_;
22 using ::testing::DoAll; 22 using ::testing::DoAll;
23 using ::testing::NiceMock; 23 using ::testing::NiceMock;
24 using ::testing::Return; 24 using ::testing::Return;
25 using ::testing::SetArgumentPointee; 25 using ::testing::SetArgumentPointee;
26 26
27 // Allows us to inject our fake controller below. 27 // Allows us to inject our fake controller below.
28 @interface BookmarkBarToolbarView (TestingAPI) 28 @interface BookmarkBarToolbarView (TestingAPI)
29 -(void)setController:(id<BookmarkBarToolbarViewController>)controller; 29 -(void)setController:(id<BookmarkBarToolbarViewController>)controller;
30 @end 30 @end
31 31
32 @implementation BookmarkBarToolbarView (TestingAPI) 32 @implementation BookmarkBarToolbarView (TestingAPI)
33 -(void)setController:(id<BookmarkBarToolbarViewController>)controller { 33 -(void)setController:(id<BookmarkBarToolbarViewController>)controller {
34 controller_ = controller; 34 controller_ = controller;
35 } 35 }
36 @end 36 @end
37 37
38 // Allows us to control which way the view is rendered. 38 // Allows us to control which way the view is rendered.
39 @interface DrawDetachedBarFakeController : 39 @interface DrawDetachedBarFakeController :
40 NSObject<BookmarkBarState, BookmarkBarToolbarViewController> { 40 NSObject<BookmarkBarState, BookmarkBarToolbarViewController> {
41 @private 41 @private
42 int currentTabContentsHeight_; 42 int currentTabContentsHeight_;
43 ThemeService* themeService_; 43 Profile* profile_;
44 BookmarkBar::State state_; 44 BookmarkBar::State state_;
45 BOOL isEmpty_; 45 BOOL isEmpty_;
46 } 46 }
47 @property (nonatomic, assign) int currentTabContentsHeight; 47 @property (nonatomic, assign) int currentTabContentsHeight;
48 @property (nonatomic, assign) ThemeService* themeService; 48 @property (nonatomic, assign) Profile* profile;
49 @property (nonatomic, assign) BookmarkBar::State state; 49 @property (nonatomic, assign) BookmarkBar::State state;
50 @property (nonatomic, assign) BOOL isEmpty; 50 @property (nonatomic, assign) BOOL isEmpty;
51 51
52 // |BookmarkBarState| protocol: 52 // |BookmarkBarState| protocol:
53 - (BOOL)isVisible; 53 - (BOOL)isVisible;
54 - (BOOL)isAnimationRunning; 54 - (BOOL)isAnimationRunning;
55 - (BOOL)isInState:(BookmarkBar::State)state; 55 - (BOOL)isInState:(BookmarkBar::State)state;
56 - (BOOL)isAnimatingToState:(BookmarkBar::State)state; 56 - (BOOL)isAnimatingToState:(BookmarkBar::State)state;
57 - (BOOL)isAnimatingFromState:(BookmarkBar::State)state; 57 - (BOOL)isAnimatingFromState:(BookmarkBar::State)state;
58 - (BOOL)isAnimatingFromState:(BookmarkBar::State)fromState 58 - (BOOL)isAnimatingFromState:(BookmarkBar::State)fromState
59 toState:(BookmarkBar::State)toState; 59 toState:(BookmarkBar::State)toState;
60 - (BOOL)isAnimatingBetweenState:(BookmarkBar::State)fromState 60 - (BOOL)isAnimatingBetweenState:(BookmarkBar::State)fromState
61 andState:(BookmarkBar::State)toState; 61 andState:(BookmarkBar::State)toState;
62 - (CGFloat)detachedMorphProgress; 62 - (CGFloat)detachedMorphProgress;
63 @end 63 @end
64 64
65 @implementation DrawDetachedBarFakeController 65 @implementation DrawDetachedBarFakeController
66 @synthesize currentTabContentsHeight = currentTabContentsHeight_; 66 @synthesize currentTabContentsHeight = currentTabContentsHeight_;
67 @synthesize themeService = themeService_; 67 @synthesize profile = profile_;
68 @synthesize state = state_; 68 @synthesize state = state_;
69 @synthesize isEmpty = isEmpty_; 69 @synthesize isEmpty = isEmpty_;
70 70
71 - (id)init { 71 - (id)init {
72 if ((self = [super init])) { 72 if ((self = [super init])) {
73 [self setState:BookmarkBar::HIDDEN]; 73 [self setState:BookmarkBar::HIDDEN];
74 } 74 }
75 return self; 75 return self;
76 } 76 }
77 77
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 *arg1 = ThemeProperties::NO_REPEAT; 117 *arg1 = ThemeProperties::NO_REPEAT;
118 return true; 118 return true;
119 } 119 }
120 120
121 ACTION(SetAlignLeft) { 121 ACTION(SetAlignLeft) {
122 *arg1 = ThemeProperties::ALIGN_LEFT; 122 *arg1 = ThemeProperties::ALIGN_LEFT;
123 return true; 123 return true;
124 } 124 }
125 125
126 // TODO(viettrungluu): write more unit tests, especially after my refactoring. 126 // TODO(viettrungluu): write more unit tests, especially after my refactoring.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698