OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/gtest_mac.h" | 10 #include "testing/gtest_mac.h" |
11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
12 #import "ui/base/test/ui_cocoa_test_helper.h" | 12 #import "ui/base/test/ui_cocoa_test_helper.h" |
13 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 13 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class AutofillSectionViewTest : public ui::CocoaTest { | 17 class AutofillSectionViewTest : public ui::CocoaTest { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 [context_ flushGraphics]; | 67 [context_ flushGraphics]; |
68 NSRect bounds = [view_ bounds]; | 68 NSRect bounds = [view_ bounds]; |
69 for (NSInteger y = 0; y < NSHeight(bounds); ++y) { | 69 for (NSInteger y = 0; y < NSHeight(bounds); ++y) { |
70 for (NSInteger x = 0; x < NSWidth(bounds); ++x) { | 70 for (NSInteger x = 0; x < NSWidth(bounds); ++x) { |
71 ASSERT_NSEQ(color, [bitmap_ colorAtX:x y:y]); | 71 ASSERT_NSEQ(color, [bitmap_ colorAtX:x y:y]); |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 protected: | 76 protected: |
77 scoped_nsobject<AutofillSectionView> view_; | 77 base::scoped_nsobject<AutofillSectionView> view_; |
78 scoped_nsobject<NSBitmapImageRep> bitmap_; | 78 base::scoped_nsobject<NSBitmapImageRep> bitmap_; |
79 scoped_ptr<gfx::ScopedNSGraphicsContextSaveGState> saved_context_; | 79 scoped_ptr<gfx::ScopedNSGraphicsContextSaveGState> saved_context_; |
80 NSGraphicsContext* context_; | 80 NSGraphicsContext* context_; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 TEST_VIEW(AutofillSectionViewTest, view_) | 85 TEST_VIEW(AutofillSectionViewTest, view_) |
86 | 86 |
87 TEST_F(AutofillSectionViewTest, HoverColorIsOpaque) { | 87 TEST_F(AutofillSectionViewTest, HoverColorIsOpaque) { |
88 EXPECT_EQ(1.0, [[view_ hoverColor] alphaComponent]); | 88 EXPECT_EQ(1.0, [[view_ hoverColor] alphaComponent]); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 [view_ drawRect:bounds]; | 122 [view_ drawRect:bounds]; |
123 CheckImageIsSolidColor(fillColor); | 123 CheckImageIsSolidColor(fillColor); |
124 | 124 |
125 // Test there is no higlight if highlight mode is off. | 125 // Test there is no higlight if highlight mode is off. |
126 [view_ setShouldHighlightOnHover:NO]; | 126 [view_ setShouldHighlightOnHover:NO]; |
127 ResetDrawingContext(fillColor); | 127 ResetDrawingContext(fillColor); |
128 [view_ mouseEntered:fakeEvent(NSMouseEntered)]; | 128 [view_ mouseEntered:fakeEvent(NSMouseEntered)]; |
129 [view_ drawRect:bounds]; | 129 [view_ drawRect:bounds]; |
130 CheckImageIsSolidColor(fillColor); | 130 CheckImageIsSolidColor(fillColor); |
131 } | 131 } |
OLD | NEW |