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

Side by Side Diff: chrome/browser/ui/cocoa/background_gradient_view_unittest.mm

Issue 2336453002: BackgroundGradientView: -drawBackground: → -drawRect: (Closed)
Patch Set: Put this back. Created 4 years, 3 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 8 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 // Since BackgroundGradientView doesn't do any drawing by default, we
14 // create a subclass to call its draw method for us.
15 @interface BackgroundGradientSubClassTest : BackgroundGradientView
16 @end
17
18 @implementation BackgroundGradientSubClassTest
19
20 - (void)drawRect:(NSRect)dirtyRect {
21 [self drawBackground:dirtyRect];
22 }
23
24 @end
25
26 namespace { 13 namespace {
27 14
28 class BackgroundGradientViewTest : public CocoaTest { 15 class BackgroundGradientViewTest : public CocoaTest {
29 public: 16 public:
30 BackgroundGradientViewTest() { 17 BackgroundGradientViewTest() {
31 NSRect frame = NSMakeRect(0, 0, 100, 30); 18 NSRect frame = NSMakeRect(0, 0, 100, 30);
32 base::scoped_nsobject<BackgroundGradientSubClassTest> view( 19 base::scoped_nsobject<BackgroundGradientView> view(
33 [[BackgroundGradientSubClassTest alloc] initWithFrame:frame]); 20 [[BackgroundGradientView alloc] initWithFrame:frame]);
34 view_ = view.get(); 21 view_ = view.get();
35 [[test_window() contentView] addSubview:view_]; 22 [[test_window() contentView] addSubview:view_];
36 } 23 }
37 24
38 BackgroundGradientSubClassTest* view_; 25 BackgroundGradientView* view_;
39 }; 26 };
40 27
41 TEST_VIEW(BackgroundGradientViewTest, view_) 28 TEST_VIEW(BackgroundGradientViewTest, view_)
42 29
43 // Test drawing, mostly to ensure nothing leaks or crashes. 30 // Test drawing, mostly to ensure nothing leaks or crashes.
44 TEST_F(BackgroundGradientViewTest, DisplayWithDivider) { 31 TEST_F(BackgroundGradientViewTest, DisplayWithDivider) {
45 [view_ setShowsDivider:YES]; 32 [view_ setShowsDivider:YES];
46 [view_ display]; 33 [view_ display];
47 } 34 }
48 35
49 } // namespace 36 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/background_gradient_view.mm ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698